Fix postreload_combine miscompilation (PR 69941)

Jeff Law law@redhat.com
Sat Mar 5 05:27:00 GMT 2016


On 03/04/2016 04:57 PM, Bernd Schmidt wrote:
> This is a transformation which looks for
>
> (set reg1 const)
> (set reg2 (plus reg2 reg1))
>
> and tries to replace all further uses of reg2 with (plus reg2 reg1). The
> problem here is that one of the uses is in a narrower mode, inside a
> zero_extend, so we produce wrong results.
>
> The fix seems rather straightforward, verifying all uses have a mode
> matching the set. Bootstrapped and tested on x86_64-linux, ok?
>
>
> Bernd
>
> rcom-modes.diff
>
>
> 	PR rtl-optimization/69941
> 	* postreload.c (reload_combine_recognize_pattern): Ensure all uses of
> 	the reg share its mode.
>
> testsuite/
> 	PR rtl-optimization/69941
> 	* gcc.dg/torture/pr69941.c: New test.
OK.

FWIW, based on my reading of the BZ, I think this counts as a regression 
-- it just happens to come and go.  I strongly suspect that's due to 
changing register assignments or some such.

I'm going to go ahead and push this to the trunk.

Jeff



More information about the Gcc-patches mailing list