I found this interesting thing. The "array" content is destroyed after the "catch" statement but it shouldn't be. It behaves the same in MinGW 4.2.0 and 3.4.4 for me. It seems like the "array" is unwound out when the exception is caught. --- #include <cstdlib> #include <cstdio> #include <stdexcept> int main () { int n = 10; int array [n]; for (int i = 0; i < n; ++i) array [i] = i; try { for (int i = 0; i < n; ++i) std::printf ("%u,", array [i]); std::printf (" = %u\n", n); throw 1; } catch (int) { for (int i = 0; i < n; ++i) std::printf ("%u,", array [i]); std::printf (" = %u\n", n); }; return 0; };
This is SJLJ related as it works just fine on x86-linux and powerpc-darwin both uses dwarf2 exceptions. One should note that VLA are an extension to C++.
I have a patch for this that I'm testing right now.
This is a duplicate of PR 19774 Danny
*** This bug has been marked as a duplicate of 19774 ***