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

            Bug ID: 117455
           Summary: ld warning about executable stack, follows from PR
                    117434
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jvdelisle at gcc dot gnu.org
  Target Milestone: ---

When compiling the test case from PR117434 here:

module julienne_test_description_m
  implicit none

  abstract interface
    logical function test_function_i()
    end function
  end interface

  type test_description_t
    procedure(test_function_i), pointer, nopass :: test_function_
  end type

contains

  type(test_description_t) function new_test_description(test_function)
    procedure(test_function_i), intent(in), pointer :: test_function
    new_test_description%test_function_ => test_function
  end function

end module

  use julienne_test_description_m
  implicit none
  type(test_description_t) test_description

  test_description = new_test_description(test)

contains

  logical function test()
    test = .true.
  end function

end

Tests here on x86-64-linux-gnu, Fedora 40.

Using the patch from 117434 applied the resulting executable runs with no
error. An warning occurs from ld when compiling:

$ gfc test1.f90 
/usr/bin/ld: warning: /tmp/ccHdNOP8.o: requires executable stack (because the
.note.GNU-stack section is executable)
$ gfc -g test1.f90 
/usr/bin/ld: warning: /tmp/ccxn0UoQ.o: requires executable stack (because the
.note.GNU-stack section is executable)
$ ./a.out

$ gfc -O test1.f90 
$ gfc test1.f90 
/usr/bin/ld: warning: /tmp/ccB9TQqp.o: requires executable stack (because the
.note.GNU-stack section is executable)

$ gfc -O0 test1.f90 
/usr/bin/ld: warning: /tmp/cc84FpAG.o: requires executable stack (because the
.note.GNU-stack section is executable)

Evidently there is some difference between -O and -O0

Reply via email to