rtlanal.c (rtx_varies_p): Return 0 for NULL_RTX
authorPaul Brook <paul@codesourcery.com>
Wed, 18 Feb 2004 12:33:18 +0000 (12:33 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Wed, 18 Feb 2004 12:33:18 +0000 (12:33 +0000)
* rtlanal.c (rtx_varies_p): Return 0 for NULL_RTX
testsuite/
* gcc.c-torture/compile/libcall-1.c: New test.

From-SVN: r78027

gcc/ChangeLog
gcc/rtlanal.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/libcall-1.c [new file with mode: 0644]

index 4e4dcd7609904aaf57893ee35c105a6f14022521..8b1e5663613dd070338c3e77132f1308586a7719 100644 (file)
@@ -1,3 +1,7 @@
+2004-02-18  Paul Brook  <paul@codesourcery.com>
+
+       * rtlanal.c (rtx_varies_p): Return 0 for NULL_RTX
+
 2004-02-18  Paul Brook  <paul@codesourcery.com>
 
        PR debug/12934
index c408521e4888aaabbb705b5f34f68dad410da6c5..f643dfe192a3c634ce897feadf110fe89d28b3ab 100644 (file)
@@ -134,10 +134,14 @@ rtx_unstable_p (rtx x)
 int
 rtx_varies_p (rtx x, int for_alias)
 {
-  RTX_CODE code = GET_CODE (x);
+  RTX_CODE code;
   int i;
   const char *fmt;
 
+  if (!x)
+    return 0;
+
+  code = GET_CODE (x);
   switch (code)
     {
     case MEM:
index c343a64015819fdf2d43cc66897752c2f436bbae..3bacb3bef04d9262a7668a7b6836514e93ab6196 100644 (file)
@@ -1,3 +1,7 @@
+2004-02-18  Paul Brook  <paul@codesourcery.com>
+
+       * gcc.c-torture/compile/libcall-1.c: New test.
+
 2004-02-18  Paul Brook  <paul@codesourcery.com>
 
        PR debug/12934
diff --git a/gcc/testsuite/gcc.c-torture/compile/libcall-1.c b/gcc/testsuite/gcc.c-torture/compile/libcall-1.c
new file mode 100644 (file)
index 0000000..c1b1cfc
--- /dev/null
@@ -0,0 +1,14 @@
+/* Failed on ARM because rtx_varies_p didn't like the REG_EQUAL notes
+   generated for libcalls.
+   http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01518.html */
+static const char digs[] = "0123456789ABCDEF";
+int __attribute__((pure)) bar();
+
+int foo (int i)
+{
+  int len;
+  if (i)
+    return 0;
+  len = bar();
+  return digs[len];
+}