* expr.c (expand_expr, case ARRAY_REF): Correct check for
side-effects in the value of an array element.
From-SVN: r43680
elem = TREE_CHAIN (elem))
;
- if (elem && !TREE_SIDE_EFFECTS (elem))
+ if (elem && !TREE_SIDE_EFFECTS (TREE_VALUE (elem)))
return expand_expr (fold (TREE_VALUE (elem)), target,
tmode, ro_modifier);
}
--- /dev/null
+// Special g++ Options: -O1
+
+int count = 0;
+
+double foo () {
+ count++;
+ return 0;
+};
+
+double bar () {
+ const double x[1] = { foo() };
+ return x[0];
+};
+
+int main ()
+{
+ bar();
+ if (count != 1)
+ return 1;
+};