[llvm-bugs] [Bug 24697] New: call incorrectly marked as 'tail'

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 3 10:49:33 PDT 2015


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

            Bug ID: 24697
           Summary: call incorrectly marked as 'tail'
           Product: new-bugs
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: willvarfar at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

A call is marked 'tail' even though its result is not returned by the function
it is in.

A simple hello world:

#include <stdio.h>

int main() {
    printf("hello world\n");
    return 0;
}

Compiled normally:

will at ox:~$ clang -S -O3 -emit-llvm ~/test_apps/hello1.c -o -

Results in:

; ModuleID = '/home/will/test_apps/hello1.c'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@str = private unnamed_addr constant [12 x i8] c"hello world\00"

; Function Attrs: nounwind uwtable
define i32 @main() #0 {
  %puts = tail call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @str, i64
0, i64 0))
  ret i32 0
}

; Function Attrs: nounwind
declare i32 @puts(i8* nocapture readonly) #1

attributes #0 = { nounwind uwtable "less-precise-fpmad"="false"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-nans-fp-math"="false" "stack-protector-buffer-size"="8"
"unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }

!llvm.ident = !{!0}

!0 = !{!"Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on
LLVM 3.6.0)"}

I've asked on IRC and others can replicate on the current trunk.

-- 
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/20150903/476e6b41/attachment.html>


More information about the llvm-bugs mailing list