[patch, fortran] Warn about integer**(negative integer)
Thomas Koenig
tkoenig@netcologne.de
Sun Jan 22 09:47:00 GMT 2017
Hello world,
a reacent thread on c.l.f showed another common error - expecting
10**(-3) to expect something different from zero. The attached
patch warns about this result if -Winteger-division is active.
Why -Winteger-division? Two reasons: First, 10**(-3) ist just
a shorthand for integer division. Second, I did not want to add
yet another warning flag.
Regression-tested. OK for trunk?
Thomas
2017-01-22 Thomas Koenig <tkoenig@netcologne.de>
* arith.c (arith_power): If simplifying integer power expression
to zero, warn if -Winteger-division is given.
2017-01-22 Thomas Koenig <tkoenig@netcologne.de>
* gfortran.dg/integer_exponentiation_7.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p1.diff
Type: text/x-patch
Size: 591 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170122/32acc2af/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integer_exponentiation_7.f90
Type: text/x-fortran
Size: 171 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170122/32acc2af/attachment-0001.bin>
More information about the Fortran
mailing list