This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/57829] Wrong constant folding
- From: "mikpe at it dot uu.se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 05 Jul 2013 13:13:28 +0000
- Subject: [Bug tree-optimization/57829] Wrong constant folding
- Auto-submitted: auto-generated
- References: <bug-57829-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57829
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu.se
--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> ---
If I change it to return the computed value of t, I get wrong code for every
single gcc version from 4.9 down to 3.2.3 on both x86_64 and sparc64. For
int main (void)
{
volatile int k = 1;
int t = 2 | ( ( k - 1) >> 31 );
return t;
}
gcc-4.9 generates
main:
movl $1, -4(%rsp)
movl -4(%rsp), %eax
leal -1(%rax), %eax
sarl $31, %eax
ret
which completely loses all references to the "2 |" part.