User account creation filtered due to spam.

Bug 71729 - -Wl,-z,noexecstack Segmentation fault
Summary: -Wl,-z,noexecstack Segmentation fault
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 6.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-01 14:44 UTC by Pierre Navaro
Modified: 2017-04-23 15:55 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Code example (225 bytes, text/plain)
2016-07-01 14:44 UTC, Pierre Navaro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Navaro 2016-07-01 14:44:00 UTC
Created attachment 38812 [details]
Code example

By compiling and running the attached fortran code prof.f90

You get this error

$ gfortran -Wl,-z,noexecstack prog.f90 ; ./a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f5d7e300e3a
#1  0x7f5d7e30002d
#2  0x7f5d7d7f676f
#3  0x7ffd879cf620
Segmentation fault (core dumped)

without any flag you get

gfortran prog.f90
$ ./a.out
   1.0000000000000000

Unfortunately this flag is present in MPICH alias mpif90.

I get the bug on fedora 24 with gcc version 6.1.1 20160621
Comment 1 Jakub Jelinek 2016-07-01 15:26:52 UTC
Don't do it then.  -z noexecstack asserts there are no trampolines in the code, but your code does need trampolines and thus executable stack, because you are passing address of a nested (contained) subroutine/function to another and not optimizing, so it is not inlined.
Comment 2 Pierre Navaro 2016-07-01 15:30:16 UTC
(In reply to Jakub Jelinek from comment #1)
> Don't do it then.  -z noexecstack asserts there are no trampolines in the
> code, but your code does need trampolines and thus executable stack, because
> you are passing address of a nested (contained) subroutine/function to
> another and not optimizing, so it is not inlined.

It means i have to submit the bug to mpich developers that add this flag in the alias mpif90 ?
Comment 3 Zaak 2017-04-23 15:55:57 UTC
> It means i have to submit the bug to mpich developers that add this flag in the alias mpif90 ?

Well I'm guessing that it's the fedora package system that's adding the -Wl,-z,noexecstack to the mpich wrapper... but I could be wrong, it could be MPICH itself. But either way, the bug is with MPICH or the fedora package of MPICH.