Commit 63dfbb95 by Richard Biener Committed by Richard Biener

re PR c/61741 (wrong code with -fno-strict-overflow)

2014-07-09  Richard Biener  <rguenther@suse.de>

	PR c-family/61741
	* c-gimplify.c (c_gimplify_expr): Gimplify self-modify expressions
	using unsigned arithmetic if overflow does not wrap instead of
	if overflow is undefined.

	* c-c++-common/torture/pr61741.c: New testcase.

From-SVN: r212400
parent bde56a1d
2014-07-09 Richard Biener <rguenther@suse.de>
PR c-family/61741
* c-gimplify.c (c_gimplify_expr): Gimplify self-modify expressions
using unsigned arithmetic if overflow does not wrap instead of
if overflow is undefined.
2014-07-06 Marek Polacek <polacek@redhat.com>
PR c/6940
......
......@@ -240,9 +240,7 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 0));
if (INTEGRAL_TYPE_P (type) && c_promoting_integer_type_p (type))
{
if (TYPE_OVERFLOW_UNDEFINED (type)
|| ((flag_sanitize & SANITIZE_SI_OVERFLOW)
&& !TYPE_OVERFLOW_WRAPS (type)))
if (!TYPE_OVERFLOW_WRAPS (type))
type = unsigned_type_for (type);
return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type);
}
......
2014-07-09 Richard Biener <rguenther@suse.de>
PR c-family/61741
* c-c++-common/torture/pr61741.c: New testcase.
2014-07-09 Pat Haugen <pthaugen@us.ibm.com>
* lib/target-supports.exp
......
/* { dg-do run } */
int a = 1, b;
void
foo (void)
{
char c = 0;
for (; a; a--)
for (; c >= 0; c++);
if (!c)
b = 1;
}
int
main ()
{
foo ();
if (b != 0)
__builtin_abort ();
return 0;
}
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