public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47386] New: Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized]
@ 2011-01-20 22:02 anlauf at gmx dot de
  2011-01-20 22:03 ` [Bug middle-end/47386] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: anlauf at gmx dot de @ 2011-01-20 22:02 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Wrong warning: ‘w.dim[2].stride’ may be used
                    uninitialized in this function [-Wuninitialized]
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: anlauf@gmx.de


Hi.

the following testcase demonstrates warnings that can be irritating:

% cat gfcbug112.f90
module gfcbug112
  implicit none
  logical             :: ll = .false.
contains
  subroutine calc_W (N, M)
    integer, intent(in) :: N, M

    real                :: T(N,M,M) ! Temporary array 1
    real, allocatable   :: W(:,:,:) ! Temporary array 2

    if(ll) then
       allocate (W(N,M,M))
    end if

    T=0

    if(ll) then
       W = 0
       deallocate (W)
    end if

  end subroutine calc_W
end module gfcbug112
% gfc-trunk -c -Wall -O gfcbug112.f90
gfcbug112.f90: In function ‘calc_w’:
gfcbug112.f90:5:0: warning: ‘w.dim[2].stride’ may be used uninitialized in this
function [-Wuninitialized]


One can get really many of these in large modules...

Harald


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

* [Bug middle-end/47386] Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized]
  2011-01-20 22:02 [Bug fortran/47386] New: Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized] anlauf at gmx dot de
@ 2011-01-20 22:03 ` pinskia at gcc dot gnu.org
  2011-01-21 11:50 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-01-20 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |middle-end

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-01-20 21:21:58 UTC ---
This is the "standard" uninitialized warning for predicates.  There are a few
other bugs like this.


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

* [Bug middle-end/47386] Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized]
  2011-01-20 22:02 [Bug fortran/47386] New: Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized] anlauf at gmx dot de
  2011-01-20 22:03 ` [Bug middle-end/47386] " pinskia at gcc dot gnu.org
@ 2011-01-21 11:50 ` rguenth at gcc dot gnu.org
  2021-04-15  0:46 ` msebor at gcc dot gnu.org
  2022-08-29 13:44 ` [Bug tree-optimization/47386] " rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-21 11:50 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.01.21 11:12:28
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-21 11:12:28 UTC ---
Confirmed.


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

* [Bug middle-end/47386] Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized]
  2011-01-20 22:02 [Bug fortran/47386] New: Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized] anlauf at gmx dot de
  2011-01-20 22:03 ` [Bug middle-end/47386] " pinskia at gcc dot gnu.org
  2011-01-21 11:50 ` rguenth at gcc dot gnu.org
@ 2021-04-15  0:46 ` msebor at gcc dot gnu.org
  2022-08-29 13:44 ` [Bug tree-optimization/47386] " rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-04-15  0:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47386

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2011-01-21 11:12:28         |2021-4-14
             Blocks|                            |24639
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|                            |10.2.0, 11.0, 4.6.0, 4.8.4,
                   |                            |4.9.4, 5.5.0, 6.4.0, 7.2.0,
                   |                            |8.3.0, 9.1.0

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Reconfirmed with GCC 11 and the output below.

$ gcc -O2 -S -Wall pr47386.f90
pr47386.f90:9:35:

    9 |     real, allocatable   :: W(:,:,:) ! Temporary array 2
      |                                   ^
Warning: ‘w.dim[1].stride’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
pr47386.f90:18:12:

   18 |        W = 0
      |            ^
Warning: ‘w.dim[0].ubound’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
pr47386.f90:9:35:

    9 |     real, allocatable   :: W(:,:,:) ! Temporary array 2
      |                                   ^
Warning: ‘w.dim[2].ubound’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
pr47386.f90:9:35: Warning: ‘w.offset’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
pr47386.f90:9:35: Warning: ‘w.dim[2].stride’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
pr47386.f90:9:35: Warning: ‘w.dim[1].ubound’ may be used uninitialized in this
function [-Wmaybe-uninitialized]


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues

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

* [Bug tree-optimization/47386] Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized]
  2011-01-20 22:02 [Bug fortran/47386] New: Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized] anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2021-04-15  0:46 ` msebor at gcc dot gnu.org
@ 2022-08-29 13:44 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-29 13:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47386

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |12.2.0

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Re-confirmed with GCC 12 and trunk.  We diagnose a use of w.dim[1].ubound
conditional on ubound.1 > 0 && ll == 0.  I believe we're jump-threading
if (ll) around the T = 0 stmt and then mixing up paths.  -fno-thread-jumps
fixes
the thing.

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

end of thread, other threads:[~2022-08-29 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-20 22:02 [Bug fortran/47386] New: Wrong warning: ‘w.dim[2].stride’ may be used uninitialized in this function [-Wuninitialized] anlauf at gmx dot de
2011-01-20 22:03 ` [Bug middle-end/47386] " pinskia at gcc dot gnu.org
2011-01-21 11:50 ` rguenth at gcc dot gnu.org
2021-04-15  0:46 ` msebor at gcc dot gnu.org
2022-08-29 13:44 ` [Bug tree-optimization/47386] " rguenth at gcc dot gnu.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).