public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bryner at brianryner dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/13865] [tree-ssa] dtor runs prematurely for loop-scoped variable
Date: Mon, 26 Jan 2004 23:49:00 -0000	[thread overview]
Message-ID: <20040126234913.3603.qmail@sources.redhat.com> (raw)
In-Reply-To: <20040126062654.13865.bryner@brianryner.com>


------- Additional Comments From bryner at brianryner dot com  2004-01-26 23:49 -------
This testcase is even simpler:

#include <stdio.h>

class A
{
public:
  A() { printf("A ctor\n"); }
  ~A() { printf("A dtor\n"); }
};

int main(int argc, char **argv)
{
  int i = 0;
  for (A a; i < 2; ++i) {
    printf("iteration %d\n", i);
  }

  return 0;
}

which outputs:

A ctor
A dtor
iteration 0
iteration 1

instead of:

A ctor
iteration 0
iteration 1
A dtor

-- 


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


  parent reply	other threads:[~2004-01-26 23:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-26  6:26 [Bug c++/13865] New: " bryner at brianryner dot com
2004-01-26  6:29 ` [Bug c++/13865] " bryner at brianryner dot com
2004-01-26  6:36 ` bryner at brianryner dot com
2004-01-26 13:10 ` [Bug c++/13865] [tree-ssa] " pinskia at gcc dot gnu dot org
2004-01-26 14:52 ` bangerth at dealii dot org
2004-01-26 23:49 ` bryner at brianryner dot com [this message]
2004-01-27  0:00 ` pinskia at gcc dot gnu dot org
2004-01-27 15:41 ` bangerth at dealii dot org
2004-01-29  1:43 ` rth at gcc dot gnu dot org
2004-01-30  4:35 ` cvs-commit at gcc dot gnu dot org
2004-01-30  4:35 ` cvs-commit at gcc dot gnu dot org
2004-01-30 10:56 ` giovannibajo at libero dot it

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040126234913.3603.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).