https://gcc.gnu.org/g:1927a43b1e824b591ffc750a49b22221796f4005
commit r16-5798-g1927a43b1e824b591ffc750a49b22221796f4005 Author: Rainer Orth <[email protected]> Date: Mon Dec 1 14:17:32 2025 +0100 testsuite: fortran: Fix gfortran.dg/alloc_comp_deep_copy_5.f90 etc. with non-gas/gld [PR122596] 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. 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. Diff: --- gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90 | 4 ++-- gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_6.f90 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90 index 7415eedf2a41..c0b305e47ade 100644 --- 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 index b243a89a6a3e..ae20d5fc861e 100644 --- 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
