This is the mail archive of the gcc@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: [PATCH] Document arithmetic overflow semantics


    The issue is GCC's internal representations, which shouldn't suffer
    from the same issue of poorly defined languages.  Hence, if CSE sees
    "x = i++; i = x" it had better understand exactly what "i = i++" means
    at the RTL-level.  One might hope that the interpretation of RTL and
    TREEs are independent of the source language and target architecture.

I agree.  Which is why I'm in favor of adding flags to tree nodes that say
whether the operation:

(a) has undefined behavior
(b) has defined overflow behavior, documented for the tree node in question
(c) will trap on overflow.

Then each language sets the appropriate bit for each expression it
makes (possibly defaulting to those from the types) and we do our best
to honor them.


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