public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/60500] New: Spurious warning on derived type initialization
@ 2014-03-11 10:56 jonathan.hogg at stfc dot ac.uk
  2014-03-31  8:57 ` [Bug middle-end/60500] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jonathan.hogg at stfc dot ac.uk @ 2014-03-11 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60500
           Summary: Spurious warning on derived type initialization
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jonathan.hogg at stfc dot ac.uk

The following code:

module spurious_warning
   implicit none

   type :: ntype
      integer :: level = 1
   end type ntype
contains
   subroutine sub1(n1, n2, st)
      integer, intent(in) :: n1, n2
      integer, intent(out) :: st

      type(ntype), dimension(:), allocatable :: work1
      integer, dimension(:), allocatable :: work2

      allocate(work1(n1), stat=st)
      if(st.ne.0) return

      allocate(work2(n2), stat=st)
      if(st.ne.0) return
   end subroutine sub1
end module spurious_warning

Produces the following spurious warning:
[user@host]$ gfortran-4.8 -O2 -Wall -c bug.f90
bug.f90: In function ‘sub1’:
bug.f90:12:0: warning: ‘work1.dim[0].ubound’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
       type(ntype), dimension(:), allocatable :: work1
 ^

With the following compiler version:
GNU Fortran (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1

Notes:
Removal of -O2 removes the sprurious warning.
Removal of the second allocation removes spurious warning.
Removal of default value in type definition removes spurious warning.

Working theory: The automatic initialization accesses array size as part of
implementation?
>From gcc-bugs-return-446008-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 11 11:14:53 2014
Return-Path: <gcc-bugs-return-446008-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20777 invoked by alias); 11 Mar 2014 11:14:52 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 20743 invoked by uid 48); 11 Mar 2014 11:14:48 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/60500] [4.7/4.8/4.9 Regression] Spurious warning on derived type initialization
Date: Tue, 11 Mar 2014 11:14:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on component short_desc everconfirmed
Message-ID: <bug-60500-4-CxfAEEJfEe@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60500-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60500-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-03/txt/msg00877.txt.bz2
Content-length: 858

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`500

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-11
          Component|fortran                     |middle-end
            Summary|Spurious warning on derived |[4.7/4.8/4.9 Regression]
                   |type initialization         |Spurious warning on derived
                   |                            |type initialization
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
No warning when compiling the test with r176695 (2011-07-23), warning with
r176935 (2011-07-29).


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

end of thread, other threads:[~2015-06-26 20:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-11 10:56 [Bug fortran/60500] New: Spurious warning on derived type initialization jonathan.hogg at stfc dot ac.uk
2014-03-31  8:57 ` [Bug middle-end/60500] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2014-03-31  9:39 ` [Bug fortran/60500] " rguenth at gcc dot gnu.org
2014-04-08 11:24 ` rguenth at gcc dot gnu.org
2014-06-12 13:41 ` [Bug fortran/60500] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:24 ` [Bug fortran/60500] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-03-16 12:10 ` mikael at gcc dot gnu.org
2015-06-23  8:13 ` [Bug fortran/60500] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 19:52 ` [Bug fortran/60500] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:26 ` jakub 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).