diff options
author | Harald Anlauf <anlauf@gmx.de> | 2025-01-25 19:59:56 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2025-01-25 21:17:18 +0100 |
commit | 8fd2158acac181a308126ad7b798b478eb3b7087 (patch) | |
tree | 6d67fe15a02f8e32497bca974a54fe8bd59e5035 /gcc/fortran/class.cc | |
parent | e2f024f586e99fb63dd49e0603f52d1cb765a77e (diff) | |
download | gcc-8fd2158acac181a308126ad7b798b478eb3b7087.zip gcc-8fd2158acac181a308126ad7b798b478eb3b7087.tar.gz gcc-8fd2158acac181a308126ad7b798b478eb3b7087.tar.bz2 |
Fortran: fix issues with variables in BLOCK DATA [PR58857]
PR fortran/58857
gcc/fortran/ChangeLog:
* class.cc (gfc_find_derived_vtab): Declare some frontend generated
variables and procedures (_vtab, _copy, _deallocate) as artificial.
(find_intrinsic_vtab): Likewise.
* trans-decl.cc (check_block_data_decls): New helper function.
(gfc_generate_block_data): Use it to emit warnings for variables
declared in a BLOCK DATA program unit but not in a COMMON block.
gcc/testsuite/ChangeLog:
* gfortran.dg/uncommon_block_data_2.f90: New test.
Diffstat (limited to 'gcc/fortran/class.cc')
-rw-r--r-- | gcc/fortran/class.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fortran/class.cc b/gcc/fortran/class.cc index 97ff54d..df18601 100644 --- a/gcc/fortran/class.cc +++ b/gcc/fortran/class.cc @@ -2498,6 +2498,7 @@ gfc_find_derived_vtab (gfc_symbol *derived) vtab->attr.save = SAVE_IMPLICIT; vtab->attr.vtab = 1; vtab->attr.access = ACCESS_PUBLIC; + vtab->attr.artificial = 1; gfc_set_sym_referenced (vtab); free (name); name = xasprintf ("__vtype_%s", tname); @@ -2610,6 +2611,7 @@ gfc_find_derived_vtab (gfc_symbol *derived) goto cleanup; c->attr.proc_pointer = 1; c->attr.access = ACCESS_PRIVATE; + c->attr.artificial = 1; c->tb = XCNEW (gfc_typebound_proc); c->tb->ppc = 1; if (derived->attr.unlimited_polymorphic @@ -2687,6 +2689,7 @@ gfc_find_derived_vtab (gfc_symbol *derived) goto cleanup; c->attr.proc_pointer = 1; c->attr.access = ACCESS_PRIVATE; + c->attr.artificial = 1; c->tb = XCNEW (gfc_typebound_proc); c->tb->ppc = 1; if (derived->attr.unlimited_polymorphic || derived->attr.abstract @@ -2951,6 +2954,7 @@ find_intrinsic_vtab (gfc_typespec *ts) goto cleanup; c->attr.proc_pointer = 1; c->attr.access = ACCESS_PRIVATE; + c->attr.artificial = 1; c->tb = XCNEW (gfc_typebound_proc); c->tb->ppc = 1; |