OSDN Git Service

PR middle-end/27724
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Sep 2006 05:11:40 +0000 (05:11 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Sep 2006 05:11:40 +0000 (05:11 +0000)
        * varasm.c (output_constant): Only strip actual no-op conversions.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116777 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/gcc.dg/long-long-cst1.c [new file with mode: 0644]
gcc/varasm.c

index a430e20..baa8adc 100644 (file)
@@ -1,5 +1,8 @@
 2006-09-07  Jason Merrill  <jason@redhat.com>
 
+       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 (file)
index 0000000..7c120dc
--- /dev/null
@@ -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 ();
+}
+
index 9837e0d..3091132 100644 (file)
@@ -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));