This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/49543] Cast move causes incorrect code and numerical results
- From: "acarmeli at mathworks dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 27 Jun 2011 20:15:42 +0000
- Subject: [Bug middle-end/49543] Cast move causes incorrect code and numerical results
- Auto-submitted: auto-generated
- References: <bug-49543-4@http.gcc.gnu.org/bugzilla/>
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.