[LLVMbugs] [Bug 8636] New: clang chews through stack space
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Nov 17 06:09:13 PST 2010
http://llvm.org/bugs/show_bug.cgi?id=8636
Summary: clang chews through stack space
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: chris at bubblescope.net
CC: llvmbugs at cs.uiuc.edu
Been tracking down a memory exhaustion problem in automatically generated code
with clang which does not occur with gcc.
The following code shows our problem:
#include <stdio.h>
#define X1(x) if(i) { x } else { x }
#define X2(x) if(i) { x } else { x }
#define X3(x) if(i) { x } else { x }
#define X4(x) if(i) { x } else { x }
#define X5(x) if(i) { x } else { x }
#define X6(x) if(i) { x } else { x }
#define X7(x) if(i) { x } else { x }
#define X8(x) if(i) { x } else { x }
#define ARRAY { int x[4000]; printf("%ld\n", (y - x)); }
void f(int i)
{
int y[1];
X1(X2(X3(X4(X5(X6(X7(X8(ARRAY))))))));
}
int main(int argc, char** argv) {
f(0);
}
With no optimisation, gcc outputs 4000 while clang outputs 1024002. if I
increase the depth 2 more steps (the actual size we use in practice), a
clang-compiled executable just segfaults, while the gcc one works happily.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list