public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/33146]  New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
@ 2007-08-22  8:33 tbm at cyrius dot com
  2007-08-22  8:34 ` [Bug tree-optimization/33146] " tbm at cyrius dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tbm at cyrius dot com @ 2007-08-22  8:33 UTC (permalink / raw)
  To: gcc-bugs

I get the following ICE with current trunk.  This was introduced between
20070616 (works) and 20070720 (ICE).

(sid)25899:tbm@em64t: ~] /usr/lib/gcc-snapshot/bin/gcc -c -O -Wall
jasper-jpc_t1enc.c
jasper-jpc_t1enc.c: In function 'foo':
jasper-jpc_t1enc.c:10: internal compiler error: in build_polynomial_chrec, at
tree-chrec.h:136
Please submit a full bug report,


-- 
           Summary: [4.3 Regression] ICE in build_polynomial_chrec, at tree-
                    chrec.h:136
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbm at cyrius dot com


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


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
  2007-08-22  8:34 ` [Bug tree-optimization/33146] " tbm at cyrius dot com
@ 2007-08-22  8:34 ` tbm at cyrius dot com
  2007-08-22  9:06 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tbm at cyrius dot com @ 2007-08-22  8:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tbm at cyrius dot com  2007-08-22 08:34 -------
Maybe caused by:

2007-06-19  Sebastian Pop  <sebpop@gmail.com>

        PR tree-optimization/32367
        * tree-chrec.h (build_polynomial_chrec): Verify that the left hand side


-- 

tbm at cyrius dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sebpop at gmail dot com


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


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
@ 2007-08-22  8:34 ` tbm at cyrius dot com
  2007-08-22  8:34 ` tbm at cyrius dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tbm at cyrius dot com @ 2007-08-22  8:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tbm at cyrius dot com  2007-08-22 08:34 -------
/* Testcase by Martin Michlmayr <tbm@cyrius.com> */

typedef struct
{
  int end;
  int term;
}
jpc_enc_pass_t;
void foo(int numpasses, jpc_enc_pass_t *p)
{
  jpc_enc_pass_t *pass;
  jpc_enc_pass_t *termpass;
  for (pass = p; pass != termpass; ++pass)
    if (!pass->term)
    {
      termpass = pass;
      while (termpass - pass < numpasses && !termpass->term)
        ++termpass;
      pass->end = termpass->end;
    }
}


-- 


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


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
  2007-08-22  8:34 ` [Bug tree-optimization/33146] " tbm at cyrius dot com
  2007-08-22  8:34 ` tbm at cyrius dot com
@ 2007-08-22  9:06 ` rguenth at gcc dot gnu dot org
  2007-08-22 10:29 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-08-22  9:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2007-08-22 09:05 -------
We indeed have a strange chrec here:

(gdb) call debug_tree (left)
 <negate_expr 0x2afca7c12240
    type <pointer_type 0x2afca7be9b60
        type <record_type 0x2afca7be9a90 jpc_enc_pass_t type_0 DI
            size <integer_cst 0x2afca71ddb70 constant invariant 64>
            unit size <integer_cst 0x2afca71ddba0 constant invariant 8>
            align 32 symtab 0 alias set -1 canonical type 0x2afca7be9820 fields
<field_decl 0x2afca72a90b0 end> context <translation_unit_decl 0x2afca7be9ea0
D.2029>
            pointer_to_this <pointer_type 0x2afca7be9b60>>
        sizes-gimplified public unsigned DI size <integer_cst 0x2afca71ddb70
64> unit size <integer_cst 0x2afca71ddba0 8>
        align 64 symtab 0 alias set -1 canonical type 0x2afca7be9c30>

    arg 0 <ssa_name 0x2afca7c02060 type <pointer_type 0x2afca7be9b60>
        volatile visited var <parm_decl 0x2afca71e45a0 p> def_stmt <nop_expr
0x2afca7bff6c0>
        version 5
        ptr-info 0x2afca7bfe560>>

(gdb) call debug_tree (right)
 <integer_cst 0x2afca7c0ae40 type <pointer_type 0x2afca7be9b60> constant
invariant public overflow 18446744073709551608>


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-08-22 09:05:54
               date|                            |
   Target Milestone|---                         |4.3.0


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


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
                   ` (2 preceding siblings ...)
  2007-08-22  9:06 ` rguenth at gcc dot gnu dot org
@ 2007-08-22 10:29 ` pinskia at gcc dot gnu dot org
  2007-08-25 23:22 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-22 10:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-08-22 10:29 -------
So we have a NEGATIVE_EXPR of a pointer type that is just wrong.  I am going to
look into this further (plus I guess I need to add more checking).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
           Keywords|                            |ice-on-valid-code


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


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
                   ` (3 preceding siblings ...)
  2007-08-22 10:29 ` pinskia at gcc dot gnu dot org
@ 2007-08-25 23:22 ` pinskia at gcc dot gnu dot org
  2007-09-05  2:18 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-25 23:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-08-25 23:21 -------
Simple fix, negative_expr needs to create the NEGATIVE_EXPR in the same type as
the original.


-- 


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


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
                   ` (4 preceding siblings ...)
  2007-08-25 23:22 ` pinskia at gcc dot gnu dot org
@ 2007-09-05  2:18 ` mmitchel at gcc dot gnu dot org
  2007-09-21 10:20 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-09-05  2:18 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=33146


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
                   ` (5 preceding siblings ...)
  2007-09-05  2:18 ` mmitchel at gcc dot gnu dot org
@ 2007-09-21 10:20 ` rguenth at gcc dot gnu dot org
  2007-09-22  9:40 ` rguenth at gcc dot gnu dot org
  2007-09-22  9:43 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-09-21 10:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2007-09-21 10:20 -------
The problem is that fold_binary converts (long)ptr * -1 to (long)-ptr:

         /* Transform x * -1 into -x.  */
          if (integer_all_onesp (arg1))
            return fold_convert (type, negate_expr (arg0));

we shouldn't negate a pointer I think.  Still if we negate op0 here,
negate_expr
strips sing-nops and ends up producing -ptr again :/

Sort of a mess...  (asserting that we do not call negate_expr on pointers
reveals even more problems)

Anyway, the following fixes it:

Index: fold-const.c
===================================================================
--- fold-const.c        (revision 128644)
+++ fold-const.c        (working copy)
@@ -10242,7 +10242,7 @@ fold_binary (enum tree_code code, tree t
            return non_lvalue (fold_convert (type, arg0));
          /* Transform x * -1 into -x.  */
          if (integer_all_onesp (arg1))
-           return fold_convert (type, negate_expr (arg0));
+           return fold_convert (type, negate_expr (op0));
          /* Transform x * -C into -x * C if x is easily negatable.  */
          if (TREE_CODE (arg1) == INTEGER_CST
              && tree_int_cst_sgn (arg1) == -1
Index: tree.h
===================================================================
--- tree.h      (revision 128644)
+++ tree.h      (working copy)
@@ -1019,7 +1019,9 @@ extern void omp_clause_range_check_faile
         && (TYPE_MODE (TREE_TYPE (EXP))                        \
             == TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0))))  \
         && (TYPE_UNSIGNED (TREE_TYPE (EXP))                    \
-            == TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
+            == TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
+        && (POINTER_TYPE_P (TREE_TYPE (EXP))                   \
+            == POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
     (EXP) = TREE_OPERAND (EXP, 0)

 /* Like STRIP_NOPS, but don't alter the TREE_TYPE either.  */


Andrew, with POINTER_PLUS_EXPR, do we still "allow" negating a pointer?


-- 


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


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
                   ` (6 preceding siblings ...)
  2007-09-21 10:20 ` rguenth at gcc dot gnu dot org
@ 2007-09-22  9:40 ` rguenth at gcc dot gnu dot org
  2007-09-22  9:43 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-09-22  9:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2007-09-22 09:39 -------
Subject: Bug 33146

Author: rguenth
Date: Sat Sep 22 09:39:41 2007
New Revision: 128666

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128666
Log:
2007-09-22  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/33146
        * fold-const.c (fold_binary): Use the original tree
        for negating.
        * tree.h (STRIP_SIGN_NOPS): Converting from or to pointer
        also changes "sign".

        * gcc.c-torture/compile/pr33146.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr33146.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree.h


-- 


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


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

* [Bug tree-optimization/33146] [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136
  2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
                   ` (7 preceding siblings ...)
  2007-09-22  9:40 ` rguenth at gcc dot gnu dot org
@ 2007-09-22  9:43 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-09-22  9:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2007-09-22 09:43 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-09-22  9:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-22  8:33 [Bug tree-optimization/33146] New: [4.3 Regression] ICE in build_polynomial_chrec, at tree-chrec.h:136 tbm at cyrius dot com
2007-08-22  8:34 ` [Bug tree-optimization/33146] " tbm at cyrius dot com
2007-08-22  8:34 ` tbm at cyrius dot com
2007-08-22  9:06 ` rguenth at gcc dot gnu dot org
2007-08-22 10:29 ` pinskia at gcc dot gnu dot org
2007-08-25 23:22 ` pinskia at gcc dot gnu dot org
2007-09-05  2:18 ` mmitchel at gcc dot gnu dot org
2007-09-21 10:20 ` rguenth at gcc dot gnu dot org
2007-09-22  9:40 ` rguenth at gcc dot gnu dot org
2007-09-22  9:43 ` rguenth at gcc dot gnu dot org

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