This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimisations and undefined behaviour


On 11/09/2015 03:56 PM, David Brown wrote:

> We typically cannot use "sanatize" options, nor can we accept that a
> bug in one part of the program causes undue and unnecessarily
> damaging side-effects in other parts.

Well, you have to get used to that.  It is reality: computers work
that way.  I'm sure you know that if you hit the wrong I/O port
with a wild write odd things will happen.  Whether that's "undue" or
"unnecessary" I couldn't say: it just is.

C definitely works that way.  Maybe there should be a nice small
language which is useful for embedded developers and doesn't have
all the interesting UB properties that C has.  (Ada, maybe?  Probably
not.)  Maybe you could define a language compatible with C with the UB
removed.  But defining the semantics of such a language would not be
easy.  And I don't think it makes much sense to change GCC without
such a rigorous language definition.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]