From df20ea24f939e8d2b005d2ef985446b2fe0cf597 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Sep 2006 01:11:40 -0400 Subject: [PATCH] re PR middle-end/27724 (internal compiler error: no-op convert from 4 to 8 bytes in initializer) PR middle-end/27724 * varasm.c (output_constant): Only strip actual no-op conversions. From-SVN: r116777 --- gcc/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/long-long-cst1.c | 17 +++++++++++++++++ gcc/varasm.c | 8 ++++---- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/long-long-cst1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a430e20667a..baa8adc2962 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2006-09-07 Jason Merrill + PR middle-end/27724 + * varasm.c (output_constant): Only strip actual no-op conversions. + PR target/13685 * config/i386/i386.c (override_options): Use 128-bit stack boundary if -msse. diff --git a/gcc/testsuite/gcc.dg/long-long-cst1.c b/gcc/testsuite/gcc.dg/long-long-cst1.c new file mode 100644 index 00000000000..7c120dc14c9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/long-long-cst1.c @@ -0,0 +1,17 @@ +/* PR middle-end/27724 */ +/* { dg-do run } */ +/* { dg-options "" } */ + +extern void abort(); + +struct st{ + int _mark; +}; +unsigned long long t = ((int)&(((struct st*)16)->_mark) - 32); + +int main() +{ + if (t != (unsigned long long)(int)-16) + abort (); +} + diff --git a/gcc/varasm.c b/gcc/varasm.c index 9837e0de147..3091132ee21 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4039,10 +4039,10 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) if (type_size > op_size && TREE_CODE (exp) != VIEW_CONVERT_EXPR && TREE_CODE (TREE_TYPE (exp)) != UNION_TYPE) - internal_error ("no-op convert from %wd to %wd bytes in initializer", - op_size, type_size); - - exp = TREE_OPERAND (exp, 0); + /* Keep the conversion. */ + break; + else + exp = TREE_OPERAND (exp, 0); } code = TREE_CODE (TREE_TYPE (exp)); -- 2.30.2