This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/50570] [4.6/4.7 Regression] Incorrect error for assignment to intent(in) pointer
- 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: Sun, 09 Oct 2011 21:15:20 +0000
- Subject: [Bug fortran/50570] [4.6/4.7 Regression] Incorrect error for assignment to intent(in) pointer
- Auto-submitted: auto-generated
- References: <bug-50570-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50570
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
--- Comment #6 from janus at gcc dot gnu.org 2011-10-09 21:15:20 UTC ---
(In reply to comment #5)
> > How about this?
>
> Looks as if should work (for comment 0).
It does. I'll check for regressions.
> (I think the test case in comment 2 is a completely different issue, which
> needs a separate fix.)
Agreed. Separate, though related. I think the error message is a bug indeed. A
way to fix it might be:
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (revision 179722)
+++ gcc/fortran/check.c (working copy)
@@ -458,7 +458,8 @@ variable_check (gfc_expr *e, int n, bool allow_pro
if (e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.intent == INTENT_IN
&& (gfc_current_intrinsic_arg[n]->intent == INTENT_OUT
- || gfc_current_intrinsic_arg[n]->intent == INTENT_INOUT))
+ || gfc_current_intrinsic_arg[n]->intent == INTENT_INOUT)
+ && !(e->symtree->n.sym->attr.pointer && e->ref))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L cannot be INTENT(IN)",
gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,