[gcc r16-9350] a68: remove redundant HAS_ROWS check from caller side of a68_low_dup

"Jose E. Marchesi via Gcc-cvs" <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:ab9585b17f0def48bb7a3e13f9ddce556f2e6118

commit r16-9350-gab9585b17f0def48bb7a3e13f9ddce556f2e6118
Author: Kanishka Solanki <[email protected]>
Date:   Fri Jun 19 21:55:51 2026 +0530

    a68: remove redundant HAS_ROWS check from caller side of a68_low_dup
    
    This patch removes redundant caller-side HAS_ROWS checks before calls to
    a68_low_dup.
    
    a68_low_dup originally always performed a deep copy, so callers avoided
    invoking it for values without rows by checking HAS_ROWS beforehand.
    
    a68_low_dup now performs its own HAS_ROWS check and returns the original
    expression unchanged when a deep copy is not required. Remove the
    remaining caller-side HAS_ROWS checks, as they are redundant.
    
    gcc/algol68/ChangeLog
    
            * a68-low-clauses.cc (a68_lower_collateral_clause): Do not check
            for rows before calling a68_low_dup.
            * a68-low-units.cc (collect_call_arguments): Likewise.
    
    Signed-off-by: Kanishka Solanki <[email protected]>
    (cherry picked from commit b0e09fad762cb7fbd5431adc073fd1b985e4493f)

Diff:
---
 gcc/algol68/a68-low-clauses.cc | 3 +--
 gcc/algol68/a68-low-units.cc   | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/algol68/a68-low-clauses.cc b/gcc/algol68/a68-low-clauses.cc
index fb77f964770a..29ccc43b0765 100644
--- a/gcc/algol68/a68-low-clauses.cc
+++ b/gcc/algol68/a68-low-clauses.cc
@@ -1137,8 +1137,7 @@ a68_lower_collateral_clause (NODE_T *p ATTRIBUTE_UNUSED,
 	  for (tree_stmt_iterator si = tsi_start (units); !tsi_end_p (si); tsi_next (&si))
 	    {
 	      tree unit = tsi_stmt (si);
-	      if (A68_TYPE_HAS_ROWS_P (TREE_TYPE (unit)))
-		unit = a68_low_dup (unit);
+	      unit = a68_low_dup (unit);
 	      CONSTRUCTOR_APPEND_ELT (ve, size_int (num_units), unit);
 	      num_units += 1;
 	    }
diff --git a/gcc/algol68/a68-low-units.cc b/gcc/algol68/a68-low-units.cc
index f7bfe6f822fe..e3650aea9521 100644
--- a/gcc/algol68/a68-low-units.cc
+++ b/gcc/algol68/a68-low-units.cc
@@ -1133,8 +1133,7 @@ collect_call_arguments (NODE_T *p, vec<tree, va_gc> *args, LOW_CTX_T ctx)
 	  /* In Algol 68 parameters are passed via an identity declaration, so
 	     this must implement same semantics.  */
 	  tree arg = a68_lower_tree (p, ctx);
-	  if (HAS_ROWS (MOID (p)))
-	    arg = a68_low_dup (arg);
+	  arg = a68_low_dup (arg);
 	  arg = a68_consolidate_ref (MOID (p), arg);
 	  args->quick_push (arg);
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.