[LLVMbugs] [Bug 23971] New: __attribute__((naked)) broken for possibly-returning functions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 26 15:54:51 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23971

            Bug ID: 23971
           Summary: __attribute__((naked)) broken for possibly-returning
                    functions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Naked functions get unreachable statement at the end, which may be propagated
into their callers.

# cat 1.c

__attribute__((naked,noinline)) void f() {
  asm volatile("bx lr\n\t");
}

int g() {
  f();
  return 42;
}


# clang -c 1.c  -S -emit-llvm -o - -O1

define void @f() #0 {
entry:
  tail call void asm sideeffect "bx lr\0A\09", "~{dirflag},~{fpsr},~{flags}"()
#2, !srcloc !1
  unreachable
}

; Function Attrs: noreturn nounwind uwtable
define i32 @g() #1 {
entry:
  tail call void @f()
  unreachable
}

"return 42" in g() is gone.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150626/1ba29341/attachment.html>


More information about the llvm-bugs mailing list