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]

Re: PATCH: robustify g++.old-deja/g++.pt/const2.C


Here's a revised patch:

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

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

Index: g++.pt/const2.C
===================================================================
--- g++.pt/const2.C     (revision 117006)
+++ 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 ()
+{
+  // Examine p to prevent optimising linkers from discarding it.
+  return (p != 0);
+}


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