https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117434
--- Comment #8 from kargls at comcast dot net ---
(In reply to Iain Sandoe from comment #7)
>
>
> - however, for O0 we get a MAIN__ function which contains:
> <bb 2> :
> FRAME.3.FRAME_BASE.PARENT = 0B;
> __builtin_init_trampoline (&FRAME.3.test, test, &FRAME.3);
> _5 = __builtin_adjust_trampoline (&FRAME.3.test);
> _6 = (logical(kind=4) (*<T6a3>) (void)) _5;
> test.1_1 = _6;
> test.2 = test.1_1;
> test_description = new_test_description (&test.2);
> test_description ={v} {CLOBBER(eos)};
> return;
>
> .. so is, indeed, using a trampoline to call via a pointer.
>
> ==========
>
> However on both Linux and Darwin that I tested on, this works exactly as
> expected (the stack is made executable by the trampoline machinery) and the
> test case executes fine.
>
> Please could folks who saw an issue;
> 1. repeat the tests with the same conditions as above
> 2. report their platform results
% gfcx -o z y.f90 -fdump-tree-optimized && ./z
/usr/local/bin/ld: warning: /tmp/ccVWAwWh.o: requires executable stack (because
the .note.GNU-stack section is executable)
Looking at the dump, I see the same thing
<bb 2> :
FRAME.3.FRAME_BASE.PARENT = 0B;
__builtin_init_trampoline (&FRAME.3.test, test, &FRAME.3);
_5 = __builtin_adjust_trampoline (&FRAME.3.test);
_6 = (logical(kind=4) (*<T69b>) (void)) _5;
test.1_1 = _6;
test.2 = test.1_1;
test_description = new_test_description (&test.2);
test_description ={v} {CLOBBER(eos)};
return;
If I add -save-temps to the command line, the last few lines of z-y.s is
% tail z-y.s
options.0.1:
.long 10308
.long 16383
.long 0
.long 0
.long 1
.long 0
.long 31
.ident "GCC: (GNU) 15.0.0 20241024 (experimental)"
.section .note.GNU-stack,"x",@progbits