]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix PR 118884, Lapack build failure.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 15 Feb 2025 10:38:05 +0000 (11:38 +0100)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 15 Feb 2025 10:39:51 +0000 (11:39 +0100)
The fix for PR 118845 introduced new checks, which in turn exposed
a case where the typespec information on a symbol generated symbol
was not set.  This led to an apparent type of BT_UNKNOWN, and hence
an error.  Fixed as obvoius and simple.

gcc/fortran/ChangeLog:

* frontend-passes.cc (check_externals_procedure): Copy
typespec from old to new symbol.

gcc/testsuite/ChangeLog:

* gfortran.dg/interface_54.f90: New test.

gcc/fortran/frontend-passes.cc
gcc/testsuite/gfortran.dg/interface_54.f90 [new file with mode: 0644]

index 6b470b83e21af02e8da37d3fe6ad90c555845036..20bf6e127ffcb331c73cc69e9f082a112b28bf09 100644 (file)
@@ -5727,6 +5727,7 @@ check_externals_procedure (gfc_symbol *sym, locus *loc,
   gcc_assert (new_sym);
   new_sym->attr = sym->attr;
   new_sym->attr.if_source = IFSRC_DECL;
+  new_sym->ts = sym->ts;
   gfc_current_ns = gsym->ns;
 
   gfc_get_formal_from_actual_arglist (new_sym, actual);
diff --git a/gcc/testsuite/gfortran.dg/interface_54.f90 b/gcc/testsuite/gfortran.dg/interface_54.f90
new file mode 100644 (file)
index 0000000..98318ca
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! PR 118884 - this used to be rejected due to confused interface
+! checking.
+
+subroutine cget24
+  external cslect
+  logical cslect
+
+  call cgeesx(cslect)
+  if( cslect() ) print *,"foo"
+  call cgeesx(cslect)
+end subroutine cget24