This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/55692] ICE on incorrect use of ASSOCIATED function
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 14 Dec 2012 18:57:09 +0000
- Subject: [Bug fortran/55692] ICE on incorrect use of ASSOCIATED function
- Auto-submitted: auto-generated
- References: <bug-55692-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55692
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |janus at gcc dot gnu.org
--- Comment #2 from janus at gcc dot gnu.org 2012-12-14 18:57:09 UTC ---
(In reply to comment #1)
> Confirmed on 4.4.6, 4.5.3, 4.6.3, 4.7.2, and trunk.
I see it also with 4.3.4.
Here is a preliminary patch which fixes it on trunk:
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (revision 194387)
+++ gcc/fortran/check.c (working copy)
@@ -895,13 +895,11 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr
where = &pointer->where;
- if (pointer->expr_type == EXPR_VARIABLE || pointer->expr_type ==
EXPR_FUNCTION)
- attr1 = gfc_expr_attr (pointer);
- else if (pointer->expr_type == EXPR_NULL)
+ if (pointer->expr_type == EXPR_NULL)
goto null_arg;
- else
- gcc_assert (0); /* Pointer must be a variable or a function. */
+ attr1 = gfc_expr_attr (pointer);
+
if (!attr1.pointer && !attr1.proc_pointer)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER",
With this I get:
L = ASSOCIATED([P1,P2]) ! Error: intrinsic function ASSOCIATED is not ELEMENTAL
1
Error: 'pointer' argument of 'associated' intrinsic at (1) must be a POINTER
... which, I think, is the proper way to reject the test case (and certainly
more polite than an ICE ;)