This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/12941] [tree-ssa] builtin-bitops-1.c miscompilation
- From: "rth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jan 2004 02:19:40 -0000
- Subject: [Bug optimization/12941] [tree-ssa] builtin-bitops-1.c miscompilation
- References: <20031107144745.12941.falk@debian.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rth at gcc dot gnu dot org 2004-01-23 02:19 -------
This is not loop, but combine. Its line of reasoning goes
1) (2 & (1 << (63 - i))) != 0)
2) = (((2 >> (63 - i)) & 1) != 0)
3) = (((2 >> ~i) & 1) != 0) # From SHIFT_COUNT_TRUNCATED
4) = ~i == 1 # Since only 2 >> 1 & 1 != 0
5) = i == -2
Of course, I is never negative; the correct result is I == 62.
Clearly the reasoning in step 4 is flawed if SHIFT_COUNT_TRUNCATED is set.
I've not yet located the exact place in combine that makes this leap...
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rth at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Summary|[tree-ssa] loop |[tree-ssa] builtin-bitops-
|miscompilation |1.c miscompilation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12941