diff options
author | Geoffrey Keating <geoffk@redhat.com> | 2000-12-29 08:27:40 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2000-12-29 08:27:40 +0000 |
commit | fb8b656c65ec5df2bf16a8eb636577e8be619244 (patch) | |
tree | 74df938ddc4fd9f854f62e5d03857b48c466e7c5 | |
parent | 68940175460a147340617aa400213b32fda99fc4 (diff) | |
download | gcc-fb8b656c65ec5df2bf16a8eb636577e8be619244.zip gcc-fb8b656c65ec5df2bf16a8eb636577e8be619244.tar.gz gcc-fb8b656c65ec5df2bf16a8eb636577e8be619244.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-parse.in | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/noncompile/20001228-1.c | 6 |
4 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 04d22cd..7a306e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 8b211d1..f944ac3 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1070cbc..86c588b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/gcc.dg/noncompile/20001228-1.c b/gcc/testsuite/gcc.dg/noncompile/20001228-1.c new file mode 100644 index 0000000..79efe11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/noncompile/20001228-1.c @@ -0,0 +1,6 @@ +void rof(void) +{ + union { int a; } u; + for (u.a = 0; u; u.a++) /* { dg-error "invalid operand" } */ + ; +} |