*Ping* patch, fortran] Warn about constant integer divisions
Steve Kargl
sgk@troutmask.apl.washington.edu
Wed Jun 24 20:35:00 GMT 2015
On Wed, Jun 24, 2015 at 10:21:59PM +0200, Harald Anlauf wrote:
> Steve,
>
> I do not see any check on the remainder of the integer division.
> A truncation warning is pointless for expressions like 4/2 or
> n*(n+1)/2 with n an integer parameter.
It's not a truncation warning. It is a integer division
warning.
i = 4 / 2
1
Warning: Integer division simplifies to constant '2' at (1) [-Wconversion]
a.f90:9:7:
In compiling LAPACK, there are few n*(n+1)/2 type warnings.
So, yes, it might produce an annoying warning. So be it.
> I use similar expressions for static decompositions or blocking
> that I am afraid would produce warnings in several places.
> Just tell me what the option would be to turn the warning off.
You did read the following part of my reply?
> > Thomas, please following Janne's suggestion of adding a new
> > -W option (I'll suggest -Winteger-division) and add this
> > to -Wall.
If Thomas uses -Winteger-division, then the off switch is
-Wno-integer-division. Just like all the other -W options.
--
Steve
More information about the Fortran
mailing list