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: robustify g++.old-deja/g++.pt/const2.C


This test case was failing when adding --gc-sections to the linker
flags, as the reference that is meant to trigger the link error is
optimised away.  This patch makes the test case more robust.

Okay for the trunk?

2006-09-19  Ben Elliston  <bje@au.ibm.com>

        * g++.old-deja/g++.pt/const2.C (main): Return p to prevent an
        optimising linker from discarding it.

Index: g++.old-deja/g++.pt/const2.C
===================================================================
--- g++.old-deja/g++.pt/const2.C        (revision 117006)
+++ g++.old-deja/g++.pt/const2.C        (working copy)
@@ -6,4 +6,8 @@ template <class T> struct B { static con
 template <class T> struct A { static const int i = B<T>::i; };
 const int *p = &A<int>::i;
 
-int main(){}
+int main ()
+{
+  // Return p to prevent optimising linkers from discarding it.
+  return (int) p;
+}


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