https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124033

            Bug ID: 124033
           Summary: gfortran.dg/alloc_comp_deep_copy_5.f90 (and 6) fail
                    with noexecstack on mingw
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nightstrike at gmail dot com
  Target Milestone: ---

Created attachment 63623
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63623&action=edit
example patch

The gfortran.dg/alloc_comp_deep_copy_[56].f90 tests currently have this at the
top added from r16-5798-g1927a43b1e824b:

! { dg-additional-options "-Wa,--noexecstack" { target gas } }
! { dg-additional-options "-Wl,-z,noexecstack" { target gld } }

The intent here was to be more general, as the original tests simply excluded
darwin.  Unfortunately, the assertion that any use of gas supports those
options is also wrong.  It seems more useful to select based on object file
type.  Something like the following would check for the use of gas/gld, but
also ELF, and a different linker argument for the use of PE:

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 c0b305e47ad..0e38a59cfe1 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,7 @@
 ! { dg-do run }
-! { dg-additional-options "-Wa,--noexecstack" { target gas } }
-! { dg-additional-options "-Wl,-z,noexecstack" { target gld } }
+! { dg-additional-options "-Wa,--noexecstack" { target { gas && elf } } }
+! { dg-additional-options "-Wl,-z,noexecstack" { target { gld && elf } } }
+! { dg-additional-options "-Wl,--nxcompat" { target { gld && pe } } }
 !
 ! 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 ae20d5fc861..c5f50f1c7ee 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,7 @@
 ! { dg-do run }
-! { dg-additional-options "-Wa,--noexecstack" { target gas } }
-! { dg-additional-options "-Wl,-z,noexecstack" { target gld } }
+! { dg-additional-options "-Wa,--noexecstack" { target { gas && elf } } }
+! { dg-additional-options "-Wl,-z,noexecstack" { target { gld && elf } } }
+! { dg-additional-options "-Wl,--nxcompat" { target { gld && pe } } }
 !
 ! PR fortran/121628
 ! Test deep copy of recursive allocatable components with both data arrays


The above works on linux and mingw+wine, but I don't know enough about the test
to know if that's good enough.  Hopefully someone with more knowledge and
experience can pick up this idea and run with it.

Reply via email to