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]

Gratuitous (?) C++ test failures on SH


g++.old-deja/g++.ext/instantiate[12].C fail on sh-elf because the
references to external symbols are moved down in the code stream, so
they may end up after line-number notes different from the expected
ones.  This patch adjust the tests so that the line numbers match the
expectations, as long as the new functions are not inlined.  I'll
checking this in in mainline and branch unless someone complains
loudly in the next 48 hours or so.

Index: gcc/testsuite/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* g++.old-deja/g++.ext/instantiate1.C: Adjust to accommodate
	peculiarities of the SH.
	* g++.old-deja/g++.ext/instantiate2.C: Likewise.

Index: gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C,v
retrieving revision 1.2
diff -u -p -r1.2 instantiate1.C
--- gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C 2000/06/03 00:15:05 1.2
+++ gcc/testsuite/g++.old-deja/g++.ext/instantiate1.C 2001/03/24 23:22:59
@@ -13,12 +13,22 @@ template <class T> struct A {
 template <class T> void A<T>::f () { }
 extern template struct A<int>;
 
+// These functions must be defined in a single line, so that, even if
+// constants or pointers are placed in the code section (for example,
+// on the SH), we still get the same line numbers.
+
+void test_f_int () { f(42); } // ERROR - not instantiated
+
+void test_A_int_f () { A<int> a; a.f (); } // ERROR - not instantiated
+
+void test_f_double () { f (2.0); } // gets bogus error
+
+void test_A_double_f () { A<double> b; b.f (); } // gets bogus error
+
 int main ()
 {
-  f (42);			// ERROR - not instantiated
-  A<int> a;
-  a.f ();			// ERROR - not instantiated
-  f (2.0);			// gets bogus error
-  A<double> b;
-  b.f ();			// gets bogus error
+  test_f_int ();
+  test_A_int_f ();
+  test_f_double ();
+  test_A_double_f ();
 }
Index: gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C,v
retrieving revision 1.3
diff -u -p -r1.3 instantiate2.C
--- gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C 2001/01/15 04:30:35 1.3
+++ gcc/testsuite/g++.old-deja/g++.ext/instantiate2.C 2001/03/24 23:22:59
@@ -10,10 +10,17 @@ template <class T> struct A {
 template <class T> T A<T>::t = 0;
 static template struct A<int>;
 
+// These functions must be defined in a single line, so that, even if
+// constants or pointers are placed in the code section (for example,
+// on the SH), we still get the same line numbers.
+
+void test_int() { A<int>::t = 42; } // gets bogus error
+
+void test_char() { A<char>::t = 42; } // ERROR - not instantiated XFAIL *-*-irix*
+// Irix's default linker does not produce line numbers so XFAIL it.
+
 int main ()
 {
-  A<int>::t = 42;		// gets bogus error
-  A<char>::t = 42;		// ERROR - not instantiated XFAIL mips*-*-*
-				// Irix's default linker does not
-				// produce line numbers so XFAIL it.
+  test_int ();
+  test_char ();
 }

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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