[Bug fortran/84394] compiler error when using modules with derived types in block data subprograms
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 15 00:49:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84394
--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #1)
> Breakpoint 1, check_conflict (attr=attr@entry=0x203caec38,
> name=0x203c22430 "_deallocate", where=where@entry=0x203caec78)
> at ../../gcc/gcc/fortran/symbol.c:485
> 485 gfc_error("%s attribute not allowed in BLOCK DATA program "
> (gdb) p *where
> $1 = {nextc = 0x0, lb = 0x0}
>
> So, gfortran is inserting a _deallocate (perhaps for a temporary array).
> I suspect were can the conflict check for a name starting with an
> underscore.
I forgot to mention that attr->access = ACCESS_PRIVATE, which
the actual root cause. I also suspect that the attr is re-using
a previous attr struct without clear it first. In any case, the
following works around the problem.
Index: symbol.c
===================================================================
--- symbol.c (revision 257665)
+++ symbol.c (working copy)
@@ -479,11 +479,10 @@ check_conflict (symbol_attribute *attr, const char *na
if (attr->intent != INTENT_UNKNOWN)
a1 = intent;
- if (a1 != NULL)
+ if (a1 != NULL && *name != '_')
{
- gfc_error
- ("%s attribute not allowed in BLOCK DATA program unit at %L",
- a1, where);
+ gfc_error("%s attribute not allowed in BLOCK DATA program "
+ "unit at %L", a1, where);
return false;
}
}
More information about the Gcc-bugs
mailing list