Problem with Fix for PR 35163 ?

Pranav Bhandarkar pranav.bhandarkar@gmail.com
Tue Apr 8 14:46:00 GMT 2008


Hi,

Consider the attached testcase.

Working on a private port (Infact I see this problem on
arm-none-eabi-gcc too). I see the following in test.c.003t.original

fail = (short int) usi <= ssi;

And then in test.c.025t.ssa
 usi.2_5 = (short int) usi_4;
 fail.3_6 = usi.2_5 <= ssi_2;

Now ccp1 does constant propagation and we are left with
usi.2_5 = -256;

This causes the test to fail.

Clearly the problem seems to be that since usi is unsigned short int a
short int cant represent all the possible values of usi

I reverted the following patch and the test passed.
 PR middle-end/35163
        * fold-const.c (fold_widened_comparison): Use get_unwidened in
        value-preserving mode.  Disallow final truncation.

Now with the patch reverted, test.c.003t.original has

 fail = (int) ssi >= (int) usi;

And this problem vanished.


Am I missing something here ?

Thanks,
Pranav
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 314 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20080408/274bc752/attachment.bin>


More information about the Gcc mailing list