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
* [Bug middle-end/60500] [4.7/4.8/4.9 Regression] Spurious warning on derived type initialization
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 ` rguenth at gcc dot gnu.org
2014-03-31 9:39 ` [Bug fortran/60500] " rguenth at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-31 8:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.7.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/60500] [4.7/4.8/4.9 Regression] Spurious warning on derived type initialization
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 ` rguenth at gcc dot gnu.org
2014-04-08 11:24 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-31 9:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Component|middle-end |fortran
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The value is used uninitialized on the work1.data == NULL error path:
work1.data = (void * restrict) __builtin_malloc (MAX_EXPR
<D.2352, 1>);
if (work1.data == 0B)
{
stat.0 = 5014;
}
}
}
}
if ((logical(kind=4)) __builtin_expect ((integer(kind=8)) (stat.0 ==
0), 1, 33))
{
work1.dtype = 297;
work1.dim[0].lbound = 1;
work1.dim[0].ubound = (integer(kind=8)) *n1;
work1.dim[0].stride = 1;
work1.offset = -1;
}
if ((logical(kind=4)) __builtin_expect ((integer(kind=8)) (stat.0 !=
0), 0, 33)) goto L.1;
L.1:;
*st = stat.0;
{
struct ntype D.2358;
struct ntype ntype.3;
integer(kind=8) D.2356;
integer(kind=8) D.2355;
integer(kind=8) D.2354;
struct ntype[0:] * restrict D.2353;
D.2353 = (struct ntype[0:] * restrict) work1.data;
D.2354 = work1.offset;
D.2355 = work1.dim[0].lbound;
D.2356 = work1.dim[0].ubound;
ntype.3.level = 1;
D.2358 = ntype.3;
{
integer(kind=8) S.4;
S.4 = D.2355;
while (1)
{
if (S.4 > D.2356) goto L.3;
(*D.2353)[S.4 + D.2354] = D.2358;
S.4 = S.4 + 1;
}
L.3:;
possibly the L.1 label is misplaced? At least the result would crash if
malloc returned NULL.
Frontend wrong-code bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/60500] [4.7/4.8/4.9 Regression] Spurious warning on derived type initialization
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
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-08 11:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/60500] [4.7/4.8/4.9/4.10 Regression] Spurious warning on derived type initialization
2014-03-11 10:56 [Bug fortran/60500] New: Spurious warning on derived type initialization jonathan.hogg at stfc dot ac.uk
` (2 preceding siblings ...)
2014-04-08 11:24 ` rguenth at gcc dot gnu.org
@ 2014-06-12 13:41 ` 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
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.7.4 |4.8.4
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The 4.7 branch is being closed, moving target milestone to 4.8.4.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/60500] [4.8/4.9/5 Regression] Spurious warning on derived type initialization
2014-03-11 10:56 [Bug fortran/60500] New: Spurious warning on derived type initialization jonathan.hogg at stfc dot ac.uk
` (3 preceding siblings ...)
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 ` jakub at gcc dot gnu.org
2015-03-16 12:10 ` mikael at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-19 13:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.4 |4.8.5
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.4 has been released.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/60500] [4.8/4.9/5 Regression] Spurious warning on derived type initialization
2014-03-11 10:56 [Bug fortran/60500] New: Spurious warning on derived type initialization jonathan.hogg at stfc dot ac.uk
` (4 preceding siblings ...)
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
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-03-16 12:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikael at gcc dot gnu.org
--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> possibly the L.1 label is misplaced? At least the result would crash if
> malloc returned NULL.
>
Mmh, yes; it seems L.1 should come after the (default-)initialization of the
just allocated array.
There is nothing that can be done inside gfc_trans_allocate, because
initialization comes from a frontend-generated statement after the allocate
statement (introduced at revision r164305).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/60500] [4.8/4.9/5/6 Regression] Spurious warning on derived type initialization
2014-03-11 10:56 [Bug fortran/60500] New: Spurious warning on derived type initialization jonathan.hogg at stfc dot ac.uk
` (5 preceding siblings ...)
2015-03-16 12:10 ` mikael at gcc dot gnu.org
@ 2015-06-23 8:13 ` 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
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-23 8:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.5 |4.9.3
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
The gcc-4_8-branch is being closed, re-targeting regressions to 4.9.3.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/60500] [4.9/5/6 Regression] Spurious warning on derived type initialization
2014-03-11 10:56 [Bug fortran/60500] New: Spurious warning on derived type initialization jonathan.hogg at stfc dot ac.uk
` (6 preceding siblings ...)
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 ` jakub at gcc dot gnu.org
2015-06-26 20:26 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 19:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.3 has been released.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/60500] [4.9/5/6 Regression] Spurious warning on derived type initialization
2014-03-11 10:56 [Bug fortran/60500] New: Spurious warning on derived type initialization jonathan.hogg at stfc dot ac.uk
` (7 preceding siblings ...)
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
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60500
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.9.3 |4.9.4
^ 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).