-
-
Save kaityo256/54537a4e30db8a9737a07970feccbb6d to your computer and use it in GitHub Desktop.
ubsan sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| double func(double a) {} | |
| int main() { | |
| func(1.0); | |
| } |
Author
Test on Mac OS X (mojave 10.14.1)
$ g++ ub.c
ub.c: In function 'double func(double)':
ub.c:1:24: warning: no return statement in function returning non-void [-Wreturn-type]
double func(double a) {}
^
$ ./a.out; echo $?
0
$ g++ -O1 ub.c
ub.c: In function 'double func(double)':
ub.c:1:24: warning: no return statement in function returning non-void [-Wreturn-type]
double func(double a) {}
^
$ ./a.out; echo $?
zsh: illegal hardware instruction ./a.out
132
$ g++ -Q --help=common |grep sanitize
-fsanitize-address-use-after-scope [disabled]
-fsanitize-coverage=
-fsanitize-recover
-fsanitize-recover=
-fsanitize-sections=<sec1,sec2,...>
-fsanitize-undefined-trap-on-error [disabled]
-fsanitize=
$ g++ -O1 -Q --help=common |grep sanitize
-fsanitize-address-use-after-scope [disabled]
-fsanitize-coverage=
-fsanitize-recover
-fsanitize-recover=
-fsanitize-sections=<sec1,sec2,...>
-fsanitize-undefined-trap-on-error [disabled]
-fsanitize=
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.