-
-
Notifications
You must be signed in to change notification settings - Fork 527
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
TestEncodeAnonymousStruct behaves invalid on ARM (Raspberry Pi) #314
Comments
A simpler way to reproduce, in master:
The problem is the integer size used in the test, which assumes 64 bits. At the very least this test should fail in a more obvious way than with log.Fatal as used now; this comes from Remove() in internal/tag/rm.go. Not sure if we really need to fix the test as such, but can add it so SkipTests in toml_test.go if the architecture is 32 bits maybe. |
Don't use log.Fatal in internal/tag/rm.go Ref: #314
Use 64bit int instead of strconv.Atoi, which uses the int type, the size of which is platform-dependent. Ref: #314
Okay, I fixed the "3735928559: value out of range"-error, and the master branch runs cleanly on 32bit arm. Your new test still fails, but if I replace the int with int64 it works, so this also seems related to some assumptions somewhere that an int is 64 bits. Not entirely sure where though 🤔 Simpler test case:
Outputs:
|
I think it's the FormatInt over here: https://github.com/BurntSushi/toml/blob/master/encode.go#L218-L221 I'll have to check later; many nonletter keys on my laptop are broken and it's all a pain right now; replacement keyboard is taking forever to arrive :-/ But you can check that if you don't want to wait and I think it should be the fix. |
Awesome debugging work :-) Thanks so much, I am currently not in a hurry with the issue, so I think it can wait for the keyboard |
A minimal example extracted from the code to reproduce the issue:
The problem is that this behaves unexpected on 32bit systems:
Note how it has It does work if I pass a static value or copy I guess I know how to fix it, but I'd like to understand why this is happening. |
Simpler example:
|
Awesome!, thanks for fixing! |
I have extended the testcase "TestEncodeAnonymousStruct" like this:
This runs fine on my intel macbook
Then I crosscompile for ARM like so:
GOOS=linux GOARCH=arm GOARM=7 go test -c
And execute the binary on a raspberrypi.
Here is the result:
Does anyone have an idea what could be the issue here ? I realized that it will always take the last field of the embedded struct and adds it for as many times as the struct has fields...
The text was updated successfully, but these errors were encountered: