<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Incorrect line number for 'return' in clang"
href="http://llvm.org/bugs/show_bug.cgi?id=17491">17491</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect line number for 'return' in clang
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>olga.a.chupina@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>