https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125869
--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
If I add:
else
__builtin_printf("p=%p\n", get_bar());
```
$ ./a.sh || cat x.txt
+ gcc -O3 -fno-PIE pr25754-1a.c -o pr25754-1a.o -c
+ gcc -fno-PIE pr25754-1b.s -o pr25754-1b.o -c
+ gcc -no-pie -z noexecstack pr25754-1a.o pr25754-1b.o -o pr25754-1ba
+ ./pr25754-1ba
+ grep -q PASS x.txt
+ exit 1
p=0x2a
```
It works at -O0.
