[Bug fortran/43310] -pedantic errors on valid code involving PARAMETERs initialized to intrinsic function result
--- Comment #6 from giese025 at umn dot edu 2010-03-10 16:07 --- (In reply to comment #5) (In reply to comment #4) Not all valid FORTRAN 95 programs will compile properly when using this option. If you want to ensure compliance with one of the FORTRAN standards, please see the -std= option. The problem is that your program does not conform to the Fortran 95 standard. It compiles without error nor warning with gfortran -std=f95 -Wall bar.f90 I'm not trying to sound argumentative here but you can't have it both ways... so are you saying that this is really a problem with -std, as opposed to -pedantic? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310
[Bug fortran/43310] -pedantic errors on valid code involving PARAMETERs initialized to intrinsic function result
--- Comment #7 from kargl at gcc dot gnu dot org 2010-03-10 17:17 --- (In reply to comment #6) (In reply to comment #5) (In reply to comment #4) Not all valid FORTRAN 95 programs will compile properly when using this option. If you want to ensure compliance with one of the FORTRAN standards, please see the -std= option. The problem is that your program does not conform to the Fortran 95 standard. It compiles without error nor warning with gfortran -std=f95 -Wall bar.f90 I'm not trying to sound argumentative here but you can't have it both ways... so are you saying that this is really a problem with -std, as opposed to -pedantic? The issue is with -pedantic. It doesn't do what one may think it does. When one uses -pedantic, it will strictly enforce a range of [-huge():huge()] on integer types. Without -pedantic, the range is [-huge()-1:huge()]. There are issues with either choice of range. You found one with NOT(1). Another issue is with IABS() and the most negative integer value. If you're trying to enforce standard conformance use -std=f95. -pedantic has too much baggage from times before gfortran was in the tree. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310
[Bug fortran/43310] -pedantic errors on valid code involving PARAMETERs initialized to intrinsic function result
--- Comment #1 from kargl at gcc dot gnu dot org 2010-03-09 19:40 --- Don't use -pedantic. It forces a symmetric range on the integer type, [-huge():huge]. This can be checked during constant folding, and NOT(A) is detected as an error. gfortran does not instrument the runtime code for NOT(B), so it cannot detect that you are violating the range of the pedantic integer type. The GCC middle end and back end do not enforce the symmetry of the range. There was a long, long, long debate about this years ago in the fort...@gcc.gnu.org mailing list. See the archives for details. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310
[Bug fortran/43310] -pedantic errors on valid code involving PARAMETERs initialized to intrinsic function result
--- Comment #2 from dominiq at lps dot ens dot fr 2010-03-09 20:45 --- Don't use -pedantic. It forces a symmetric range on the integer type, [-huge():huge]. This should probably be documented. Probably after Valid Fortran 95 programs should compile properly with or without this option. However, without this option, certain GNU extensions and traditional Fortran features are supported as well. With this option, many of them are rejected. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310
[Bug fortran/43310] -pedantic errors on valid code involving PARAMETERs initialized to intrinsic function result
--- Comment #3 from kargl at gcc dot gnu dot org 2010-03-09 21:06 --- If one is trying to adhere to a Standard then use -std=. -pedantic simply should not be used with gfortran. As for documenting this, see arith.c, the PR's listed there and the mailing list. -- kargl at gcc dot gnu dot org changed: What|Removed |Added Severity|normal |enhancement Priority|P3 |P5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310
[Bug fortran/43310] -pedantic errors on valid code involving PARAMETERs initialized to intrinsic function result
--- Comment #4 from giese025 at umn dot edu 2010-03-10 01:17 --- (In reply to comment #3) If one is trying to adhere to a Standard then use -std=. -pedantic simply should not be used with gfortran. As for documenting this, see arith.c, the PR's listed there and the mailing list. I think Dominique was referring to the documentation for the regular people, i.e., Sec. (4.3) from the gfortran manual, which is where his quote comes from, and which was the quote that initially caused me to include -pedantic as one of the flags that I (now previously) used when compiling with gfortran. Sec. (4.3) should be changed so that Valid FORTRAN 95 programs should compile properly with or without this option. However, without this option, certain GNU extensions and traditional Fortran features are supported as well. With this option, many of them are rejected. instead reads Not all valid FORTRAN 95 programs will compile properly when using this option. If you want to ensure compliance with one of the FORTRAN standards, please see the -std= option. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310
[Bug fortran/43310] -pedantic errors on valid code involving PARAMETERs initialized to intrinsic function result
--- Comment #5 from kargl at gcc dot gnu dot org 2010-03-10 03:15 --- (In reply to comment #4) Not all valid FORTRAN 95 programs will compile properly when using this option. If you want to ensure compliance with one of the FORTRAN standards, please see the -std= option. The problem is that your program does not conform to the Fortran 95 standard. A program(mer) is forbidden to call an intrinsic procedure if it returns a result that is outside the representable range of the return trye. When you specified -pedantic, you declared that the representable range is [-huge():huge()], which is a strict interpretation of the model number representation of an integer. NOT(1) is invalid with -pedantic. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310