[testsuite] loop breaking eh region notes

Jakub Jelinek jakub@redhat.com
Mon Aug 21 04:45:00 GMT 2000


Hi!

This testcases causes an ICE with -O (while compiles ok with -O0 resp. -O2
and above). The end eh region note surrounding baz destructor if tst returns
0 is moved out of the loop to the function return label during loop
optimizations, so eh region notes are no longer properly nested.
Ok to commit?

2000-08-21  Jakub Jelinek  <jakub@redhat.com>

	* g++.old-deja/g++.other/loop2.C: New test.

--- gcc/testsuite/g++.old-deja/g++.other/loop2.C.jj	Mon Aug 21 12:43:52 2000
+++ gcc/testsuite/g++.old-deja/g++.other/loop2.C	Mon Aug 21 12:44:37 2000
@@ -0,0 +1,31 @@
+// Build don't link:
+// Special g++ Options: -O
+
+class foo {
+public:
+  operator const char*() const { return a; }
+  char *a;
+};
+
+class bar {
+public:
+  ~bar();
+  void operator++(int);
+  bool b() const;
+protected:
+  void* c() const;
+};
+
+class baz : public bar {
+public:
+  foo const &d() const { return *(foo *)bar::c(); }
+};
+
+extern int tst (const char *, const char *) throw();
+
+void die(const foo& x)
+{
+  for (baz hi; hi.b(); hi++)
+    if (tst (hi.d(), x) == 0)
+      return;
+}

	Jakub


More information about the Gcc-patches mailing list