I wrote down this very very simple C++ program which I compile with clang++ using the following command and it crashes:
clang++ -O3 test.cpp -o test -g
source:
int main(int argc, char **argv)
{
class TestVec3
{
public:
TestVec3() { x = y = z = 0; }
float x, y, z;
};
TestVec3 colorBuffer[1000 * 1000];
return 0;
}
when I use llbb I get:
* thread #1: tid = 0x2529bd, 0x0000000100000f40 perspprojmat`main [inlined] TestVec3 at ridiculous.cpp:8, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5f08e088)
frame #0: 0x0000000100000f40 perspprojmat`main [inlined] TestVec3 at ...
5 class TestVec3
6 {
7 public:
-> 8 TestVec3() { x = y = z = 0; }
9 float x, y, z;
10 };
11
I haven't programmed in a while but that sounds just ridiculous? What am I missing which is that obvious. If I do a dynamic allocation, it works? (using new). Thanks for your help.