* fold-const.c (fold <PLUS_EXPR>): Check for integer constant
operands before calling tree_int_cst_lt when performing associative
transformations.
* gcc.dg/
20030820-1.c: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70618
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-08-20 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/11984
+ * fold-const.c (fold <PLUS_EXPR>): Check for integer constant
+ operands before calling tree_int_cst_lt when performing associative
+ transformations.
+
2003-08-20 Jason Merrill <jason@redhat.com>
* tree.h (IS_EXPR_CODE_CLASS): Also include 'r' and 's'.
example: ((X*2 + 4) - 8U)/2. */
if (minus_lit0 && lit0)
{
- if (tree_int_cst_lt (lit0, minus_lit0))
+ if (TREE_CODE (lit0) == INTEGER_CST
+ && TREE_CODE (minus_lit0) == INTEGER_CST
+ && tree_int_cst_lt (lit0, minus_lit0))
{
minus_lit0 = associate_trees (minus_lit0, lit0,
MINUS_EXPR, type);
+2003-08-20 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/11984
+ * gcc.dg/20030820-1.c: New test case.
+
2003-08-20 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11945
--- /dev/null
+/* PR middle-end/11984 */
+/* The following program used to ICE in fold because we didn't check
+ whether the constants we were reassociating were integer constants
+ before calling tree_int_cst_lt. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+double f(double x)
+{
+ return 1.0 - x - 0.1;
+}
+