This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/28200] New: One warning seems to appear only with '-O2' even though '-Wall' is specified


Hi!

It might be poorly understanding something, but I am under the impression that
some warning from '-Wall' only appear in conjunction with '-O2'.

Here is a simplified case which seems to exhibit this behaviour: do not look
for much meaning, in this very case the warning turns out to be a bit
unecessary, but no way the compiler could figure that out. Anyway, this is just
one example, and I believe that to be systematic.

It might be nice at some point if someone could fix that, but it's only
compilation diagnostics after all...

Thanks!

Philippe

PS: some sources which trigger this behaviour:
!
      SUBROUTINE Check ( Number )
!
      IMPLICIT   NONE
      INTEGER :: Value
      INTEGER, INTENT(IN) ::   Number
!
      SELECT CASE ( Number )
      CASE ( 1 )
        Value = 11
      CASE ( 2 )
        Value = 12
      CASE ( 3 )
        Value = 13
      CASE DEFAULT
        CALL Some_Routine_Performing_Orderly_Stop
      END SELECT
      IF ( Value .LT. 0 ) THEN
        CALL Some_Routine_Issueing_Some_Warnings
        CALL Some_Routine_Performing_Orderly_Stop
      ENDIF
!
      RETURN
      END SUBROUTINE Check
!

PPS: what I get compiling that:
 gfortran -O2 -g -Wall -c Sources.f90
 Sources.f90: In function 'check':
 Sources.f90:18: warning: 'value' is used uninitialized in this function
whereas 'gfortran -g -Wall -c Sources.f90' gives no warning of any kind

PPPS: my build is not up to date but still relatively recent:
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /USER/philippe/Irix/Gcc_Sources/configure
--prefix=/WORK/philippe/Tools/Gcc --enable-languages=c,fortran
--disable-maintainer-mode --disable-shared
--with-mpfr=/WORK/philippe/Tools/Mpfr --with-gmp=/WORK/philippe/Tools/Gmp
Thread model: posix
gcc version 4.2.0 20060626 (experimental)


-- 
           Summary: One warning seems to appear only with '-O2' even though
                    '-Wall' is specified
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: P dot Schaffnit at access dot rwth-aachen dot de


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]