[Bug 207755] clang 3.8.0 messes up __builtin_dwarf_cfa () result when used as a function argument, at least for TARGET_ARCH=powerpc and powerpc64

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Mar 6 20:57:30 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207755

            Bug ID: 207755
           Summary: clang 3.8.0 messes up __builtin_dwarf_cfa () result
                    when used as a function argument, at least for
                    TARGET_ARCH=powerpc and powerpc64
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: ppc
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: markmi at dsl-only.net

[llvm buszilla: 26761]

# more builtin_dwarf_cfa.cpp
#include <stdlib.h>

extern void g(void*);
void f0() { g(__builtin_dwarf_cfa()); }
void f1()
{ auto f1_cfa = __builtin_dwarf_cfa(); g(f1_cfa); }

f0 and f1 pass g different offsets from the frame pointer. See below for a
TARGET_ARCH=powerpc example. g++ behaves like f1 for both f1 and f0.

# clang++ -c -g -std=c++11 -Wall -pedantic builtin_dwarf_cfa.cpp

results in:

Disassembly of section .text:
00000000 <_Z2f0v> mflr    r0
00000004 <_Z2f0v+0x4> stw     r31,-4(r1)
00000008 <_Z2f0v+0x8> stw     r0,4(r1)
0000000c <_Z2f0v+0xc> stwu    r1,-16(r1)
00000010 <_Z2f0v+0x10> mr      r31,r1
00000014 <_Z2f0v+0x14> mr      r3,r31
00000018 <_Z2f0v+0x18> lwz     r3,0(r3)
0000001c <_Z2f0v+0x1c> bl      0000001c <_Z2f0v+0x1c>
00000020 <_Z2f0v+0x20> addi    r1,r1,16
00000024 <_Z2f0v+0x24> lwz     r0,4(r1)
00000028 <_Z2f0v+0x28> lwz     r31,-4(r1)
0000002c <_Z2f0v+0x2c> mtlr    r0
00000030 <_Z2f0v+0x30> blr
00000034 <_Z2f1v> mflr    r0
00000038 <_Z2f1v+0x4> stw     r31,-4(r1)
0000003c <_Z2f1v+0x8> stw     r0,4(r1)
00000040 <_Z2f1v+0xc> stwu    r1,-16(r1)
00000044 <_Z2f1v+0x10> mr      r31,r1
00000048 <_Z2f1v+0x14> mr      r3,r31
0000004c <_Z2f1v+0x18> lwz     r3,0(r3)
00000050 <_Z2f1v+0x1c> stw     r3,8(r31)
00000054 <_Z2f1v+0x20> bl      00000054 <_Z2f1v+0x20>
00000058 <_Z2f1v+0x24> addi    r1,r1,16
0000005c <_Z2f1v+0x28> lwz     r0,4(r1)
00000060 <_Z2f1v+0x2c> lwz     r31,-4(r1)
00000064 <_Z2f1v+0x30> mtlr    r0
00000068 <_Z2f1v+0x34> blr

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list