------- Comment #5 from ian dot rogers at manchester dot ac dot uk  2007-05-16 
14:01 -------
For the following code given in [1] GCC produces identical multiplication by
constant code [2]. I think as 0x0FFFFFFFF is one of the parameters in this bug
the fact we generate identical multiplication code for 0x1FFFFFFFF means this
is another example of this error.

Thanks,
Ian Rogers

[1]
test.c:
extern long long x;
long long foo() {
   return x * ((((long long)0) << 32) + -1);
}
long long foo2() {
   return x * ((((long long)1) << 32) + -1);
}

[2]
test.s:
        .file   "test.c"
        .text
        .p2align 4,,15
.globl foo
        .type   foo, @function
foo:
        movl    x, %eax
        movl    x+4, %edx
        pushl   %ebp
        movl    %esp, %ebp
        negl    %eax
        popl    %ebp
        adcl    $0, %edx
        negl    %edx
        ret
        .size   foo, .-foo
        .p2align 4,,15
.globl foo2
        .type   foo2, @function
foo2:
        movl    x, %eax
        movl    x+4, %edx
        pushl   %ebp
        movl    %esp, %ebp
        negl    %eax
        popl    %ebp
        adcl    $0, %edx
        negl    %edx
        ret
        .size   foo2, .-foo2
        .ident  "GCC: (GNU) 4.1.2 20061115 (prerelease) (SUSE Linux)"
        .section        .note.GNU-stack,"",@progbits 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31679

Reply via email to