Bug 9789 - [3.2 ICE regression, fixed in 3.3] Error reporting routines re-entered
Summary: [3.2 ICE regression, fixed in 3.3] Error reporting routines re-entered
Status: RESOLVED DUPLICATE of bug 9672
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2.2
: P3 normal
Target Milestone: ---
Assignee: Wolfgang Bangerth
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2003-02-21 17:16 UTC by 180937
Modified: 2003-06-12 00:03 UTC (History)
1 user (show)

See Also:
Host: i386-linux
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 180937 2003-02-21 17:16:00 UTC
[ Reported to the Debian BTS as report #180937.
  Please CC 180937@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/180937 ]

A regression from 2.95, fixed in 3.3:

/*
 * g++ 3.2 bug in handling switch statements that contain object declarations
 * constructed using objects declared outside the switch.
 */

class common { };

class someclass {
public:
  someclass(common *c) { }
  ~someclass() { }
};

class someotherclass {
public:
  someotherclass(common *c) { }
  ~someotherclass() { }
};

int main(int argc, char *argv[]) {
  enum { CHOICE_A, CHOICE_B } choice = CHOICE_A;
  common commonobj;

  switch (choice) {
  case CHOICE_A:
    someclass obj1(&commonobj);
    // do something
    break;
  case CHOICE_B:
    someotherclass obj2(&commonobj);
    // do something
    break;
  default:
    break;
  }
}

class common { };

class someclass {
public:
  someclass(common *c) { }
  ~someclass() { }
};

class someotherclass {
public:
  someotherclass(common *c) { }
  ~someotherclass() { }
};

int main(int argc, char *argv[]) {
  enum { CHOICE_A, CHOICE_B } choice = CHOICE_A;
  common commonobj;

  switch (choice) {
  case CHOICE_A:
    someclass obj1(&commonobj);

    break;
  case CHOICE_B:
    someotherclass obj2(&commonobj);

    break;
  default:
    break;
  }
}

$ g++-3.2 bug-180937.cc          
bug-180937.cc: In function `int main(int, char**)':
bug-180937.cc:29: jump to case label
bug-180937.cc:26:   crosses initialization of `someclass obj1'
bug-180937.cc:33: jump to case label
bug-180937.cc:30:   crosses initialization of `someotherclass obj2'
bug-180937.cc:26:   crosses initialization of `someclass obj1'

Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.


both g++-2.95.3 and current 3.3 don't ICE.

Release:
3.2.2 (Debian) (Debian unstable)

Environment:
System: Debian GNU/Linux (unstable)
Architecture: i686
host: i386-linux
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.2 20021212 (Debian prerelease)
Comment 1 Wolfgang Bangerth 2003-02-21 17:46:41 UTC
*** This bug has been marked as a duplicate of 9672 ***