[Bug tree-optimization/27394] double -> char conversion varies with optimization level
olegendo at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Mar 6 13:56:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27394
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |olegendo at gcc dot gnu.org
Resolution|--- |INVALID
Known to fail| |
--- Comment #9 from Oleg Endo <olegendo at gcc dot gnu.org> ---
I've briefly checked this issue on trunk / sh-elf.
For -O0 function 'f' returns -128, while -O1 returs 127. At -O1 'f' gets
inlined and main returns '1'.
Anyway, I think this can be closed. The test case is showing that undefined
behavior is undefined while the main motivation seems to be debugging. For
that there are more modern debugging tools available these days. For example
the option -fsanitize=float-cast-overflow will catch this problem.
More information about the Gcc-bugs
mailing list