Backport from mainline
2011-07-07 Jakub Jelinek <jakub@redhat.com>
+ PR c/49644
+ * c-typeck.c (build_binary_op): For MULT_EXPR and TRUNC_DIV_EXPR with
+ one non-complex and one complex argument, call c_save_expr on both
+ operands.
+
PR middle-end/49640
* gimplify.c (gimplify_compound_lval): For last 2 ARRAY_*REF
operands and last COMPONENT_REF operand call gimplify_expr on it
{
case MULT_EXPR:
case TRUNC_DIV_EXPR:
+ op1 = c_save_expr (op1);
imag = build2 (resultcode, real_type, imag, op1);
/* Fall through. */
case PLUS_EXPR:
switch (code)
{
case MULT_EXPR:
+ op0 = c_save_expr (op0);
imag = build2 (resultcode, real_type, op0, imag);
/* Fall through. */
case PLUS_EXPR:
Backport from mainline
2011-07-07 Jakub Jelinek <jakub@redhat.com>
+ PR c/49644
+ * gcc.c-torture/execute/pr49644.c: New test.
+
PR middle-end/49640
* gcc.dg/gomp/pr49640.c: New test.
--- /dev/null
+/* PR c/49644 */
+
+extern void abort (void);
+
+int
+main ()
+{
+ _Complex double a[12], *c = a, s = 3.0 + 1.0i;
+ double b[12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, *d = b;
+ int i;
+ for (i = 0; i < 6; i++)
+ *c++ = *d++ * s;
+ if (c != a + 6 || d != b + 6)
+ abort ();
+ return 0;
+}