This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: fixlet for m-static.cc


I'm checking this in.

Recent versions of gcc have started dropping the unused local static
variable from m-static.cc, causing an apparent regression.  However,
there isn't really any bug here, just different behavior.

Originally I reported this to Jason as a bug on his comdat-debug branch,
but he said that this is in trunk gcc too.  I didn't check that, as I
don't think it matters.

This patch fixes things by arranging to keep the local static live.
I looked into the history of this code, and I think this change doesn't
affect the intended semantics of the test.

Tom

2012-06-19  Tom Tromey  <tromey@redhat.com>

	* gdb.cp/m-static.cc (keepalive): New function.
	(gnu_obj_1::method): Use it.

Index: gdb.cp/m-static.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/m-static.cc,v
retrieving revision 1.4
diff -u -r1.4 m-static.cc
--- gdb.cp/m-static.cc	13 Mar 2010 00:27:12 -0000	1.4
+++ gdb.cp/m-static.cc	19 Jun 2012 15:44:16 -0000
@@ -2,6 +2,8 @@
 
 enum region { oriental, egyptian, greek, etruscan, roman };
 
+void keepalive(bool *var) { }
+
 // Test one.
 class gnu_obj_1
 {
@@ -19,6 +21,7 @@
   long method ()
   {
     static bool svar = true;
+    keepalive (&svar);
     return key2;
   }
 };


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]