Commit fb8b656c by Geoffrey Keating Committed by Geoffrey Keating

c-parse.in (select_or_iter_stmt): Use truthvalue_conversion on the condition of a FOR statement...

2000-12-28  Geoffrey Keating  <geoffk@redhat.com>

	* c-parse.in (select_or_iter_stmt): Use truthvalue_conversion
	on the condition of a FOR statement, so that it gets typechecked
	and optimised.

2000-12-28  Geoffrey Keating  <geoffk@redhat.com>

	* gcc.dg/noncompile/20001228-1.c: New test.

From-SVN: r38527
parent 68940175
2000-12-28 Geoffrey Keating <geoffk@redhat.com>
* c-parse.in (select_or_iter_stmt): Use truthvalue_conversion
on the condition of a FOR statement, so that it gets typechecked
and optimised.
2000-12-29 Alexandre Oliva <aoliva@redhat.com>
* c-decl.c (grokdeclarator): Prevent crash in case of overflow in
......
......@@ -1896,7 +1896,8 @@ select_or_iter_stmt:
{ stmt_count++;
RECHAIN_STMTS ($<ttype>2, FOR_INIT_STMT ($<ttype>2)); }
xexpr ';'
{ FOR_COND ($<ttype>2) = $6; }
{ if ($6)
FOR_COND ($<ttype>2) = truthvalue_conversion ($6); }
xexpr ')'
{ FOR_EXPR ($<ttype>2) = $9; }
c99_block_lineno_labeled_stmt
......
......@@ -4,6 +4,8 @@
2000-12-28 Geoffrey Keating <geoffk@redhat.com>
* gcc.dg/noncompile/20001228-1.c: New test.
* gcc.dg/20001228-1.c: New test.
* gcc.c-torture/execute/20001228-1.c: New test.
......
void rof(void)
{
union { int a; } u;
for (u.a = 0; u; u.a++) /* { dg-error "invalid operand" } */
;
}
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