public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/60458] New: Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute
@ 2014-03-07 16:50 antony at cosmologist dot info
2014-03-07 20:38 ` [Bug fortran/60458] " janus at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: antony at cosmologist dot info @ 2014-03-07 16:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60458
Bug ID: 60458
Summary: Error message on associate: deferred type parameter
and requires either the pointer or allocatable
attribute
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: antony at cosmologist dot info
module A
Type T
contains
procedure :: Test
procedure :: TestP
end type
contains
subroutine test(this)
class(T) this
associate(S=> this%TestP())
print *,S
end associate
end subroutine
function TestP(this)
class(T) this
character(LEN=:), allocatable :: TestP
TestP =''
end function TestP
end module
gives error
associate(S=> this%TestP())
1
Error: Entity 's' at (1) has a deferred type parameter and requires either the
pointer or allocatable attribute
At best the error message is unhelpful (defining S with pointer attribute does
not help), and the code seems valid (though it also happens to ICE ifort).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/60458] Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute
2014-03-07 16:50 [Bug fortran/60458] New: Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute antony at cosmologist dot info
@ 2014-03-07 20:38 ` janus at gcc dot gnu.org
2014-03-10 11:44 ` janus at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-07 20:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60458
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |janus at gcc dot gnu.org
--- Comment #1 from janus at gcc dot gnu.org ---
I'm not fully sure if this is valid, but I tend to agree. I think the error you
get is supposed to check for C402 in Fortran 2008:
C402 (R401) A colon shall not be used as a type-param-value except in the
declaration of an entity or component that has the POINTER or ALLOCATABLE
attribute.
If I prevent it from being triggered here, via this patch ...
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 208386)
+++ gcc/fortran/resolve.c (working copy)
@@ -10784,7 +10784,8 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag)
}
/* Constraints on deferred type parameter. */
- if (sym->ts.deferred && !(sym->attr.pointer || sym->attr.allocatable))
+ if (sym->ts.deferred && !(sym->attr.pointer || sym->attr.allocatable)
+ && !sym->attr.associate_var)
{
gfc_error ("Entity '%s' at %L has a deferred type parameter and "
"requires either the pointer or allocatable attribute",
... then I get the following (which looks like a middle-end error):
c0.f90: In function ‘test’:
c0.f90:13:0: error: size of variable ‘s’ is too large
associate(S => this%TestP())
>From gcc-bugs-return-445741-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Mar 07 20:40:25 2014
Return-Path: <gcc-bugs-return-445741-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16623 invoked by alias); 7 Mar 2014 20:40:25 -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 16573 invoked by uid 48); 7 Mar 2014 20:40:22 -0000
From: "charlet at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/60411] ADA bootstrap failure on ARM
Date: Fri, 07 Mar 2014 20:40:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ada
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: charlet at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
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: cc
Message-ID: <bug-60411-4-qhDuz4HqdU@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60411-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60411-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/msg00610.txt.bz2
Content-length: 458
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`411
Arnaud Charlet <charlet at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |charlet at gcc dot gnu.org
--- Comment #4 from Arnaud Charlet <charlet at gcc dot gnu.org> ---
Let me know how things go after the recent commit I made on trunk, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/60458] Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute
2014-03-07 16:50 [Bug fortran/60458] New: Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute antony at cosmologist dot info
2014-03-07 20:38 ` [Bug fortran/60458] " janus at gcc dot gnu.org
@ 2014-03-10 11:44 ` janus at gcc dot gnu.org
2014-03-10 12:16 ` antony at cosmologist dot info
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-10 11:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60458
--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to Antony Lewis from comment #2)
> Here's a related example:
Though the test case may be loosely related to comment 0, the error is probably
not so much related.
Reduced version of comment 2:
implicit none
Type T
integer :: val = 2
end type
associate(X => T())
print *, X%val
end associate
end
This compiles and runs cleanly with 4.6, but gives errors with 4.7, 4.8 and
trunk. I think this should go into a separate PR.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/60458] Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute
2014-03-07 16:50 [Bug fortran/60458] New: Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute antony at cosmologist dot info
2014-03-07 20:38 ` [Bug fortran/60458] " janus at gcc dot gnu.org
2014-03-10 11:44 ` janus at gcc dot gnu.org
@ 2014-03-10 12:16 ` antony at cosmologist dot info
2014-03-10 18:25 ` janus at gcc dot gnu.org
2014-03-10 18:32 ` dominiq at lps dot ens.fr
4 siblings, 0 replies; 6+ messages in thread
From: antony at cosmologist dot info @ 2014-03-10 12:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60458
--- Comment #4 from Antony Lewis <antony at cosmologist dot info> ---
OK, will do. (thought the underlying cause might be same issue with associate
variables)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/60458] Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute
2014-03-07 16:50 [Bug fortran/60458] New: Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute antony at cosmologist dot info
` (2 preceding siblings ...)
2014-03-10 12:16 ` antony at cosmologist dot info
@ 2014-03-10 18:25 ` janus at gcc dot gnu.org
2014-03-10 18:32 ` dominiq at lps dot ens.fr
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-10 18:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60458
--- Comment #5 from janus at gcc dot gnu.org ---
(In reply to janus from comment #3)
> I think this should go into a separate PR.
The problem of comment 2/3 is now tracked as PR60483.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/60458] Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute
2014-03-07 16:50 [Bug fortran/60458] New: Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute antony at cosmologist dot info
` (3 preceding siblings ...)
2014-03-10 18:25 ` janus at gcc dot gnu.org
@ 2014-03-10 18:32 ` dominiq at lps dot ens.fr
4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-10 18:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60458
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-10
Ever confirmed|0 |1
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed for 4.9.0 r208448.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-03-10 18:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-07 16:50 [Bug fortran/60458] New: Error message on associate: deferred type parameter and requires either the pointer or allocatable attribute antony at cosmologist dot info
2014-03-07 20:38 ` [Bug fortran/60458] " janus at gcc dot gnu.org
2014-03-10 11:44 ` janus at gcc dot gnu.org
2014-03-10 12:16 ` antony at cosmologist dot info
2014-03-10 18:25 ` janus at gcc dot gnu.org
2014-03-10 18:32 ` dominiq at lps dot ens.fr
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).