Commit adacecf1 by Zdenek Dvorak Committed by Zdenek Dvorak

re PR middle-end/21985 (miscompiled or wrong code snippet?)

	PR middle-end/21985
	* fold-const.c (split_address_to_core_and_offset): Always return
	the address of the base object.

	* gcc.dg/tree-ssa/pr21985.c: New test.

From-SVN: r100877
parent 75d93ef7
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.
......
......@@ -11801,9 +11801,7 @@ split_address_to_core_and_offset (tree exp,
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.
......
/* { 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" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment