const2.C (main): Examine p to prevent an optimising linker from discarding it.
authorBen Elliston <bje@au.ibm.com>
Mon, 18 Sep 2006 22:24:13 +0000 (22:24 +0000)
committerBen Elliston <bje@gcc.gnu.org>
Mon, 18 Sep 2006 22:24:13 +0000 (08:24 +1000)
* g++.old-deja/g++.pt/const2.C (main): Examine p to prevent an
optimising linker from discarding it.

From-SVN: r117039

gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.pt/const2.C

index 73889e02932051c7dae2d987ef7a0e4d64427ccb..9f266257fbce62744d067b1c87867f5f6cc8f924 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2006-09-18 Paul Thomas <pault@gcc.gnu.org>
 
        PR fortran/28526
index 1e63ca57822b33946e2bd56d8dbf7ede2051e890..cb0e2c7a38db1cf8371932f2fae449172d2f151f 100644 (file)
@@ -6,4 +6,8 @@ template <class T> struct B { static const int i = 3; };
 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);
+}