This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/49543] Cast move causes incorrect code and numerical results


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]