From: jakub Date: Fri, 7 Jan 2011 18:41:40 +0000 (+0000) Subject: PR target/47201 X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=a0b41ee250b8c96f5ab342785dc5d14643090439 PR target/47201 * config/i386/i386.c (ix86_delegitimize_address): If simplify_gen_subreg fails, return orig_x. * gcc.dg/pr47201.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168582 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 13067437af1..503be3c42bb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2011-01-07 Jakub Jelinek + 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. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index cf12881abf9..a26314b0bba 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index af10b248ca5..286bbcfc75c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-01-07 Jakub Jelinek + 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 index 00000000000..11e1f2ade3a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr47201.c @@ -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; +}