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

            Bug ID: 64188
           Summary: [5 Regression] empty nested function does use
                    trampoline
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
            Target: x86_64-linux-gnu

(1)
echo 'int main(void) { void func (void) {} func (); return 0; }'|gcc -g -x c
-;readelf -wi a.out|grep DW_AT_static_link
FAIL: gcc (GCC) 5.0.0 20141204 (experimental)
    <63>   DW_AT_static_link : 2 byte block: 91 68      (DW_OP_fbreg: -24)
PASS: gcc (GCC) 4.9.3 20141204 (prerelease)
<nothing>

(2)
echo 'int main(void) { void func (void) {} void (*p) (void) = func; return 0;
}'|gcc -g -Wtrampolines -x c -
FAIL: gcc (GCC) 5.0.0 20141204 (experimental)
<stdin>: In function ‘main’:
<stdin>:1:23: warning: trampoline generated for nested function ‘func’
[-Wtrampolines]
PASS: gcc (GCC) 4.9.3 20141204 (prerelease)
<nothing>

(3)
gcc -x c - <<EOH;./a.out
#include <string.h>
#include <alloca.h>
#include <stdio.h>
static void (*outer (void)) (void) {
  void inner (void) {}
  return inner;
}              
int main (void) {
  void (*p) (void) = outer();
  bzero (alloca (0x100), 0x100);
  p ();                         
  puts ("pass");
  return 0;
}          
EOH
FAIL: gcc (GCC) 5.0.0 20141204 (experimental)
Segmentation fault
PASS: gcc (GCC) 4.9.3 20141204 (prerelease)
pass

Reply via email to