public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/31688]  New: Bogus "may be used uninitialized" warning
@ 2007-04-24 18:56 burnus at gcc dot gnu dot org
  2007-04-24 19:06 ` [Bug middle-end/31688] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-24 18:56 UTC (permalink / raw)
  To: gcc-bugs

[Based on PR 31683]
Compiling the following program with "gfortran -O -Wall" gives the bogus
warning:

foo2.f90:4: warning: 'offset.7' may be used uninitialized in this function
foo2.f90:4: warning: 'stride.6' may be used uninitialized in this function
foo2.f90:4: warning: 'pab.0' may be used uninitialized in this function

However, this part of code is not reachable if uninitialized.

The code is essentially:

int offset.7;
if(pab != 0B)
    offset.7 = -stride.6;
if (pab == 0B) return;
*force_a = (*pab.0)[offset.7]

Full Fortran source:

MODULE test
  IMPLICIT NONE
CONTAINS
  SUBROUTINE overlap(s, lds, pab, force_a)
    INTEGER, INTENT(IN)                         :: lds
    REAL, DIMENSION(lds, lds, *), INTENT(INOUT) :: s
    REAL, DIMENSION(:), INTENT(IN), OPTIONAL    :: pab
    REAL, INTENT(OUT)                           :: force_a

    if(.not.present(pab)) return
    force_a = pab(1)*s(1,1,1)
  END SUBROUTINE
END MODULE test


-- 
           Summary: Bogus "may be used uninitialized" warning
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

end of thread, other threads:[~2007-07-04  7:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-24 18:56 [Bug middle-end/31688] New: Bogus "may be used uninitialized" warning burnus at gcc dot gnu dot org
2007-04-24 19:06 ` [Bug middle-end/31688] " pinskia at gcc dot gnu dot org
2007-06-20 15:20 ` jv244 at cam dot ac dot uk
2007-06-20 15:26 ` jv244 at cam dot ac dot uk
2007-06-20 16:25 ` [Bug fortran/31688] " burnus at gcc dot gnu dot org
2007-07-03 10:36 ` fxcoudert at gcc dot gnu dot org
2007-07-03 10:37 ` fxcoudert at gcc dot gnu dot org
2007-07-04  7:44 ` fxcoudert 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).