Skip to content
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

Undefined behavior during the test suite #223

Closed
tueda opened this issue Jul 17, 2017 · 1 comment
Closed

Undefined behavior during the test suite #223

tueda opened this issue Jul 17, 2017 · 1 comment

Comments

@tueda
Copy link
Collaborator

tueda commented Jul 17, 2017

Currently, enabling UndefinedBehaviorSanitizer (-fsanitize=undefined) gives 40 failures for the test suite.

@tueda
Copy link
Collaborator Author

tueda commented Oct 3, 2017

You can see the 40 errors in https://travis-ci.org/tueda/form/jobs/282633736 (found by searching for "runtime error"). A patch to fix (at least them) is tueda@8a643ef. I hope I didn't make any bugs or unreasonable overhead (with compiler optimization), but maybe it would be better for someone to review it.

The list of the 40 errors (line numbers are for the source before the patch):

argument.c:311:15: runtime error: left shift of negative value -1
argument.c:518:15: runtime error: left shift of negative value -1
compiler.c:1246:38: runtime error: signed integer overflow: 2147483600 + 48 cannot be represented in type 'int [27]'
compiler.c:1402:25: runtime error: negation of -2147483648 cannot be represented in type 'int [27]'; cast to an unsigned type to negate this value to itself
normal.c:1968:13: runtime error: left shift of negative value -1
normal.c:2585:13: runtime error: left shift of negative value -1
normal.c:2585:13: runtime error: left shift of negative value -4
normal.c:2691:15: runtime error: left shift of negative value -1
normal.c:767:14: runtime error: left shift of negative value -1
pre.c:4956:5: runtime error: signed integer overflow: 1701411834604692317 * 10 cannot be represented in type 'long int'
pre.c:4956:5: runtime error: signed integer overflow: 9223372036854775800 + 56 cannot be represented in type 'long int'
pre.c:5063:13: runtime error: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long int'
proces.c:2583:8: runtime error: left shift of negative value -1
proces.c:2583:8: runtime error: left shift of negative value -2
proces.c:2583:8: runtime error: left shift of negative value -3
proces.c:2807:5: runtime error: left shift of negative value -1
proces.c:4900:11: runtime error: left shift of negative value -1
proces.c:5409:9: runtime error: left shift of negative value -1
ratio.c:1080:13: runtime error: left shift of negative value -3
ratio.c:1333:12: runtime error: left shift of negative value -1
ratio.c:2916:14: runtime error: left shift of negative value -5
ratio.c:3515:15: runtime error: left shift of negative value -1
sort.c:1971:9: runtime error: left shift of negative value -1
sort.c:1971:9: runtime error: left shift of negative value -2
sort.c:1971:9: runtime error: left shift of negative value -5
token.c:1051:48: runtime error: signed integer overflow: 9223372036854775800 + 8 cannot be represented in type 'long int'
token.c:1051:51: runtime error: signed integer overflow: 100 * 1000000000000000000 cannot be represented in type 'long int'
token.c:1051:51: runtime error: signed integer overflow: 100 * 184467440737095516 cannot be represented in type 'long int'
token.c:992:49: runtime error: signed integer overflow: 9223372036854775800 + 8 cannot be represented in type 'long int'
token.c:992:52: runtime error: signed integer overflow: 100 * 184467440737095516 cannot be represented in type 'long int'
token.c:992:52: runtime error: signed integer overflow: 100 * 2000000000000000000 cannot be represented in type 'long int'
tools.c:2948:5: runtime error: signed integer overflow: 4294967296 * 4294967296 cannot be represented in type 'long int'

TFORM sometimes give an extra error:

reken.c:3785:5: runtime error: signed integer overflow: -3024007687874539721 - 6841854541025503534 cannot be represented in type 'long int'

@tueda tueda closed this as completed in 954024f Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant