Re: [PATCH] real: fix encoding of negative IEEE double/quad values [PR98216]

2021-09-24 Thread Richard Biener via Gcc-patches
On Thu, Sep 23, 2021 at 10:44 PM Patrick Palka via Gcc-patches wrote: > > In encode_ieee_double/quad, the assignment > > unsigned long VAL = r->sign << 31; > > is intended to set the 31st bit of VAL whenever the given REAL_CST is > negative. But on LP64 hosts it also unintentionally sets the up

[PATCH] real: fix encoding of negative IEEE double/quad values [PR98216]

2021-09-23 Thread Patrick Palka via Gcc-patches
In encode_ieee_double/quad, the assignment unsigned long VAL = r->sign << 31; is intended to set the 31st bit of VAL whenever the given REAL_CST is negative. But on LP64 hosts it also unintentionally sets the upper 32 bits of VAL due to the promotion of r->sign from unsigned:1 to int and the s