This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: robustify g++.old-deja/g++.pt/const2.C
- From: Ben Elliston <bje at au1 dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: janis187 at us dot ibm dot com
- Date: Tue, 19 Sep 2006 07:17:30 +1000
- Subject: 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;
+}