c-typeck.c (build_binary_op): Return early for error.
authorJanis Johnson <janis187@us.ibm.com>
Mon, 14 May 2007 23:49:36 +0000 (23:49 +0000)
committerJanis Johnson <janis@gcc.gnu.org>
Mon, 14 May 2007 23:49:36 +0000 (23:49 +0000)
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
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c [new file with mode: 0644]

index 26d474df6236b6c90e4231e8a1aa20357ca8b3f0..0abf554d3b1c04d01334082b8750c67976214e0b 100644 (file)
@@ -1,3 +1,7 @@
+2007-05-14  Janis Johnson  <janis187@us.ibm.com>
+
+       * c-typeck.c (build_binary_op): Return early for error.
+
 2007-05-15  Zdenek Dvorak  <dvorakz@suse.cz>
 
        * tree-ssa-loop-niter.c (record_estimate): Use GGC_NEW to allocate
index fc42389782c4e3c41c65d96e5386557ccf19c413..2bf767776ba9dede73f2c61cd3d22062797f58f5 100644 (file)
@@ -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,
index 159cee585207c877d1373cf01e14dc6ce1f4d507..fd3c801a12fc4b565305e6ebcf7fdd8502602a5e 100644 (file)
@@ -1,6 +1,8 @@
 2007-05-14  Janis Johnson  <janis187@us.ibm.com>
 
-        * 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 (file)
index 0000000..4693abc
--- /dev/null
@@ -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++;
+}