*Ping* patch, fortran] Warn about constant integer divisions
Thomas Koenig
tkoenig@netcologne.de
Fri Jun 26 21:21:00 GMT 2015
Am 24.06.2015 um 22:21 schrieb Harald Anlauf:
> A truncation warning is pointless for expressions like 4/2 or
> n*(n+1)/2 with n an integer parameter.
To get more of a consensus, this version of the patch adds a
new warning option, to be included with -Wall, called
-Winteger-division, and only warns for when something is
truncated.
So, no warning with n*(n+1)/2, but a warning with 3/5.
So, OK for trunk?
Thomas
2015-06-13 Thomas Koenig <tkoenig@gcc.gnu.org>
* arith.c (gfc_arith_divide): With -Winteger-division,
warn about contant integer division if there is a non-zero
remainder.
* invoke.texi: Document -Winteger-division.
* lang.opt: Add -Winteger-division.
2015-06-13 Thomas Koenig <tkoenig@gcc.gnu.org>
* gfortran.dg/warn_conversion_8.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 2625 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150626/a58b1245/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warn_conversion_8.f90
Type: text/x-fortran
Size: 341 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150626/a58b1245/attachment-0001.bin>
More information about the Fortran
mailing list