[m-dev.] proposal: specifying integer overflow behaviour, representations etc

Peter Wang novalazy at gmail.com
Sun Apr 15 17:16:42 AEST 2018


On Sun, 15 Apr 2018 02:49:44 -0400 (EDT), Julien Fischer <jfischer at opturion.com> wrote:
> 
> Let me reword that: what I'm doing here is defining what happens when a
> a signed integer overflow occurs for an operation and we are not
> checking / trapping that overflow.  In that case we define the result to
> wrap around.  (Similar to what happens in C# in an unchecked context.)
> 
> This does not preclude the implmentation from doing overflow checking /
> trapping, it just defines what happens when it doesn't.  (The question
> is of the implementation supports overflow checking is a separate one,
> which I'm not addressing here.)

Right.

> > This will prevent the use of UndefinedBehaviorSanitizer to check for
> > integer overflow in Mercury code, until an overflow checking option is
> > added to the Mercury compiler. I haven't used UBSan seriously yet though.
> 
> Is that an objection?  (Obviously, in the presence of the above signed
> integer overflow becomes defined.)

No, it's alright.

Peter


More information about the developers mailing list