This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[PATCH] Fix PR23205.C testcase (PR debug/36668)


Hi!

As -fno-toplevel-reorder (and newly in 4.4 also -fno-unit-at-a-time and -O0
which imply it) is documented not to optimize away unreferenced variables,
I think gcc behaves as documented in this case and the testcase needs to be
adjusted.  Additionally I've added the same testcase with -ftoplevel-reorder
and the original regexp.

Ok for trunk?

2008-10-29  Jakub Jelinek  <jakub@redhat.com>

	PR debug/36668
	* g++.dg/other/PR23205.C: Allow foobar to be defined as variable.
	* g++.dg/other/pr23205-2.C: New test.

--- gcc/testsuite/g++.dg/other/PR23205.C.jj	2008-10-29 20:20:26.000000000 +0100
+++ gcc/testsuite/g++.dg/other/PR23205.C	2008-10-29 20:18:27.000000000 +0100
@@ -15,4 +15,4 @@ int main()
         return i;
 }
 
-/* { dg-final { scan-assembler ".stabs.*foobar:c=i" } } */
+/* { dg-final { scan-assembler ".stabs.*foobar:(c=i|S)" } } */
--- gcc/testsuite/g++.dg/other/pr23205-2.C.jj	2008-10-29 20:18:37.000000000 +0100
+++ gcc/testsuite/g++.dg/other/pr23205-2.C	2008-10-29 20:18:56.000000000 +0100
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */
+/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types -ftoplevel-reorder" } */
+
+const int foobar = 4;
+int foo ()
+{
+        return foobar + 1;
+}
+
+int main()
+{
+        int i;
+        i = foo();
+        return i;
+}
+
+/* { dg-final { scan-assembler ".stabs.*foobar:c=i" } } */

	Jakub


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