]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/33617 (ICE for nonconstant callee-copied constructor arguments)
authorRichard Sandiford <rsandifo@nildram.co.uk>
Tue, 2 Oct 2007 20:50:46 +0000 (20:50 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 2 Oct 2007 20:50:46 +0000 (20:50 +0000)
gcc/
PR middle-end/33617
* expr.c (expand_expr_addr_expr_1): Pass CONSTRUCTORs to
expand_expr.

gcc/testsuite/
PR middle-end/33617
* gcc.c-torture/compile/pr33617.c: New test.

From-SVN: r128965

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr33617.c [new file with mode: 0644]

index f1f28f7c3721679bf0ee8f2c65c5d0db743440b3..bfa860ce24dfc703fcd8bd80a2186ef3c1808d8a 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-02  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       PR middle-end/33617
+       * expr.c (expand_expr_addr_expr_1): Pass CONSTRUCTORs to
+       expand_expr.
+
 2007-10-02  David Daney  <ddaney@avtrex.com>
 
        * config/mips/mips.md (sync_compare_and_swap<mode>): Handle compare
index 9d2a61ad78293853ede91087f926421453405705..6b7ba168d782aa13ea2ce85345b67844cc1ba109 100644 (file)
@@ -6740,8 +6740,7 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
   /* ??? This should be considered a front-end bug.  We should not be
      generating ADDR_EXPR of something that isn't an LVALUE.  The only
      exception here is STRING_CST.  */
-  if (TREE_CODE (exp) == CONSTRUCTOR
-      || CONSTANT_CLASS_P (exp))
+  if (CONSTANT_CLASS_P (exp))
     return XEXP (expand_expr_constant (exp, 0, modifier), 0);
 
   /* Everything must be something allowed by is_gimple_addressable.  */
@@ -6788,9 +6787,12 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
     default:
       /* If the object is a DECL, then expand it for its rtl.  Don't bypass
         expand_expr, as that can have various side effects; LABEL_DECLs for
-        example, may not have their DECL_RTL set yet.  Assume language
-        specific tree nodes can be expanded in some interesting way.  */
+        example, may not have their DECL_RTL set yet.  Expand the rtl of
+        CONSTRUCTORs too, which should yield a memory reference for the
+        constructor's contents.  Assume language specific tree nodes can
+        be expanded in some interesting way.  */
       if (DECL_P (exp)
+         || TREE_CODE (exp) == CONSTRUCTOR
          || TREE_CODE (exp) >= LAST_AND_UNUSED_TREE_CODE)
        {
          result = expand_expr (exp, target, tmode,
index 0fd8d88756311628eed5f3a9872b42db9a9d51dc..65f08872e8925d11b67c2b5bf9db13c87d9e3c8a 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-02  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       PR middle-end/33617
+       * gcc.c-torture/compile/pr33617.c: New test.
+
 2007-10-02  Andreas Tobler  <a.tobler@schweiz.org>
 
        * gcc.target/powerpc/stabs-attrib-vect-darwin.c: Change options to use
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33617.c b/gcc/testsuite/gcc.c-torture/compile/pr33617.c
new file mode 100644 (file)
index 0000000..0174fb6
--- /dev/null
@@ -0,0 +1,7 @@
+typedef float V8SF __attribute__ ((vector_size (32)));
+void bar (V8SF);
+void
+foo (float x)
+{
+  bar ((V8SF) { x, x, x, x, x, x, x, x });
+}