Re: Strange enum type conversion

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

 



John (Eljay) Love-Jensen wrote:
> Hi GCC developers,
> 
> Andrew> Isn't [(1 << 31)] UB on a 32-bit machine as well?  Looks like
> integer overflow to me.
> 
> Challenge for the GCC developers:
> 
> I would love if there was a switch like this:  -fundefined-behavior-segv
> 
> Such that if the source touches upon undefined behavior, it does:
> 1) compiler error
> 2) runtime SEGV
> 
> Preferably the first, but in some unavoidable cases the second.
> 
> Also, as far as I am concerned, with that switch enable, it would be
> plenty-fine-okay if the code had to be heavily instrumented (hence possibly
> huge* performance penalty) to check ranges and such so that at runtime the
> undefined behavior code incurs a SEGV.
> 
> Furthermore, a -fimplementation-defined-behavior-segv would likewise be
> nice.
> 
> I know... GCC is open source.  Go ahead, add it myself, and submit the
> patch.  :-)

It could be done in some cases, but in others would be very hard.

Andrew.

[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