[Bug middle-end/82051] [mips]mips emit different results when compiling union var using -O0/-O2

2024-05-29 Thread syq at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82051

YunQiang Su  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 CC||syq at gcc dot gnu.org
 Status|UNCONFIRMED |RESOLVED

--- Comment #4 from YunQiang Su  ---
So, we believes that it is invalid.

[Bug middle-end/82051] [mips]mips emit different results when compiling union var using -O0/-O2

2017-08-31 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82051

--- Comment #3 from joseph at codesourcery dot com  ---
On Thu, 31 Aug 2017, zwzhangwen.zhang at huawei dot com wrote:

>volatile long long  f1;

> printf ("g_121.f1=%x\n",g_121.f1);

In addition to the other points people have made about active union 
members, %x is not the correct format for long long; use %llx.

[Bug middle-end/82051] [mips]mips emit different results when compiling union var using -O0/-O2

2017-08-31 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82051

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #2 from Richard Biener  ---
(In reply to Andrew Pinski from comment #1)
> I don't know if this is defined or not.  Basically 0x549E5CE9L is really
> 0xCE9 which is stored in the bit-field.  The rest of the bits might be still
> undefined or zero.  I don't remember what the C standard says here.

They are undefined.  The question is what the standard says about the
initializer, what union member gets initialized / activated.  One may read
6.7.9/20 as to
always the first member being initialized / activated.

In this case this PR is INVALID.

I suppose you want = { .f1 = 0x549E5CE9L };

[Bug middle-end/82051] [mips]mips emit different results when compiling union var using -O0/-O2

2017-08-30 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82051

Andrew Pinski  changed:

   What|Removed |Added

  Component|c   |middle-end

--- Comment #1 from Andrew Pinski  ---
I don't know if this is defined or not.  Basically 0x549E5CE9L is really 0xCE9
which is stored in the bit-field.  The rest of the bits might be still
undefined or zero.  I don't remember what the C standard says here.