https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123253

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2025-12-22
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot 
gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
           Priority|P3                          |P4

--- Comment #8 from anlauf at gcc dot gnu.org ---
(In reply to Jürgen Reuter from comment #7)
> (In reply to Jürgen Reuter from comment #6)
> > Ah, from the description it reads that it is this commit by Harald:
> > 05f9824f44f088f4afa02f03063d638c787162c5
> > https://gcc.gnu.org/git/?p=gcc.git;a=commit;
> > h=05f9824f44f088f4afa02f03063d638c787162c5
> 
> Confirmed. After reverting that commit, the example compiles again.
> Harald, could you take a look, please?

Yes, it's mine.

This small changes fixes the short reproducer here:

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index d8d9009dc42..87f820296c8 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -6789,8 +6838,8 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool
alloc_obj,
       && sym->assoc->target
       && sym->assoc->target->symtree
       && sym->assoc->target->symtree->n.sym
-      && sym->assoc->target->symtree->n.sym->attr.dummy
-      && sym->assoc->target->symtree->n.sym->attr.intent != INTENT_IN)
+      && (!sym->assoc->target->symtree->n.sym->attr.dummy
+         || sym->assoc->target->symtree->n.sym->attr.intent != INTENT_IN))
     check_intentin = false;

   if (check_intentin

However, this creates a regression for one test in associate_76.f90,
where it does no longer detect an invalid pointer assignment.
Need to look at it in more detail.

detect

Reply via email to