<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Invalid assembly for huge stack frame"
href="https://bugs.llvm.org/show_bug.cgi?id=35345">35345</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Invalid assembly for huge stack frame
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dan433584@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Compiling this C code with clang for 32-bit x86:
#include <stdint.h>
void foo(char*, char*, char*, char*);
void bar(void) {
char a[INT32_MAX/1];
char b[INT32_MAX/1];
char c[INT32_MAX/1];
char d[INT32_MAX/1];
foo(a, b, c, d);
}
I get no warnings and this LLVM IR:
[...]
define void @bar() #0 {
%1 = alloca [2147483647 x i8], align 1
%2 = alloca [2147483647 x i8], align 1
%3 = alloca [2147483647 x i8], align 1
%4 = alloca [2147483647 x i8], align 1
%5 = getelementptr inbounds [2147483647 x i8], [2147483647 x i8]* %1, i32 0,
i32 0
%6 = getelementptr inbounds [2147483647 x i8], [2147483647 x i8]* %2, i32 0,
i32 0
%7 = getelementptr inbounds [2147483647 x i8], [2147483647 x i8]* %3, i32 0,
i32 0
%8 = getelementptr inbounds [2147483647 x i8], [2147483647 x i8]* %4, i32 0,
i32 0
call void @foo(i8* %5, i8* %6, i8* %7, i8* %8)
ret void
}
[...]
and this prologue in the output:
[...]
pushl %ebp
movl %esp, %ebp
pushl %esi
movl $8589934612, %eax # imm = 0x200000014
subl %eax, %esp
[...]
8589934612 does not fit into a 32-bit immediate, though llvm-mc silently wraps
it so that it does, producing miscompiled output.</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>