From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1874 invoked by alias); 25 Jul 2010 10:56:22 -0000 Received: (qmail 1810 invoked by uid 48); 25 Jul 2010 10:56:06 -0000 Date: Sun, 25 Jul 2010 10:56:00 -0000 Message-ID: <20100725105606.1809.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/45034] [4.3/4.4/4.5/4.6 Regression] "safe" conversion from unsigned to signed char gives broken code In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mikpe at it dot uu dot se" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg02758.txt.bz2 ------- Comment #6 from mikpe at it dot uu dot se 2010-07-25 10:56 ------- My bisection identified r114057 as the cause or trigger for this bug: http://gcc.gnu.org/ml/gcc-cvs/2006-05/msg00661.html The assembly code diff for the test case with r114056 and r114057 is: --- char-neg.s-r114056 2010-07-25 12:22:25.000000000 +0200 +++ char-neg.s-r114057 2010-07-25 12:22:31.000000000 +0200 @@ -57,9 +57,10 @@ movl %edi, %eax xorl %ebx, %ebx cmpb $-128, %al + movl %edi, %eax sete %bl negl %eax - movsbl %al,%eax + subl $256, %eax movl %ebx, 8(%esp) movl %eax, 4(%esp) movl %edi, (%esp) which looks completely broken. (This is the inlined code for foo() in the loop in test_neg().) r114057 was backported to 4.1.2, but for some reason the bug doesn't trigger there. -- mikpe at it dot uu dot se changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rakdver at gcc dot gnu dot | |org Known to fail|4.3.2 |4.3.2 4.2.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45034