[Bug middle-end/49543] Cast move causes incorrect code and numerical results
acarmeli at mathworks dot com
gcc-bugzilla@gcc.gnu.org
Mon Jun 27 20:15:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49543
--- Comment #5 from Alexander Carmeli <acarmeli at mathworks dot com> 2011-06-27 20:15:37 UTC ---
That's a good point. I removed the const and g++ fails as well.
Therefore, the bug is in the C++ compiler too.
Consts can be promoted as well. Why promote the non-const expression and not
promote the const expression? The const expression is constant-folded as a
32-bit subtraction. Therefore, so should the non-const expression. Otherwise,
numerical results depend on the arguments being const or not, and that's
problematic.
My claims still hold:
- Expression folding should not change numerical results compared to
unfolded expressions.
- It is not okay to promote to 64 bit. The value is undefined. The size is.
- If -pedantic compiles, it should generate he same results as without
-pedantic.
More information about the Gcc-bugs
mailing list