[LLVMbugs] [Bug 17491] New: Incorrect line number for 'return' in clang
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Oct 7 04:09:05 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=17491
Bug ID: 17491
Summary: Incorrect line number for 'return' in clang
Product: clang
Version: trunk
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: olga.a.chupina at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Clang produces bad line number for 'return' when variable-length array presents
in the test.
Example:
--- test.c ---
#include <stdio.h>
int main(int argc) {
char str[argc];
scanf("%s", str);
return str[0];
}
--------------
Compilation line: clang -g -S -emit-llvm -o test.bc test.c
test.bc:
; Function Attrs: nounwind ssp uwtable
define i32 @main(i32 %argc) #0 {
entry:
%retval = alloca i32, align 4
%argc.addr = alloca i32, align 4
%saved_stack = alloca i8*
%cleanup.dest.slot = alloca i32
store i32 0, i32* %retval
store i32 %argc, i32* %argc.addr, align 4
call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !10), !dbg
!11
%0 = load i32* %argc.addr, align 4, !dbg !12
%1 = zext i32 %0 to i64, !dbg !12
%2 = call i8* @llvm.stacksave(), !dbg !12
store i8* %2, i8** %saved_stack, !dbg !12
%vla = alloca i8, i64 %1, align 16, !dbg !12
call void @llvm.dbg.declare(metadata !{i8* %vla}, metadata !13), !dbg !12
%call = call i32 (i8*, ...)* @scanf(i8* getelementptr inbounds ([3 x i8]*
@.str, i32 0, i32 0), i8* %vla), !dbg !18
%arrayidx = getelementptr inbounds i8* %vla, i64 0, !dbg !19
%3 = load i8* %arrayidx, align 1, !dbg !19
%conv = sext i8 %3 to i32, !dbg !19
store i32 %conv, i32* %retval, !dbg !19
store i32 1, i32* %cleanup.dest.slot
%4 = load i8** %saved_stack, !dbg !20
call void @llvm.stackrestore(i8* %4), !dbg !20
%5 = load i32* %retval, !dbg !20
ret i32 %5, !dbg !20
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!9}
!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.4
(trunk 191815)", i1 false, metadata !"", i32 0, metadata !2, metadata !2,
metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ]
[test.c] [DW_LANG_C99]
...
!18 = metadata !{i32 5, i32 0, metadata !4, null}
!19 = metadata !{i32 6, i32 0, metadata !4, null}
!20 = metadata !{i32 7, i32 0, metadata !4, null}
'Return' should be at line 6.
Olga Chupina
---
Software Engineer
Intel Compiler Team
Intel Corp.
--
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/20131007/01f1d75e/attachment.html>
More information about the llvm-bugs
mailing list