x = ++x + ++x

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

 



Hi everyone,

I ran into the "x = ++x + ++x" type of problem, where someone (not me) put
in some undefined behavior.  >:-(

GCC can warn about those situations, which is very helpful.  Presuming
someone is paying attention, and the appropriate warning is enabled.

(It's even more interesting undefined behavior, since it does different
things on different platforms, and even on the same platform at different
optimization levels.)

What I want to do is have those undefined behavior situations is to have GCC
emit in an assert or an abort.  (If I could just make *THAT* one single
warning be an error but not *ALL* warnings-into-errors, that'd be good too.)

After all, the behavior is undefined, and an assert or an abort is well
within the scope of what a compiler could do.

Any guidance as to how I could accomplish this feat with GCC?

Thanks,
--Eljay




[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