public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/28814] [4.1/4.2 regression] in compare_values, at tree-vrp.c:415
Date: Wed, 23 Aug 2006 10:26:00 -0000	[thread overview]
Message-ID: <20060823102604.4820.qmail@sourceware.org> (raw)
In-Reply-To: <bug-28814-13133@http.gcc.gnu.org/bugzilla/>



------- Comment #5 from rguenth at gcc dot gnu dot org  2006-08-23 10:26 -------
We have mismatched types coming into

#4  0x086244c4 in vrp_evaluate_conditional (cond=0xb7d2b168, use_equiv_p=1
'\001') at /space/rguenther/src/svn/sse-revert/gcc/tree-vrp.c:3717
3717                return compare_name_with_value (TREE_CODE (cond), op0,
op1);
(gdb) call debug_tree (cond)
 <eq_expr 0xb7d2b168
    type <boolean_type 0xb7d364ac _Bool public unsigned QI
        size <integer_cst 0xb7d241f8 constant invariant 8>
        unit size <integer_cst 0xb7d24210 constant invariant 1>
        align 8 symtab 0 alias set -1 precision 1 min <integer_cst 0xb7d245e8
0> max <integer_cst 0xb7d24618 1>>

    arg 0 <ssa_name 0xb7dbb270
        type <integer_type 0xb7d362e0 unsigned int sizes-gimplified public
unsigned SI
            size <integer_cst 0xb7d243f0 constant invariant 32>
            unit size <integer_cst 0xb7d24180 constant invariant 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst
0xb7d24468 0> max <integer_cst 0xb7d24450 4294967295>>
        visited var <var_decl 0xb7d30108 r9887> def_stmt <nop_expr 0xb7db8240>
        version 1>
    arg 1 <integer_cst 0xb7d24d98 type <pointer_type 0xb7d368fc> constant
invariant 1>
    t.i:11>
#5  0x0821544f in fold_predicate_in (stmt=0xb7d330c8) at
/space/rguenther/src/svn/sse-revert/gcc/tree-ssa-propagate.c:1045
1045      val = vrp_evaluate_conditional (*pred_p, true);
(gdb) call debug_generic_expr (stmt)
if (r9887D.1606_1 == 1B) goto <L0>; else goto <L1>;

which fold produces here:

      /* If this is an EQ or NE comparison of a constant with a PLUS_EXPR or
         a MINUS_EXPR of a constant, we can convert it into a comparison with
         a revised constant as long as no overflow occurs.  */
      if (TREE_CODE (arg1) == INTEGER_CST
          && (TREE_CODE (arg0) == PLUS_EXPR
              || TREE_CODE (arg0) == MINUS_EXPR)
          && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
          && 0 != (tem = const_binop (TREE_CODE (arg0) == PLUS_EXPR
                                      ? MINUS_EXPR : PLUS_EXPR,
                                      arg1, TREE_OPERAND (arg0, 1), 0))
          && ! TREE_CONSTANT_OVERFLOW (tem))
        return fold_build2 (code, type, TREE_OPERAND (arg0, 0), tem);

tem is of pointer type, but arg0 is of type unsigned int.

I have a fix.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-08-23 07:05:53         |2006-08-23 10:26:04
               date|                            |


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


  parent reply	other threads:[~2006-08-23 10:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-22 21:53 [Bug c/28814] New: ICE when compiling Stalin under 4.1 but not 4.0 gcc-bugzilla at gcc dot gnu dot org
2006-08-23  7:06 ` [Bug tree-optimization/28814] [4.1/4.2 regression] in compare_values, at tree-vrp.c:415 tbm at gcc dot gnu dot org
2006-08-23  8:12 ` pinskia at gcc dot gnu dot org
2006-08-23  9:38 ` tbm at gcc dot gnu dot org
2006-08-23 10:26 ` rguenth at gcc dot gnu dot org [this message]
2006-08-23 14:16 ` [Bug middle-end/28814] " patchapp at dberlin dot org
2006-08-25 22:01 ` rguenth at gcc dot gnu dot org
2006-08-25 22:02 ` [Bug middle-end/28814] [4.1 " rguenth at gcc dot gnu dot org
2006-09-01 21:49 ` rguenth at gcc dot gnu dot org
2006-09-01 21:49 ` rguenth 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=20060823102604.4820.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).