public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28200]  New: One warning seems to appear only with '-O2' even though '-Wall' is specified
@ 2006-06-29 11:42 P dot Schaffnit at access dot rwth-aachen dot de
  2006-06-29 13:09 ` [Bug fortran/28200] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: P dot Schaffnit at access dot rwth-aachen dot de @ 2006-06-29 11:42 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/28200] One warning seems to appear only with '-O2' even though '-Wall' is specified
  2006-06-29 11:42 [Bug fortran/28200] New: One warning seems to appear only with '-O2' even though '-Wall' is specified P dot Schaffnit at access dot rwth-aachen dot de
@ 2006-06-29 13:09 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-29 13:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-06-29 12:55 -------
Please read
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options:
-Wuninitialized
Warn if an automatic variable is used without first being initialized or if a
variable may be clobbered by a setjmp call.
These warnings are possible only in optimizing compilation, because they
require data flow information that is computed only when optimizing. If you do
not specify -O, you will not get these warnings. Instead, GCC will issue a
warning about -Wuninitialized requiring -O.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-29 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-29 11:42 [Bug fortran/28200] New: One warning seems to appear only with '-O2' even though '-Wall' is specified P dot Schaffnit at access dot rwth-aachen dot de
2006-06-29 13:09 ` [Bug fortran/28200] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).