------- Comment #6 from dominiq at lps dot ens dot fr 2010-03-25 07:45 ------- > So, please find out what the difference actually is. The intended difference > is just that the whole __i686.get_pc_thunk.* snippet is moved from the end of > the > file to before .debug_frame/.debug_info and .LF[BE]NNNN labels added around > the > thunk's body (plus in .debug_frame section some differences too).
Could you please use English for dummies. I don't have the faintest idea of what is the "__i686.get_pc_thunk.* snippet" and where I am supposed to find it. I have compiled the code in comment #5 with -m32 -O2 -g and the executable gives a "Segmentation fault". The crash report is: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x000000002b55429b Crashed Thread: 0 Dispatch queue: com.apple.main-thread Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 a.out 0x00001ee9 main + 41 (ctype.h:176) 1 a.out 0x00001e75 start + 53 Thread 0 crashed with X86 Thread State (32-bit): eax: 0x2b554266 ebx: 0xbfffddf4 ecx: 0xbfffdcf8 edx: 0x00000000 edi: 0x00000000 esi: 0xffffff9f ebp: 0xbfffdcd8 esp: 0xbfffdca0 ss: 0x0000001f efl: 0x00010246 eip: 0x00001ee9 cs: 0x00000017 ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037 cr2: 0x2b55429b The Segmentation fault disappear if I remove -g or -m32 or if I change -O2 to -O1. The beginning of the diff between the assembly generated with -O1 (-) and -O2 (+) is: --- conf_omp_1.s 2010-03-25 08:41:34.000000000 +0100 +++ conf_omp_1_c.s 2010-03-25 08:40:59.000000000 +0100 @@ -28,10 +28,12 @@ Ldebug_info0: Ldebug_line0: .text Ltext0: + .align 4,0x90 .globl _main _main: LFB29: LM1: +LVL0: pushl %ebp LCFI0: movl %esp, %ebp @@ -40,147 +42,149 @@ LCFI1: LCFI2: movl %ebx, -12(%ebp) LCFI3: + call ___i686.get_pc_thunk.bx +"L00000000001$pb": movl %esi, -8(%ebp) LCFI4: + movl $-97, %esi movl %edi, -4(%ebp) LCFI5: - call ___i686.get_pc_thunk.bx -"L00000000001$pb": -LVL0: -LM2: - movl $-97, %esi LVL1: L11: -LM3: +LM2: leal 97(%esi), %edi LVL2: LBB24: LBB25: LBB26: -LM4: - movl %edi, %eax - andl $-128, %eax - movl %eax, -28(%ebp) +LM3: + movl %edi, %edx + andl $-128, %edx jne L2 -LM5: - leal 0(,%esi,4), %eax - addl L__DefaultRuneLocale$non_lazy_ptr-"L00000000001$pb"(%ebx), %eax -LM6: - testb $16, 441(%eax) + movl L__DefaultRuneLocale$non_lazy_ptr-"L00000000001$pb"(%ebx), %eax + testb $16, 441(%eax,%esi,4) setne %al movzbl %al, %eax - jmp L3 -L2: - movl $4096, 4(%esp) - movl %edi, (%esp) - call L___maskrune$stub - testl %eax, %eax - setne %al - movzbl %al, %eax -L3: ... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43511