This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/47324] g++.dg/torture/stackalign failures with -O3 -g at -m32 on darwin
- From: "howarth at nitro dot med.uc.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 7 Feb 2011 21:08:22 +0000
- Subject: [Bug target/47324] g++.dg/torture/stackalign failures with -O3 -g at -m32 on darwin
- Auto-submitted: auto-generated
- References: <bug-47324-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47324
--- Comment #8 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-02-07 21:07:59 UTC ---
The Apple linker developer has looked at the failing eh-alloc-1.C case and had
the following comments...
> Also, did you ever get a
> chance to look at the stackalign_testcase2.tar.bz2 test case from radar ID 6407474, "stackalign
> failures for -O3 -g at -m32 with Xcode 3.1.2 and 3.2A number of gcc 4", in a debug version of
> the Snow Leopard unwinder? This bug is still very confusing.
I just took a look at the eh-alloc.exe case. The case built with -g fails when
running on Lion
(with the darwin unwinder) and the case built without -g works fine. I
stepped through the
unwinding. The function foo() uses dynamic stack alignment and the dwarf
unwind info uses
expressions to specify where the CFA is. In the bad case (with -g) the
expression has a push
of register 5 (ESP) where as the good case has a push of register 4 (EBP) in
the expression.
I recall that some bug cropped up long ago with the register numbering for
i386.
Two register numbers were swapped. The end result is the eh_frame register
numbering and
DWARF debug info registering number are different.
I suspect that using -g is forcing the eh_frame creation to use the DWARF debug
info register
numbering. You can see the difference with dwarfdump:
[/tmp]> dwarfdump --eh-frame
stackalign_testcase2/stackalign_with_g/eh-alloca-1.exe | grep -A8 __Z3fooi
start_addr: 0x00001d20 __Z3fooi
range_size: 0x000000b8 (end_addr = 0x00001dd8)
LSDA address: 0x00002094
Instructions: 0x00001d20: CFA=esp+4 eip=[esp]
DW_CFA_advance_loc4 (4)
DW_CFA_def_cfa (ecx, 0)
0x00001d24: CFA=ecx eip=[ecx-4]
DW_CFA_advance_loc4 (7)
DW_CFA_expression (esp, expr(esp0))
[/tmp]> dwarfdump --eh-frame
stackalign_testcase2/stackalign_without_g/eh-alloca-1.exe | grep -A8 __Z3fooi
start_addr: 0x00001d20 __Z3fooi
range_size: 0x000000b8 (end_addr = 0x00001dd8)
LSDA address: 0x00002094
Instructions: 0x00001d20: CFA=esp+4 eip=[esp]
DW_CFA_advance_loc4 (4)
DW_CFA_def_cfa (ecx, 0)
0x00001d24: CFA=ecx eip=[ecx-4]
DW_CFA_advance_loc4 (7)
DW_CFA_expression (ebp, expr(ebp0))
[/tmp]>