[Bug middle-end/84433] gcc 7 and before miscompile loop and remove exit due to incorrect range calculation
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 19 11:03:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84433
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
It's an invalid code:
$ gcc pr84433.c -Wall -fsanitize=undefined -g &&
UBSAN_OPTIONS="print_stacktrace=1" ./a.out
pr84433.c: In function ‘func’:
pr84433.c:45:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^
pr84433.c:36:11: runtime error: index 15 out of bounds for type 'structA [15]'
#0 0x400d5a in func /home/marxin/Programming/testcases/pr84433.c:36
#1 0x400edb in main /home/marxin/Programming/testcases/pr84433.c:62
#2 0x7ffff6d20f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
#3 0x400729 in _start (/home/marxin/Programming/testcases/a.out+0x400729)
B.int1 = 16 expected 16
$ clang pr84433.c -Wall -fsanitize=undefined -g &&
UBSAN_OPTIONS="print_stacktrace=1" ./a.out
pr84433.c:45:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^
1 warning generated.
pr84433.c:36:3: runtime error: index 15 out of bounds for type 'struct structA
[15]'
#0 0x42019a in func /home/marxin/Programming/testcases/pr84433.c:36:24
#1 0x420753 in main /home/marxin/Programming/testcases/pr84433.c:62:3
#2 0x7ffff6eb1f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
#3 0x402829 in _start
/home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120
B.int1 = 16 expected 16
More information about the Gcc-bugs
mailing list