The gfortran.dg/alloc_comp_deep_copy_[56].f90 tests FAIL on Solaris:
FAIL: gfortran.dg/alloc_comp_deep_copy_5.f90 -O0 (test for excess errors)
UNRESOLVED: gfortran.dg/alloc_comp_deep_copy_5.f90 -O0 compilation failed to
produce executable
and many more when using either or both the native assembler or linker:
Excess errors:
Assembler:
"", line 1 : Illegal flag (-)
which is due to passing --noexecstack to the assembler. This is wrong in
general unless GNU as is used. Likewise, -Wl,-z,noexecstack has the same
issue.
This is *not* a target issue: the tests PASS as-is when using gas/gld on
Solaris (thus the current { target { ! *-*-darwin* } } is wrong, too).
Instead, the gas and gld effective-target keywords should be used to
control whether the flags are used, which is what this patch does.
Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
x86_64-pc-linux-gnu, and x86_64-apple-darwin25.1.0.
Committed to trunk.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2025-11-27 Rainer Orth <[email protected]>
gcc/testsuite:
PR testsuite/122596
* gfortran.dg/alloc_comp_deep_copy_5.f90: Restrict
-Wa,--noexecstack, -Wl,-z,noexecstack to gas, gld.
* gfortran.dg/alloc_comp_deep_copy_6.f90: Likewise.
# HG changeset patch
# Parent a633126c7029836f3aadf5601cef9b34faf18489
testsuite: fortran: Fix gfortran.dg/alloc_comp_deep_copy_5.f90 etc. with non-gas/gld
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90
--- a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90
@@ -1,6 +1,6 @@
! { dg-do run }
-! { dg-additional-options "-Wa,--noexecstack" { target { ! *-*-darwin* } } }
-! { dg-additional-options "-Wl,-z,noexecstack" { target { ! *-*-darwin* } } }
+! { dg-additional-options "-Wa,--noexecstack" { target gas } }
+! { dg-additional-options "-Wl,-z,noexecstack" { target gld } }
!
! PR fortran/121628
! Test deep copy of recursive allocatable array components with multi-level
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_6.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_6.f90
--- a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_6.f90
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_6.f90
@@ -1,6 +1,6 @@
! { dg-do run }
-! { dg-additional-options "-Wa,--noexecstack" { target { ! *-*-darwin* } } }
-! { dg-additional-options "-Wl,-z,noexecstack" { target { ! *-*-darwin* } } }
+! { dg-additional-options "-Wa,--noexecstack" { target gas } }
+! { dg-additional-options "-Wl,-z,noexecstack" { target gld } }
!
! PR fortran/121628
! Test deep copy of recursive allocatable components with both data arrays