Re: broken code only when optimized "-O2"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 21, 2021 at 05:13:08PM +0100, Adrian Moreno via Gcc-help wrote:
> On 12/21/21 17:05, Stefan Ring wrote:
> >On Tue, Dec 21, 2021 at 4:40 PM Adrian Moreno via Gcc-help
> ><gcc-help@xxxxxxxxxxx> wrote:
> >>
> >>I'd really appreciate any hint or idea to try to understand this problem.
> >
> >I guess the compiler doesn't like the dereferencing of uninitialized
> >pointers (in the sizeof expressions). I am not 100% sure that this
> >counts as dereferencing, but I would assume so. Because of this the
> >compiler will be free to behave however it likes to.
> 
> I agree that doesn't look good. Replacing them by sizeof (struct ___) 
> expressions does not change the behavior though.

As required by C.  6.3.2.1/2:
  Except when it is the operand of the sizeof operator, [...], an lvalue
  that does not have array type is converted to the value stored in the
  designated object (and is no longer an lvalue); this is called lvalue
  conversion.

There is no dereferencing.


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux