[Bug fortran/43310] New: -pedantic errors on valid code involving PARAMETERs initialized to intrinsic function result

giese025 at umn dot edu gcc-bugzilla@gcc.gnu.org
Tue Mar 9 19:06:00 GMT 2010


Easier to explain with a trivial piece of code...
PROGRAM BAR
  LOGICAL :: foo
  INTEGER,PARAMETER :: a = HUGE(1)
  INTEGER :: b
  b = HUGE(1)
  foo = NOT(a) >= 0  ! FAILS WITH -pedantic
  foo = NOT(b) >= 0  ! OK WITH -pedantic
END PROGRAM BAR

If -pedantic is used, then PARAMETERs appear to be handled differently
then if -pedantic is not used.
Moreover, this only seems to be an issue if the parameter is set to the result
of some other function, e.g., huge. 
Additionally, the program compiles as expected if the same code is used but
making the variable NOT a parameter.

This code snippet hasn't been a problem with intel nor nag compilers.
Nor is it a problem with gfortran if -pedantic is not used.

I would expect this to not be a problem with gfortran when -pedantic is used.

The error messege that I receive is

[name@host dir]$ gfortran -c -pedantic bar.f90
bar.f90:6.12:

  foo = NOT(a) >= 0  ! FAILS* WITH -pedantic
            1
Error: Result of NOT gives range error for its kind at (1)


My version

Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.2 20091222 (Red Hat 4.4.2-20) (GCC)


-- 
           Summary: -pedantic errors on valid code involving PARAMETERs
                    initialized to intrinsic function result
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: giese025 at umn dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43310



More information about the Gcc-bugs mailing list