From: Rainer Orth Date: Mon, 1 Dec 2025 13:17:32 +0000 (+0100) Subject: testsuite: fortran: Fix gfortran.dg/alloc_comp_deep_copy_5.f90 etc. with non-gas... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1927a43b1e824b591ffc750a49b22221796f4005;p=thirdparty%2Fgcc.git 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 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 --git a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_5.f90 index 7415eedf2a4..c0b305e47ad 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 b243a89a6a3..ae20d5fc861 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