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]

testcase for problem building i960 cross on sparc



While trying to build an i960-vxworks5.0 cross from sparc,
the following bug appeared; it seems to be a problem with procedures
that don't always return a value.

The testcase fails as follows:

FAIL: gcc.c-torture/execute/20001130-2.c execution,  -O2 
FAIL: gcc.c-torture/execute/20001130-2.c execution,  -Os 

the symptom is that it returns the "ld" string rather than the "st"
string from output_25.

(I'm adding the testcase because I worked around the bug by adding
'default: abort();', and don't want the bug to be forgotten.)

-- 
Geoff Keating <geoffk@redhat.com>

2000-11-30  Geoffrey Keating  <geoffk@redhat.com>

	* gcc.c-torture/execute/20001130-2.c: New testcase.

Index: testsuite/gcc.c-torture/execute/20001130-2.c
===================================================================
RCS file: 20001130-2.c
diff -N 20001130-2.c
--- /dev/null	Tue May  5 13:32:27 1998
+++ 20001130-2.c	Thu Nov 30 16:11:45 2000
@@ -0,0 +1,31 @@
+static int which_alternative = 3;
+
+static const char *i960_output_ldconst (void);
+
+static const char *
+output_25 (void)
+{
+  switch (which_alternative)
+    {
+    case 0:
+      return "mov	%1,%0";
+    case 1:
+      return i960_output_ldconst ();
+    case 2:
+      return "ld	%1,%0";
+    case 3:
+      return "st	%1,%0";      
+    }
+}
+
+static const char *i960_output_ldconst (void)
+{
+  return "foo";
+}
+int main(void)
+{
+  const char *s = output_25 () ;
+  if (s[0] != 's')
+    abort ();
+  exit (0);
+}
============================================================

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