This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: more fixes for GCC svn
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 27 Jul 2010 10:57:55 -0600
- Subject: FYI: more fixes for GCC svn
I'm checking this in on the trunk and the 7.2 branch.
This patch fixes a few minor test suite regressions that I saw when I
ran the test suite using GCC svn trunk.
Basically, gcc can now more aggressively remove statics and other
things. So, we need a little more care to make sure objects in the
inferior that are needed by the test cases are not removed.
Built and regtested on x86-64 (compile farm) -- this tested
compatibility with old gcc. I also ran the individual files against GCC
svn trunk locally.
Tom
2010-07-27 Tom Tromey <tromey@redhat.com>
* gdb.stabs/gdb11479.c (hack): New function.
(test): Use it.
(test2): Use it.
* gdb.python/py-inferior.c (int8_search_buf, int16_search_buf)
(int32_search_buf, int64_search_buf): No longer static.
(x): Remove.
* gdb.base/relocate.c (hack): New function.
Index: gdb.base/relocate.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/relocate.c,v
retrieving revision 1.9
diff -u -r1.9 relocate.c
--- gdb.base/relocate.c 1 Jan 2010 07:32:01 -0000 1.9
+++ gdb.base/relocate.c 27 Jul 2010 16:55:17 -0000
@@ -33,3 +33,10 @@
{
return 6;
}
+
+/* Make sure the statics are not optimized away. */
+int *
+hack (int arg)
+{
+ return arg ? &static_foo : &static_bar;
+}
Index: gdb.python/py-inferior.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-inferior.c,v
retrieving revision 1.1
diff -u -r1.1 py-inferior.c
--- gdb.python/py-inferior.c 28 Jun 2010 21:16:04 -0000 1.1
+++ gdb.python/py-inferior.c 27 Jul 2010 16:55:17 -0000
@@ -6,16 +6,14 @@
#define CHUNK_SIZE 16000 /* same as findcmd.c's */
#define BUF_SIZE (2 * CHUNK_SIZE) /* at least two chunks */
-static int8_t int8_search_buf[100];
-static int16_t int16_search_buf[100];
-static int32_t int32_search_buf[100];
-static int64_t int64_search_buf[100];
+int8_t int8_search_buf[100];
+int16_t int16_search_buf[100];
+int32_t int32_search_buf[100];
+int64_t int64_search_buf[100];
static char *search_buf;
static int search_buf_size;
-static int x;
-
int f2 (int a)
{
Index: gdb.stabs/gdb11479.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.stabs/gdb11479.c,v
retrieving revision 1.1
diff -u -r1.1 gdb11479.c
--- gdb.stabs/gdb11479.c 22 Apr 2010 13:37:18 -0000 1.1
+++ gdb.stabs/gdb11479.c 27 Jul 2010 16:55:17 -0000
@@ -23,13 +23,17 @@
enum dummy_enum;
+/* This function prevents the compiler from dropping local variables
+ we need for the test. */
+void *hack (const struct dummy *t, const enum dummy_enum *e);
+
const void *
test (const struct dummy *t)
{
const struct dummy *tt;
enum dummy_enum *e;
tt = t;
- return t;
+ return hack (t, e);
}
void *
@@ -38,7 +42,7 @@
struct dummy *tt;
const enum dummy_enum *e;
tt = t;
- return t;
+ return hack (t, e);
}
@@ -53,6 +57,12 @@
enum2
};
+void *
+hack (const struct dummy *t, const enum dummy_enum *e)
+{
+ return (void *) t;
+}
+
int
main ()
{