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

* [Bug middle-end/31688] Bogus "may be used uninitialized" warning
  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 ` pinskia at gcc dot gnu dot org
  2007-06-20 15:20 ` jv244 at cam dot ac dot uk
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-24 19:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-04-24 20:05 -------
This is really the oldest uninitialized variable warning bug out there.  PR
5035.

*** This bug has been marked as a duplicate of 5035 ***


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/31688] Bogus "may be used uninitialized" warning
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-06-20 15:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jv244 at cam dot ac dot uk  2007-06-20 15:20 -------
*** Bug 31683 has been marked as a duplicate of this bug. ***


-- 

jv244 at cam dot ac dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jv244 at cam dot ac dot uk


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


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

* [Bug middle-end/31688] Bogus "may be used uninitialized" warning
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-06-20 15:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jv244 at cam dot ac dot uk  2007-06-20 15:25 -------
Tobias, could you reopen this bug (I can't). This is different from PR 5035.
Whereas PR 5035 warns about variables present in the users code, these warnings
come from frontend generated variables (i.e. offset.7 is nowhere present in the
users code). These warnings are thus needlessly confusing and supposedly can be
easily supressed by giving them proper attributes in the fronted.


-- 


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


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

* [Bug fortran/31688] Bogus "may be used uninitialized" warning
  2007-04-24 18:56 [Bug middle-end/31688] New: Bogus "may be used uninitialized" warning burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-06-20 15:26 ` jv244 at cam dot ac dot uk
@ 2007-06-20 16:25 ` burnus at gcc dot gnu dot org
  2007-07-03 10:36 ` fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-20 16:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-06-20 16:25 -------
> Tobias, could you reopen this bug (I can't). This is different from PR 5035.
> Whereas PR 5035 warns about variables present in the users code, these warnings
> come from frontend generated variables
Well, for the middle end it is all the same.

> These warnings are thus needlessly confusing and supposedly can be
> easily supressed by giving them proper attributes in the fronted.
I don't know how one should properly handle these in the front end (without
unneeded initialization of variables), but I reopened the bug and moved it to
the Fortran front end.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
          Component|middle-end                  |fortran
         Resolution|DUPLICATE                   |


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


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

* [Bug fortran/31688] Bogus "may be used uninitialized" warning
  2007-04-24 18:56 [Bug middle-end/31688] New: Bogus "may be used uninitialized" warning burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-03 10:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-07-03 10:36 -------
(In reply to comment #4)
> I don't know how one should properly handle these in the front end (without
> unneeded initialization of variables), but I reopened the bug and moved it to
> the Fortran front end.

They need to be marked with TREE_NO_WARNING. I did that once, but never came
close to submitting the patch. I'll take care of this.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-03 10:36:33
               date|                            |


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


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

* [Bug fortran/31688] Bogus "may be used uninitialized" warning
  2007-04-24 18:56 [Bug middle-end/31688] New: Bogus "may be used uninitialized" warning burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-03 10:37 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-07-03 10:36:33         |2007-07-03 10:37:00
               date|                            |


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


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

* [Bug fortran/31688] Bogus "may be used uninitialized" warning
  2007-04-24 18:56 [Bug middle-end/31688] New: Bogus "may be used uninitialized" warning burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-07-03 10:37 ` fxcoudert at gcc dot gnu dot org
@ 2007-07-04  7:44 ` fxcoudert at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-04  7:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2007-07-04 07:43 -------


*** This bug has been marked as a duplicate of 29459 ***


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |DUPLICATE


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).