On Wed, Nov 21, 2018 at 11:23:38AM -0600, Segher Boessenkool wrote: > Hi, > > On Wed, Nov 21, 2018 at 02:13:55PM +0100, Jakub Jelinek wrote: > > As mentioned in the PR, the testcase fails on big-endian targets. > > The following patch tweaks it so that it does not fail there and still > > checks for the original bug. > > It relies on a certain bitfield layout, not just on LE. I think the > testcase should run only on those specific targets where it works. I don't > see how this patch would fix the problem for BE, btw.
With the patch, it doesn't rely on anything, it compares if what you get at runtime from the code combiner would optimize is equal to what is read from a volatile union. Admittedly, it might be better if the initializer was 0x1010101 or say 0x4030201 because on big endian in particular 0x10101 has the top 15 bits all zero and thus that is what is in u.f1, so if the bug can be reproduced with the combine.c + rtlanal.c fix reverted with 0x4030201, it would be better to use that value (in both spots). Jakub