public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/19899] ICE: tree check: expected real_cst, have integer_cst in const_binop, at fold-const.c:1490 with -ftree-vectorize -msse2
Date: Mon, 01 Aug 2005 23:58:00 -0000	[thread overview]
Message-ID: <20050801235826.13653.qmail@sourceware.org> (raw)
In-Reply-To: <20050211111005.19899.commie1@gmx.net>


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-08-01 23:58 -------
The ICE seems to happen when a floating point number is decremented.
The following code snippet in add_to_evolution looks suspicious:

  if (code == MINUS_EXPR)
    to_add = chrec_fold_multiply (type, to_add, 
				  build_int_cst_type (type, -1));

This leads to trouble if type is a REAL_TYPE.

The following patch (neither bootstrapped nor regtested) seems to fix
the problem (also in PR23173). Is this a proper fix?

===================================================================
--- tree-scalar-evolution.c	27 Jul 2005 13:26:54 -0000	2.32
+++ tree-scalar-evolution.c	1 Aug 2005 23:43:59 -0000
@@ -237,6 +237,7 @@ Software Foundation, 51 Franklin Street,
 #include "tm.h"
 #include "ggc.h"
 #include "tree.h"
+#include "real.h"
 
 /* These RTL headers are needed for basic-block.h.  */
 #include "rtl.h"
@@ -866,8 +867,9 @@ add_to_evolution (unsigned loop_nb, 
     }
 
   if (code == MINUS_EXPR)
-    to_add = chrec_fold_multiply (type, to_add, 
-				  build_int_cst_type (type, -1));
+    to_add = chrec_fold_multiply (type, to_add, TREE_CODE (type) == REAL_TYPE
+				  ? build_real (type, dconstm1)
+				  : build_int_cst_type (type, -1));
 
   res = add_to_evolution_1 (loop_nb, chrec_before, to_add);
 
===================================================================


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19899


  parent reply	other threads:[~2005-08-01 23:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11 16:52 [Bug tree-optimization/19899] New: " commie1 at gmx dot net
2005-02-11 17:51 ` [Bug tree-optimization/19899] " pinskia at gcc dot gnu dot org
2005-02-12 16:43 ` dorit at il dot ibm dot com
2005-06-13 19:38 ` stefaan dot deroeck at gmail dot com
2005-08-01 11:36 ` reichelt at gcc dot gnu dot org
2005-08-01 16:38 ` pinskia at gcc dot gnu dot org
2005-08-01 16:40 ` pinskia at gcc dot gnu dot org
2005-08-01 23:58 ` reichelt at gcc dot gnu dot org [this message]
2005-08-02 16:06 ` reichelt at gcc dot gnu dot org
2005-08-03 14:19 ` cvs-commit at gcc dot gnu dot org
2005-08-03 14:41 ` cvs-commit at gcc dot gnu dot org
2005-08-03 14:42 ` reichelt at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050801235826.13653.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).