http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49543
Richard Guenther rguenth at gcc dot gnu.org changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49543
--- Comment #1 from Alexander Carmeli acarmeli at mathworks dot com
2011-06-27 12:36:20 UTC ---
Created attachment 24607
-- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24607
Assembly code demonstrating incorrect cltq instruction placement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49543
--- Comment #2 from Andrew Pinski pinskia at gcc dot gnu.org 2011-06-27
17:40:01 UTC ---
/* Data - 1 overflows */
Yes that would mean it is undefined code. Try -fwrapv.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49543
--- Comment #3 from Alexander Carmeli acarmeli at mathworks dot com
2011-06-27 18:40:25 UTC ---
Andrew,
You are correct about the standard not defining the result.
Similar behavior was fixed before (see bug 36300
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49543
--- Comment #4 from Andrew Pinski pinskia at gcc dot gnu.org 2011-06-27
19:25:37 UTC ---
Well C++ is not C, that is Data is a constant expression in C++ but not in C.
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