public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/30744]  New: ICE in compare_values, at tree-vrp.c:466
@ 2007-02-09 11:22 gkatsi at gmail dot com
  2007-02-09 13:21 ` [Bug middle-end/30744] " rguenth at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gkatsi at gmail dot com @ 2007-02-09 11:22 UTC (permalink / raw)
  To: gcc-bugs

The following causes an ICE
$ gcc -v
Using built-in specs.
Target: i386-apple-darwin8.8.1
Configured with: ../configure --prefix=/Users/gkatsi/pkgs/gcc-4.2.pre
--enable-languages=c,c++ --enable-__cxa_atexit
Thread model: posix
gcc version 4.2.0 20070209 (prerelease)
$ cat tt2.c
typedef struct {
  unsigned long unique;
} G;

void r(G* n)
{
  unsigned long p;
  if (((G *) ((void *)((~(unsigned long)(p))))) != ((void *)0)) {
    ((G *) ((void *)((~(unsigned long)(p)))))->unique = n->unique;
  }
}
$ gcc -O2 -c tt2.c
tt2.c: In function 'r':
tt2.c:6: internal compiler error: in compare_values, at tree-vrp.c:466
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

It also happens on i686-pc-linux-gnu with gcc version 4.2.0 20070207


-- 
           Summary: ICE in compare_values, at tree-vrp.c:466
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gkatsi at gmail dot com
 GCC build triplet: i386-apple-darwin8.8.1
  GCC host triplet: i386-apple-darwin8.8.1
GCC target triplet: i386-apple-darwin8.8.1


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/30744] ICE in compare_values, at tree-vrp.c:466
  2007-02-09 11:22 [Bug tree-optimization/30744] New: ICE in compare_values, at tree-vrp.c:466 gkatsi at gmail dot com
@ 2007-02-09 13:21 ` rguenth at gcc dot gnu dot org
  2007-02-09 18:47 ` [Bug middle-end/30744] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-09 13:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-02-09 13:21 -------
Confirmed.  Wrong types in comparison:

#5  0x000000000094f7ff in fold_predicate_in (stmt=0x2b5158e17690)
    at /space/rguenther/src/svn/trunk/gcc/tree-ssa-propagate.c:1106
1106      val = vrp_evaluate_conditional (*pred_p, true);
(gdb) call debug_generic_expr (stmt)
if (p_1(D) != -1B) goto <L0>; else goto <L1>;

(gdb) call debug_tree (cond)
 <ne_expr 0x2b5158e1c200
    type <boolean_type 0x2b5158e219c0 _Bool public unsigned QI
        size <integer_cst 0x2b5158e11810 constant invariant 8>
        unit size <integer_cst 0x2b5158e11840 constant invariant 1>
        align 8 symtab 0 alias set -1 canonical type 0x2b5158e219c0 precision 1
min <integer_cst 0x2b5158e11d20 0> max <integer_cst 0x2b5158e11d80 1>>

    arg 0 <ssa_name 0x2b5158f6cde0
        type <integer_type 0x2b5158e21780 long unsigned int sizes-gimplified
public unsigned DI
            size <integer_cst 0x2b5158e11ba0 constant invariant 64>
            unit size <integer_cst 0x2b5158e11bd0 constant invariant 8>
            align 64 symtab 0 alias set -1 canonical type 0x2b5158e21780
precision 64 min <integer_cst 0x2b5158e11c00 0> max <integer_cst 0x2b5158e11b70
18446744073709551615>>
        volatile visited var <var_decl 0x2b5158f79000 p> def_stmt <nop_expr
0x2b5158e1c840>
        version 1>
    arg 1 <integer_cst 0x2b5158e2eb40 type <pointer_type 0x2b5158e31300>
constant invariant 18446744073709551615>
    t.i:8>

>From the beginning:

;; enabled by -tree-original


{
  long unsigned int p;

    long unsigned int p;
  if (p != -1B)
    {
      ((struct G *) (void *) ~p)->unique = n->unique;
    }
}

We fold (void *)~p != (void *)0 to p != (void *)-1 here:

fold_comparison (...
...
  /* Fold ~X op C as X op' ~C, where op' is the swapped comparison.  */
  if (TREE_CODE (arg0) == BIT_NOT_EXPR
      && TREE_CODE (arg1) == INTEGER_CST)
    return fold_build2 (swap_tree_comparison (code), type,
                        TREE_OPERAND (arg0, 0),
                        fold_build1 (BIT_NOT_EXPR, TREE_TYPE (arg1), arg1));

but arg0 has NOPs stripped.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roger at eyesopen dot com
             Status|UNCONFIRMED                 |NEW
          Component|tree-optimization           |middle-end
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-09 13:21:38
               date|                            |


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/30744] [4.2/4.3 Regression] ICE in compare_values, at tree-vrp.c:466
  2007-02-09 11:22 [Bug tree-optimization/30744] New: ICE in compare_values, at tree-vrp.c:466 gkatsi at gmail dot com
  2007-02-09 13:21 ` [Bug middle-end/30744] " rguenth at gcc dot gnu dot org
@ 2007-02-09 18:47 ` pinskia at gcc dot gnu dot org
  2007-02-19 21:05 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-09 18:47 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE in compare_values, at   |[4.2/4.3 Regression] ICE in
                   |tree-vrp.c:466              |compare_values, at tree-
                   |                            |vrp.c:466
   Target Milestone|---                         |4.2.0


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/30744] [4.2/4.3 Regression] ICE in compare_values, at tree-vrp.c:466
  2007-02-09 11:22 [Bug tree-optimization/30744] New: ICE in compare_values, at tree-vrp.c:466 gkatsi at gmail dot com
  2007-02-09 13:21 ` [Bug middle-end/30744] " rguenth at gcc dot gnu dot org
  2007-02-09 18:47 ` [Bug middle-end/30744] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2007-02-19 21:05 ` mmitchel at gcc dot gnu dot org
  2007-03-04 19:03 ` sayle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-19 21:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/30744] [4.2/4.3 Regression] ICE in compare_values, at tree-vrp.c:466
  2007-02-09 11:22 [Bug tree-optimization/30744] New: ICE in compare_values, at tree-vrp.c:466 gkatsi at gmail dot com
                   ` (2 preceding siblings ...)
  2007-02-19 21:05 ` mmitchel at gcc dot gnu dot org
@ 2007-03-04 19:03 ` sayle at gcc dot gnu dot org
  2007-03-06 16:30 ` sayle at gcc dot gnu dot org
  2007-03-06 16:33 ` roger at eyesopen dot com
  5 siblings, 0 replies; 7+ messages in thread
From: sayle at gcc dot gnu dot org @ 2007-03-04 19:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from sayle at gcc dot gnu dot org  2007-03-04 19:03 -------
Subject: Bug 30744

Author: sayle
Date: Sun Mar  4 19:03:13 2007
New Revision: 122531

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122531
Log:

        PR middle-end/30744
        * fold-const.c (fold_comparison): Enforce type consistency when
        transforming ~X op ~Y to Y op X, and ~X op C to X op' ~C.

        * gcc.dg/pr30744-1.c: New test case.


Added:
    trunk/gcc/testsuite/gcc.dg/pr30744-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/30744] [4.2/4.3 Regression] ICE in compare_values, at tree-vrp.c:466
  2007-02-09 11:22 [Bug tree-optimization/30744] New: ICE in compare_values, at tree-vrp.c:466 gkatsi at gmail dot com
                   ` (3 preceding siblings ...)
  2007-03-04 19:03 ` sayle at gcc dot gnu dot org
@ 2007-03-06 16:30 ` sayle at gcc dot gnu dot org
  2007-03-06 16:33 ` roger at eyesopen dot com
  5 siblings, 0 replies; 7+ messages in thread
From: sayle at gcc dot gnu dot org @ 2007-03-06 16:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from sayle at gcc dot gnu dot org  2007-03-06 16:30 -------
Subject: Bug 30744

Author: sayle
Date: Tue Mar  6 16:30:12 2007
New Revision: 122622

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122622
Log:

        PR middle-end/30744
        * fold-const.c (fold_binary) <EQ_EXPR>: Enforce type consistency
        when transforming ~X op C to X op' ~C.

        * gcc.dg/pr30744-1.c: New test case.


Added:
    branches/gcc-4_2-branch/gcc/testsuite/gcc.dg/pr30744-1.c
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/fold-const.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/30744] [4.2/4.3 Regression] ICE in compare_values, at tree-vrp.c:466
  2007-02-09 11:22 [Bug tree-optimization/30744] New: ICE in compare_values, at tree-vrp.c:466 gkatsi at gmail dot com
                   ` (4 preceding siblings ...)
  2007-03-06 16:30 ` sayle at gcc dot gnu dot org
@ 2007-03-06 16:33 ` roger at eyesopen dot com
  5 siblings, 0 replies; 7+ messages in thread
From: roger at eyesopen dot com @ 2007-03-06 16:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from roger at eyesopen dot com  2007-03-06 16:32 -------
This should now be fixed on both mainline and the 4.2 release branch.


-- 

roger at eyesopen dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.2.0 4.3.0                 |
      Known to work|4.1.1                       |4.1.1 4.2.0 4.3.0
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-03-06 16:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-09 11:22 [Bug tree-optimization/30744] New: ICE in compare_values, at tree-vrp.c:466 gkatsi at gmail dot com
2007-02-09 13:21 ` [Bug middle-end/30744] " rguenth at gcc dot gnu dot org
2007-02-09 18:47 ` [Bug middle-end/30744] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2007-02-19 21:05 ` mmitchel at gcc dot gnu dot org
2007-03-04 19:03 ` sayle at gcc dot gnu dot org
2007-03-06 16:30 ` sayle at gcc dot gnu dot org
2007-03-06 16:33 ` roger at eyesopen dot com

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).