[llvm-bugs] [Bug 35345] New: Invalid assembly for huge stack frame
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 17 06:47:10 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35345
Bug ID: 35345
Summary: Invalid assembly for huge stack frame
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: dan433584 at gmail.com
CC: llvm-bugs at lists.llvm.org
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.
--
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/20171117/4716935b/attachment-0001.html>
More information about the llvm-bugs
mailing list