https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120131

--- Comment #2 from Vladimir Terzi <vterzi1996 at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> No gfortran is correct this code is invalid without an extra option.
> 
> *** This bug has been marked as a duplicate of bug 33285 ***

So you are implying that this code is invalid according to the Fortran standard
and other compilers are wrong, right?

I understand that `gfortran` treats it as the negation operation applied to a
positive integer.  But is it not possible to treat it like a literal
`b'10000000000000000000000000000000'`?  Also I still find the error message
misleading, since this value fits in the storage size of the kind and I can use
this value (generated through different means) without any problem in the code.
 Incidentally, `ifx` generates a warning in the case of `2147483648` but not in
the case of `-2147483648`, which is intuitively clear for a simple user, who is
unaware of the inner workings of a compiler.

If the standard doesn't specify the numeric ranges for integer types, I find
this limitation inconvenient.  I need to perform bit operations using
`transfer` with an array of integers (which is generated automatically and
copied to the code using compile definitions) as the source and am forced to
replace every `-2147483648` with `-huge(0)-1` only because of `gfortran`.  (For
clarification, I need to use only the default compilation flags.)

Reply via email to