From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28400 invoked by alias); 23 Jan 2004 02:19:41 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28392 invoked by uid 48); 23 Jan 2004 02:19:40 -0000 Date: Fri, 23 Jan 2004 02:19:00 -0000 Message-ID: <20040123021940.28391.qmail@sources.redhat.com> From: "rth at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20031107144745.12941.falk@debian.org> References: <20031107144745.12941.falk@debian.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/12941] [tree-ssa] builtin-bitops-1.c miscompilation X-Bugzilla-Reason: CC X-SW-Source: 2004-01/txt/msg02867.txt.bz2 List-Id: ------- 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