This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: robustify g++.old-deja/g++.pt/const2.C
- From: Ben Elliston <bje at au1 dot ibm dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, janis187 at us dot ibm dot com
- Date: Tue, 19 Sep 2006 08:13:23 +1000
- Subject: Re: PATCH: robustify g++.old-deja/g++.pt/const2.C
- References: <20060918211730.GA23889@ozlabs.au.ibm.com> <jed59sg96q.fsf@sykes.suse.de>
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);
+}