New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asm: "unexpected EOF" error of assembly file #43689
Comments
I think it is reasonable to require the file ended with a newline. |
Is this a requirement for assembly files? But I did not find the corresponding documentation. In addition, I see that there is no such limitation for generating Go files in this way. |
Let's step back a bit. Why do you think it is useful to support non-newline-terminated file? As far as I can tell, most popular editors leave file newline-terminated. And for program-generated files, it is trivial to make it newline-terminated. We could consider supporting it if it is useful. But I'm not sure why. |
For normative. Since we can generate source file that does not end with a newline character, then we should give a qualitative view of this behavior. We can either tell the user through the document that the source file needs to end with a terminator, just like c and java (I have roughly read the standard document of Go and did not see the corresponding description, but I did not read it carefully. If it does have such description please correct me). Either allow this behavior instead of reporting an inexplicable error. It is really simple to add a newline character at the end of the generated source file, but I didn't think of adding a newline character at first, because I think it is more compact if it is not added. I think there are other users like me. |
I think the "unexpected EOF" error reported at the last line of the file is pretty clear. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/84SFhv1JUs6
Create a test file for the above code and run the test.
What did you expect to see?
Pass
What did you see instead?
--- FAIL: TestEOF (0.01s)
eof_test.go:36: exit status 1
/tmp/foo654446592/f.s:4: unexpected EOF
asm: assembly of /tmp/foo654446592/f.s failed
FAIL
exit status 1
If we replace
s := `TEXT ·f(SB), 4, $0-16
MOVQ R8, r1+0(FP)
MOVQ R9, r1+0(FP)
RET`
as
s := `TEXT ·f(SB), 4, $0-16
MOVQ R8, r1+0(FP)
MOVQ R9, r1+0(FP)
RET
`
The test passes.
The assembler parser seems to prohibit a line of instruction followed by EOF, but should we allow the last line to do so ?
The text was updated successfully, but these errors were encountered: