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

--- Comment #8 from Rainer Orth <ro at gcc dot gnu.org> ---
Something is still very wrong with this test: it FAILs not only on Solaris/x86,
but also Solaris/SPARC and Linux/x86_64, always with a SEGV.

Looking closer, I checked the 32-bit Solaris/x86 test, which SEGVs in
__go_init_main:

(gdb) x/20i __go_init_main
   0x81a9cf0 <__go_init_main>:  lea    0x4(%esp),%ecx
   0x81a9cf4 <__go_init_main+4>:        and    $0xfffffff0,%esp
   0x81a9cf7 <__go_init_main+7>:        push   -0x4(%ecx)
   0x81a9cfa <__go_init_main+10>:       push   %ebp
   0x81a9cfb <__go_init_main+11>:       mov    %esp,%ebp
   0x81a9cfd <__go_init_main+13>:       push   %ebx
   0x81a9cfe <__go_init_main+14>:       push   %ecx
   0x81a9cff <__go_init_main+15>:       sub    $0x3d0b50,%esp
   0x81a9d05 <__go_init_main+21>:       sub    $0x8,%esp
=> 0x81a9d08 <__go_init_main+24>:       push   $0x808d1c0

Looking at %esp at various points, I find:

  on entry to __go_init_main            %esp = 0x81a9cf0        text
  after and    $0xfffffff0,%esp         %esp = 0x8a49f30        anon
  after push   %ecx                     %esp = 0x8a49f20        anon
  after sub    $0x3d0b50,%esp           %esp = 0x86793d0        unmapped!
  after sub    $0x8,%esp                %esp = 0x86793c8        unmapped!

as can be seen in the pmap -x output:

 Address Kbytes   RSS Anon Lock Mode     Mapped File
08050000   1388   220    -    - r-x----  [ text ] index0-out.x
  - 0x81ab000
081BA000    156   156    8    - rwx----  [ data ] index0-out.x
  - 0x81e1000
081E1000   3904     -    -    - rwx----  [ data ] index0-out.x
  - 0x85b1000
085B1000     12    12   12    - rwx----  [ heap ]
  - 0x85b4000
08800000     16    12   12    - rw-----  [ anon ]
  - 0x8804000
08804000     40     -    -    - rw-----  [ altstack tid=1 ]
  - 0x880e000
0880E000   4040   192  192    - rw-----  [ anon ]
  - 0x8c00000

I wonder how this can work at all.

Reply via email to