[PATCH] pr53138 - miscompilation of spaceship operator

Uros Bizjak ubizjak@gmail.com
Fri Apr 27 10:04:00 GMT 2012


On Fri, Apr 27, 2012 at 11:49 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> The testcase is miscompiled to this:
>
>        ...
>        movl    (%rsi), %ecx
>        cmpl    %ecx, (%rdi)
>        sbbl    %edx, %edx
>        cmovbe  %edx, %eax
>        ret
>
> but sbbl only preserves the carry flag, not the zero flag.  I suppose
> one could use different patterns with different CC modes, but this is
> the safest fix.
>
> Bootstrapped/regtested x86_64-pc-linux-gnu, ok for mainline?

OK.

> I also reproduced this at least on 4.7; help would be welcome on
> committing it to the branches.  Thanks in advance!

I can take care of this, but I won' be able to do this until Monday.

Thanks,
Uros.



More information about the Gcc-patches mailing list