public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30196]  New: Variable-length automatic array contents gets destroyed on unrelated exception
@ 2006-12-13  8:33 Tringi at Mx-3 dot cz
  2006-12-13  8:37 ` [Bug middle-end/30196] VLA and setjumplongjump exceptions pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tringi at Mx-3 dot cz @ 2006-12-13  8:33 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/30196] VLA and setjumplongjump exceptions
  2006-12-13  8:33 [Bug c++/30196] New: Variable-length automatic array contents gets destroyed on unrelated exception Tringi at Mx-3 dot cz
@ 2006-12-13  8:37 ` pinskia at gcc dot gnu dot org
  2007-03-13 23:55 ` jconner at apple dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-13  8:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-12-13 08:37 -------
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++.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |middle-end
           Keywords|                            |EH, sjlj-eh, wrong-code
            Summary|Variable-length automatic   |VLA and setjumplongjump
                   |array contents gets         |exceptions
                   |destroyed on unrelated      |
                   |exception                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30196


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/30196] VLA and setjumplongjump exceptions
  2006-12-13  8:33 [Bug c++/30196] New: Variable-length automatic array contents gets destroyed on unrelated exception Tringi at Mx-3 dot cz
  2006-12-13  8:37 ` [Bug middle-end/30196] VLA and setjumplongjump exceptions pinskia at gcc dot gnu dot org
@ 2007-03-13 23:55 ` jconner at apple dot com
  2007-03-14  5:57 ` dannysmith at users dot sourceforge dot net
  2007-03-14  6:06 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jconner at apple dot com @ 2007-03-13 23:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jconner at apple dot com  2007-03-13 23:55 -------
I have a patch for this that I'm testing right now.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30196


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/30196] VLA and setjumplongjump exceptions
  2006-12-13  8:33 [Bug c++/30196] New: Variable-length automatic array contents gets destroyed on unrelated exception Tringi at Mx-3 dot cz
  2006-12-13  8:37 ` [Bug middle-end/30196] VLA and setjumplongjump exceptions pinskia at gcc dot gnu dot org
  2007-03-13 23:55 ` jconner at apple dot com
@ 2007-03-14  5:57 ` dannysmith at users dot sourceforge dot net
  2007-03-14  6:06 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2007-03-14  5:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dannysmith at users dot sourceforge dot net  2007-03-14 05:57 -------
This is a duplicate of PR 19774

Danny


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30196


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/30196] VLA and setjumplongjump exceptions
  2006-12-13  8:33 [Bug c++/30196] New: Variable-length automatic array contents gets destroyed on unrelated exception Tringi at Mx-3 dot cz
                   ` (2 preceding siblings ...)
  2007-03-14  5:57 ` dannysmith at users dot sourceforge dot net
@ 2007-03-14  6:06 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-03-14  6:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-03-14 06:06 -------


*** This bug has been marked as a duplicate of 19774 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30196


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-03-14  6:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-13  8:33 [Bug c++/30196] New: Variable-length automatic array contents gets destroyed on unrelated exception Tringi at Mx-3 dot cz
2006-12-13  8:37 ` [Bug middle-end/30196] VLA and setjumplongjump exceptions pinskia at gcc dot gnu dot org
2007-03-13 23:55 ` jconner at apple dot com
2007-03-14  5:57 ` dannysmith at users dot sourceforge dot net
2007-03-14  6:06 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).