[Bug tree-optimization/45034] [4.3/4.4/4.5/4.6 Regression] "safe" conversion from unsigned to signed char gives broken code

mikpe at it dot uu dot se gcc-bugzilla@gcc.gnu.org
Sun Jul 25 10:56:00 GMT 2010



------- 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



More information about the Gcc-bugs mailing list