re PR target/47201 (ICE: SIGSEGV in adjust_mems (var-tracking.c:814) with -O -fPIC -g)
authorJakub Jelinek <jakub@redhat.com>
Fri, 7 Jan 2011 18:41:40 +0000 (19:41 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 7 Jan 2011 18:41:40 +0000 (19:41 +0100)
PR target/47201
* config/i386/i386.c (ix86_delegitimize_address): If
simplify_gen_subreg fails, return orig_x.

* gcc.dg/pr47201.c: New test.

From-SVN: r168582

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr47201.c [new file with mode: 0644]

index 13067437af110f9b4466628ebc67064ffc411e4c..503be3c42bb6ea17521b1db252540039d7ab1c13 100644 (file)
@@ -1,5 +1,9 @@
 2011-01-07  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/47201
+       * config/i386/i386.c (ix86_delegitimize_address): If
+       simplify_gen_subreg fails, return orig_x.
+
        PR bootstrap/47187
        * value-prof.c (gimple_stringop_fixed_value): Handle
        lhs of the call properly.
index cf12881abf9832c1a10a04b18701fd8a6811a4a6..a26314b0bba56a39d2700834f2dad3dd0851ea5c 100644 (file)
@@ -1,6 +1,6 @@
 /* Subroutines used for code generation on IA-32.
    Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -13254,7 +13254,11 @@ ix86_delegitimize_address (rtx x)
        return ix86_delegitimize_tls_address (orig_x);
       x = XVECEXP (XEXP (x, 0), 0, 0);
       if (GET_MODE (orig_x) != Pmode)
-       return simplify_gen_subreg (GET_MODE (orig_x), x, Pmode, 0);
+       {
+         x = simplify_gen_subreg (GET_MODE (orig_x), x, Pmode, 0);
+         if (x == NULL_RTX)
+           return orig_x;
+       }
       return x;
     }
 
@@ -13323,7 +13327,11 @@ ix86_delegitimize_address (rtx x)
        return orig_x;
     }
   if (GET_MODE (orig_x) != Pmode && MEM_P (orig_x))
-    return simplify_gen_subreg (GET_MODE (orig_x), result, Pmode, 0);
+    {
+      result = simplify_gen_subreg (GET_MODE (orig_x), result, Pmode, 0);
+      if (result == NULL_RTX)
+       return orig_x;
+    }
   return result;
 }
 
index af10b248ca582083e2baa16aa0fce50238ccf44d..286bbcfc75c94aa18c09ca068130dd51d1bf14bd 100644 (file)
@@ -1,5 +1,8 @@
 2011-01-07  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/47201
+       * gcc.dg/pr47201.c: New test.
+
        PR bootstrap/47187
        * gcc.dg/tree-prof/pr47187.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr47201.c b/gcc/testsuite/gcc.dg/pr47201.c
new file mode 100644 (file)
index 0000000..11e1f2a
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR target/47201 */
+/* { dg-do compile } */
+/* { dg-options "-O -fpic -g" { target fpic } } */
+
+union U
+{
+  __UINTPTR_TYPE__ m;
+  float d;
+} u;
+
+int
+foo (void)
+{
+  union U v = {
+    (__UINTPTR_TYPE__)&u
+  };
+  return u.d == v.d;
+}