public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r15-385] Fortran: fix dependency checks for inquiry refs [PR115039]
@ 2024-05-11 17:42 Harald Anlauf
  0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2024-05-11 17:42 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d4974fd22730014e337fd7ec2471945ba8afb00e

commit r15-385-gd4974fd22730014e337fd7ec2471945ba8afb00e
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri May 10 21:18:03 2024 +0200

    Fortran: fix dependency checks for inquiry refs [PR115039]
    
    gcc/fortran/ChangeLog:
    
            PR fortran/115039
            * expr.cc (gfc_traverse_expr): An inquiry ref does not constitute
            a dependency and cannot collide with a symbol.
    
    gcc/testsuite/ChangeLog:
    
            PR fortran/115039
            * gfortran.dg/statement_function_5.f90: New test.

Diff:
---
 gcc/fortran/expr.cc                                |  2 +-
 gcc/testsuite/gfortran.dg/statement_function_5.f90 | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 66edad58278a..c883966646cb 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -5500,7 +5500,7 @@ gfc_traverse_expr (gfc_expr *expr, gfc_symbol *sym,
 	  break;
 
 	case REF_INQUIRY:
-	  return true;
+	  return false;
 
 	default:
 	  gcc_unreachable ();
diff --git a/gcc/testsuite/gfortran.dg/statement_function_5.f90 b/gcc/testsuite/gfortran.dg/statement_function_5.f90
new file mode 100644
index 000000000000..bc5a5dba7a0f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/statement_function_5.f90
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! PR fortran/115039
+!
+! Check that inquiry refs work with statement functions
+!
+! { dg-additional-options "-std=legacy -fdump-tree-optimized" }
+! { dg-prune-output " Obsolescent feature" }
+! { dg-final { scan-tree-dump-not "_gfortran_stop_numeric" "optimized" } }
+
+program testit
+  implicit none
+  complex :: x
+  real    :: im
+  integer :: slen
+  character(5) :: s
+  im(x)   = x%im + x%re + x%kind
+  slen(s) = s%len
+  if (im((1.0,3.0) + (2.0,4.0)) /= 14.) stop 1
+  if (slen('abcdef') /= 5)              stop 2
+end program testit

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-11 17:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-11 17:42 [gcc r15-385] Fortran: fix dependency checks for inquiry refs [PR115039] Harald Anlauf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).