| Subject: | [Bug c++/30196] New: Variable-length automatic array contents gets destroyed on unrelated exception |
|---|---|
| From: | "Tringi at Mx-3 dot cz" |
| Date: | 13 Dec 2006 08:32:58 -0000 |
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;
};
--
Summary: Variable-length automatic array contents gets destroyed
on unrelated exception
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Tringi at Mx-3 dot cz
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30196
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [Bug rtl-optimization/30149] [4.3 Regression] tree-cfg.c:1924: ICE: in cse_find_path, at cse.c:5930, steven at gcc dot gnu dot org |
|---|---|
| Next by Date: | [Bug middle-end/30196] VLA and setjumplongjump exceptions, pinskia at gcc dot gnu dot org |
| Previous by Thread: | [Bug tree-optimization/5035] Incorrectly produces '`<var>' might be used uninitialized in this function', pinskia at gcc dot gnu dot org |
| Next by Thread: | [Bug middle-end/30196] VLA and setjumplongjump exceptions, pinskia at gcc dot gnu dot org |
| Indexes: | [Date] [Thread] [Top] [All Lists] |