[tree-ssa] g++.dg/opt/nothrow1.C

Richard Henderson rth@twiddle.net
Mon Sep 29 17:36:00 GMT 2003


Using "printf" here is a bad choice because it is a POSIX secondary
cancellation point, and thus it *can* throw, and thus the optimization
being tested for cannot be applied.

I didn't check to see if the test case pre-dates the cancellation 
point changes in the C++ front end, or whether the original commit
was just sloppy.  I prefer to believe the former.


r~


        * g++.dg/opt/nothrow1.C: Use locally declared function rather
        than printf.

Index: g++.dg/opt/nothrow1.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/opt/Attic/nothrow1.C,v
retrieving revision 1.1.2.1
diff -c -p -d -u -r1.1.2.1 nothrow1.C
--- g++.dg/opt/nothrow1.C	10 Sep 2003 20:50:08 -0000	1.1.2.1
+++ g++.dg/opt/nothrow1.C	29 Sep 2003 17:23:02 -0000
@@ -2,7 +2,7 @@
 // { dg-do compile }
 // { dg-options "-O -fdump-tree-optimized" }
 
-extern "C" int printf (const char *, ...);
+extern void blah() throw();
 
 int i, j, k;
 
@@ -11,7 +11,7 @@ int main()
   try
     {
       ++i;
-      printf ("foo\n");
+      blah();
       ++j;
     }
   catch (...)



More information about the Gcc-patches mailing list