[m-rev.] for review: Output INT32_MIN instead of INT32_C(-2147483648).

Julien Fischer jfischer at opturion.com
Thu Apr 9 16:21:47 AEST 2020


On Thu, 9 Apr 2020, Peter Wang wrote:

> When -2147483648i32 is used in a Mercury source file,
> the generated C source file would contain:
>
>    INT32_C(-2147483648)
>
> When compiled with gcc in C89/C90 mode (the default on older versions)
> on a 32-bit platform, gcc would generate this warning:
>
>    warning: this decimal constant is unsigned only in ISO C90
>
> because the unsuffixed decimal constant 2147483648 is given the type
> `unsigned long int' according to C89/C90 rules.
> We previously saw the same warning with Mercury `int' literals.
>
> compiler/c_util.m:
>    In C, write out the value of the min_int32 as the symbolic
>    constant INT32_MIN. This mirrors behaviour for min_int64.

That's fine.

Julien.


More information about the reviews mailing list