+2005-06-13 Zdenek Dvorak <dvorakz@suse.cz>
+
+ PR middle-end/21985
+ * fold-const.c (split_address_to_core_and_offset): Always return
+ the address of the base object.
+
2005-06-13 Bernd Schmidt <bernd.schmidt@analog.com>
* doc/invoke.texi (Blackfin Options): Document -mlong-calls.
core = get_inner_reference (TREE_OPERAND (exp, 0), &bitsize, pbitpos,
poffset, &mode, &unsignedp, &volatilep,
false);
-
- if (TREE_CODE (core) == INDIRECT_REF)
- core = TREE_OPERAND (core, 0);
+ core = build_fold_addr_expr (core);
}
else
{
+2005-06-13 Zdenek Dvorak <dvorakz@suse.cz>
+
+ PR middle-end/21985
+ * gcc.dg/tree-ssa/pr21985.c: New test.
+
2005-06-12 James A. Morrison <phython@gcc.gnu.org>
* ggcc.dg/pr14796-1.c: Add tests for (X << C) >> C.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-vars" } */
+
+struct
+{
+ struct
+ {
+ int a;
+ int b;
+ } a[100];
+} a;
+
+void foo(unsigned);
+unsigned *bar (void);
+
+int
+main (void)
+{
+ unsigned *b = bar ();
+
+ /* This should be folded. */
+ foo (&a.a[50].a - &a.a[33].b);
+ foo ((unsigned) &a.a[50].b - (unsigned) &a);
+
+ /* And this should not. */
+ foo ((unsigned) &b - (unsigned) b);
+ return 0;
+}
+
+/* Two of the calls to foo should be folded to just foo(constant). */
+
+/* { dg-final { scan-tree-dump-times "foo \\(\[0-9\]*\\)" 2 "vars" } } */