public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53655] New: []
@ 2012-06-13 9:10 burnus at gcc dot gnu.org
2012-06-13 9:18 ` [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings burnus at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-13 9:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53655
Bug #: 53655
Summary: []
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings
2012-06-13 9:10 [Bug fortran/53655] New: [] burnus at gcc dot gnu.org
@ 2012-06-13 9:18 ` burnus at gcc dot gnu.org
2012-06-13 9:21 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-13 9:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53655
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
CC| |burnus at gcc dot gnu.org
Summary|[] |[OOP] CLASS-related
| |warnings: "__copy" defined
| |but not used; "default
| |initializer" warnings
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-13 09:18:40 UTC ---
The following code has several warning issues:
a) For foo's "x" there is the warning:
"Derived-type dummy argument 'x' at (1) was declared INTENT(OUT) but was not
set and does not have a default initializer"
As "t" has no components, the warning doesn't make sense.
b) For bar's "x" there is no warning as it is sym->attr.referenced, but I think
one should warn that the "declared type" does not have an initializer.
(I think sym->attr.referenced gets set for "allocatable" dummies, thus, no
warning is printed.)
c) One gets the bogus error:
warning: ‘__copy_MAIN___T2’ defined but not used [-Wunused-function]
It probably should be marked as DECL_ARTIFICIAL().
type t
end type t
type t2
integer :: i
end type t2
contains
subroutine foo(x)
type(t), intent(out) :: x
end subroutine foo
subroutine bar(x)
class(t2), intent(out) :: x
end subroutine bar
end
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings
2012-06-13 9:10 [Bug fortran/53655] New: [] burnus at gcc dot gnu.org
2012-06-13 9:18 ` [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings burnus at gcc dot gnu.org
@ 2012-06-13 9:21 ` burnus at gcc dot gnu.org
2013-08-19 14:25 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-13 9:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53655
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-13 09:20:56 UTC ---
(In reply to comment #1)
> (I think sym->attr.referenced gets set for "allocatable" dummies, thus, no
> warning is printed.)
(As clarification: That wasn't a remark to the issue (b) but a general one.
Note that for allocatables, no warning initializer-related warning should be be
printed. Thus, the current result is okay.)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings
2012-06-13 9:10 [Bug fortran/53655] New: [] burnus at gcc dot gnu.org
2012-06-13 9:18 ` [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings burnus at gcc dot gnu.org
2012-06-13 9:21 ` burnus at gcc dot gnu.org
@ 2013-08-19 14:25 ` janus at gcc dot gnu.org
2013-08-19 15:25 ` janus at gcc dot gnu.org
2013-08-19 20:45 ` [Bug fortran/53655] [OOP] " janus at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-19 14:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53655
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-08-19
CC| |janus at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #1)
> c) One gets the bogus error:
> warning: ‘__copy_MAIN___T2’ defined but not used [-Wunused-function]
> It probably should be marked as DECL_ARTIFICIAL().
This problem has apparently been fixed at some point. I see it neither with
4.7.4, 4.8.2 nor with trunk.
>From gcc-bugs-return-428034-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 19 15:04:06 2013
Return-Path: <gcc-bugs-return-428034-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22284 invoked by alias); 19 Aug 2013 15:04:06 -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 22261 invoked by uid 48); 19 Aug 2013 15:04:04 -0000
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings
Date: Mon, 19 Aug 2013 15:04:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: janus at gcc dot gnu.org
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:
Message-ID: <bug-53655-4-XBTsALWeM8@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-53655-4@http.gcc.gnu.org/bugzilla/>
References: <bug-53655-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: 2013-08/txt/msg00958.txt.bz2
Content-length: 1176
http://gcc.gnu.org/bugzilla/show_bug.cgi?idS655
--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #1)
> a) For foo's "x" there is the warning:
> "Derived-type dummy argument 'x' at (1) was declared INTENT(OUT) but was not
> set and does not have a default initializer"
> As "t" has no components, the warning doesn't make sense.
This is easily fixed by the following:
Index: gcc/fortran/trans-decl.c
==================================================================--- gcc/fortran/trans-decl.c (revision 201834)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -4745,7 +4745,8 @@
gfc_warning ("Dummy argument '%s' at %L was declared "
"INTENT(OUT) but was not set", sym->name,
&sym->declared_at);
- else if (!gfc_has_default_initializer (sym->ts.u.derived))
+ else if (!gfc_has_default_initializer (sym->ts.u.derived)
+ && !sym->ts.u.derived->attr.zero_comp)
gfc_warning ("Derived-type dummy argument '%s' at %L was "
"declared INTENT(OUT) but was not set and "
"does not have a default initializer",
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings
2012-06-13 9:10 [Bug fortran/53655] New: [] burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2013-08-19 14:25 ` janus at gcc dot gnu.org
@ 2013-08-19 15:25 ` janus at gcc dot gnu.org
2013-08-19 20:45 ` [Bug fortran/53655] [OOP] " janus at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-19 15:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53655
--- Comment #5 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #1)
> b) For bar's "x" there is no warning as it is sym->attr.referenced, but I
> think one should warn that the "declared type" does not have an initializer.
With 4.9 trunk, the following code is generated for 'bar':
bar (struct __class_MAIN___T2 & restrict x)
{
if (x->_vptr->_final != 0B)
{
{
struct array0_unknown desc.0;
desc.0.dtype = 600;
desc.0.data = (void * restrict) x->_data;
x->_vptr->_final (&desc.0, x->_vptr->_size, 0);
}
}
(void) __builtin_memcpy ((void *) x->_data, (void *) x->_vptr->_def_init,
(unsigned long) x->_vptr->_size);
}
The _final call is new in 4.9, but the memcpy from _def_init appeared already
with 4.7 and 4.8. (Possibly this is what sets sym->referenced?)
However, I'm not convinced that one should throw a warning here: Even if the
declared type does not have a default initializer, an extended type might have
one and of course we don't know the actual (dynamic) type of the class variable
at compile time (that's why we have the _def_init after all).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/53655] [OOP] "default initializer" warnings
2012-06-13 9:10 [Bug fortran/53655] New: [] burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2013-08-19 15:25 ` janus at gcc dot gnu.org
@ 2013-08-19 20:45 ` janus at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-19 20:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53655
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
Summary|[OOP] CLASS-related |[OOP] "default initializer"
|warnings: "__copy" defined |warnings
|but not used; "default |
|initializer" warnings |
--- Comment #6 from janus at gcc dot gnu.org ---
The patch in comment 4 regtests cleanly. Will commit as obvious.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-19 20:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13 9:10 [Bug fortran/53655] New: [] burnus at gcc dot gnu.org
2012-06-13 9:18 ` [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings burnus at gcc dot gnu.org
2012-06-13 9:21 ` burnus at gcc dot gnu.org
2013-08-19 14:25 ` janus at gcc dot gnu.org
2013-08-19 15:25 ` janus at gcc dot gnu.org
2013-08-19 20:45 ` [Bug fortran/53655] [OOP] " janus 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).