From 3bf6bfcc7e3d3188a558787af16a22604523fb63 Mon Sep 17 00:00:00 2001 From: Janis Johnson Date: Mon, 14 May 2007 23:49:36 +0000 Subject: [PATCH] c-typeck.c (build_binary_op): Return early for error. gcc/ * c-typeck.c (build_binary_op): Return early for error. gcc/testsuite/ * gcc.dg/dfp/usual-arith-conv-bad.c: New test. From-SVN: r124732 --- gcc/ChangeLog | 4 ++++ gcc/c-typeck.c | 6 +++++- gcc/testsuite/ChangeLog | 4 +++- gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 26d474df623..0abf554d3b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2007-05-14 Janis Johnson + + * c-typeck.c (build_binary_op): Return early for error. + 2007-05-15 Zdenek Dvorak * tree-ssa-loop-niter.c (record_estimate): Use GGC_NEW to allocate diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index fc42389782c..2bf767776ba 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -8148,7 +8148,11 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, int none_complex = (code0 != COMPLEX_TYPE && code1 != COMPLEX_TYPE); if (shorten || common || short_compare) - result_type = c_common_type (type0, type1); + { + result_type = c_common_type (type0, type1); + if (result_type == error_mark_node) + return error_mark_node; + } /* For certain operations (which identify themselves by shorten != 0) if both args were extended from the same smaller type, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 159cee58520..fd3c801a12f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,8 @@ 2007-05-14 Janis Johnson - * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic. + * gcc.dg/dfp/usual-arith-conv-bad.c: New test. + + * gcc.dg/fltconst-pedantic-dfp.c: New test. PR c/31924 * gcc.dg/fltconst-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c b/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c new file mode 100644 index 00000000000..4693abc90d9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +/* This used to result in an ICE. */ + +extern _Decimal64 x; +extern int i; + +void +foo (void) +{ + if (x <= 2.0) /* { dg-error "mix operands" } */ + i++; +}