Commit 723afc44 by Richard Guenther Committed by Richard Biener

re PR middle-end/51071 (ICE in gimple_has_side_effects, at gimple.c:2513)

2011-11-10  Richard Guenther  <rguenther@suse.de>

	PR middle-end/51071
	* gimple.c (gimple_has_side_effects): Remove checking code
	that doesn't belong here.

	* gcc.dg/torture/pr51071.c: New testcase.

From-SVN: r181253
parent 08d603d6
2011-11-10 Richard Guenther <rguenther@suse.de>
PR middle-end/51071
* gimple.c (gimple_has_side_effects): Remove checking code
that doesn't belong here.
2011-11-10 Ira Rosen <ira.rosen@linaro.org> 2011-11-10 Ira Rosen <ira.rosen@linaro.org>
PR tree-optimization/51058 PR tree-optimization/51058
...@@ -2457,8 +2457,6 @@ gimple_set_modified (gimple s, bool modifiedp) ...@@ -2457,8 +2457,6 @@ gimple_set_modified (gimple s, bool modifiedp)
bool bool
gimple_has_side_effects (const_gimple s) gimple_has_side_effects (const_gimple s)
{ {
unsigned i;
if (is_gimple_debug (s)) if (is_gimple_debug (s))
return false; return false;
...@@ -2474,47 +2472,15 @@ gimple_has_side_effects (const_gimple s) ...@@ -2474,47 +2472,15 @@ gimple_has_side_effects (const_gimple s)
if (is_gimple_call (s)) if (is_gimple_call (s))
{ {
unsigned nargs = gimple_call_num_args (s); int flags = gimple_call_flags (s);
tree fn;
if (!(gimple_call_flags (s) & (ECF_CONST | ECF_PURE))) /* An infinite loop is considered a side effect. */
return true; if (!(flags & (ECF_CONST | ECF_PURE))
else if (gimple_call_flags (s) & ECF_LOOPING_CONST_OR_PURE) || (flags & ECF_LOOPING_CONST_OR_PURE))
/* An infinite loop is considered a side effect. */
return true; return true;
if (gimple_call_lhs (s)
&& TREE_SIDE_EFFECTS (gimple_call_lhs (s)))
{
gcc_checking_assert (gimple_has_volatile_ops (s));
return true;
}
fn = gimple_call_fn (s);
if (fn && TREE_SIDE_EFFECTS (fn))
return true;
for (i = 0; i < nargs; i++)
if (TREE_SIDE_EFFECTS (gimple_call_arg (s, i)))
{
gcc_checking_assert (gimple_has_volatile_ops (s));
return true;
}
return false; return false;
} }
else
{
for (i = 0; i < gimple_num_ops (s); i++)
{
tree op = gimple_op (s, i);
if (op && TREE_SIDE_EFFECTS (op))
{
gcc_checking_assert (gimple_has_volatile_ops (s));
return true;
}
}
}
return false; return false;
} }
......
2011-11-10 Richard Guenther <rguenther@suse.de>
PR middle-end/51071
* gcc.dg/torture/pr51071.c: New testcase.
2011-11-10 Eric Botcazou <ebotcazou@adacore.com> 2011-11-10 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/loop_optimization9.ad[sb]: New test. * gnat.dg/loop_optimization9.ad[sb]: New test.
......
/* { dg-do compile } */
void foo (void);
void bar (void *);
extern int t;
static void kmalloc_large (int size, int flags)
{
(void) size;
(void) flags;
foo ();
bar (({__here:&&__here;}));
}
static void kmalloc (int size, int flags)
{
if (size)
{
if ((unsigned long) size > 0x1000)
kmalloc_large (size, flags);
if (flags)
bar (({__here:&&__here;}));
}
}
void compress_file_range (int i, int j, int k)
{
int nr_pages = ({j < k;});
if (i || t)
kmalloc (0x1000UL * nr_pages, 0x40UL);
}
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