public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/28162]  New: ice on valid code
@ 2006-06-25  9:28 dcb314 at hotmail dot com
  2006-06-25 10:01 ` [Bug c/28162] " dcb314 at hotmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2006-06-25  9:28 UTC (permalink / raw)
  To: gcc-bugs

I just tried to compile the attached source code with compiler flag -O3.
GNU C compiler version 4.2 snapshot 20060624 said

dcb@linux:~/gnu/42-20060617/bugs> ~/gnu/42-20060624/results/bin/gcc -O3 bug18.c
bug18.c: In function 'Speech_Encode_Frame_init':
bug18.c:24528: warning: passing argument 1 of 'Speech_Encode_Frame_exit' from
incompatible pointer type
bug18.c: In function 'ol_ltp':
bug18.c:19118: internal compiler error: in set_value_range, at tree-vrp.c:157
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
dcb@linux:~/gnu/42-20060624/bugs>

Preprocessed source code attached.  Flag -O3 required.


-- 
           Summary: ice on valid code
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com
  GCC host triplet: x86_64-suse


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


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

* [Bug c/28162] ice on valid code
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
@ 2006-06-25 10:01 ` dcb314 at hotmail dot com
  2006-06-25 10:30 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2006-06-25 10:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dcb314 at hotmail dot com  2006-06-25 09:28 -------
Created an attachment (id=11744)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11744&action=view)
C source code


-- 


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


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

* [Bug c/28162] ice on valid code
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
  2006-06-25 10:01 ` [Bug c/28162] " dcb314 at hotmail dot com
@ 2006-06-25 10:30 ` rguenth at gcc dot gnu dot org
  2006-06-25 10:58 ` [Bug tree-optimization/28162] ICE in set_value_range, at tree-vrp.c:157 rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-06-25 10:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-06-25 10:01 -------
min is not less than max:

(gdb) call debug_tree (min)
 <integer_cst 0xa78f57b0 type <integer_type 0xa7bf42e0 unsigned int> constant
invariant 4294966724>
(gdb) call debug_tree (max)
 <integer_cst 0xa7be2498 type <integer_type 0xa7bf433c long int> constant
invariant 2147483647>

but worse, their types don't match.  (I guess the former wants to be casted
to int)

#1  0x086124ff in set_value_range (vr=0xaff5a110, t=VR_RANGE, min=0xa78f57b0,
    max=0xa7be2498, equiv=0x8a30dd8)
    at /home/richard/src/trunk/gcc/tree-vrp.c:157
#2  0x08617d92 in adjust_range_with_scev (vr=0xaff5a110, loop=0x89f3980,
    stmt=0xa7966774, var=0xa700a1e0)
    at /home/richard/src/trunk/gcc/tree-vrp.c:2090
#3  0x0861e035 in vrp_visit_assignment (stmt=0xa7966774, output_p=0xaff5a278)
    at /home/richard/src/trunk/gcc/tree-vrp.c:3457
#4  0x0861f9a0 in vrp_visit_stmt (stmt=0xa7966774, taken_edge_p=0xaff5a27c,
    output_p=0xaff5a278) at /home/richard/src/trunk/gcc/tree-vrp.c:3850

(gdb) call debug_generic_expr (stmt)
D.23941_257 = p_max1D.23874_118 * 0fffffffc
 <mult_expr 0xa7966798
    type <integer_type 0xa7bf42e0 unsigned int public unsigned SI
        size <integer_cst 0xa7be23f0 constant invariant 32>
        unit size <integer_cst 0xa7be2180 constant invariant 4>
        align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xa7be2468
0> max <integer_cst 0xa7be2450 4294967295>
        pointer_to_this <pointer_type 0xa7c94e60>>

    arg 0 <ssa_name 0xa7566e40
        type <integer_type 0xa7a5bcf0 Word32 sizes-gimplified public SI size
<integer_cst 0xa7be23f0 32> unit size <integer_cst 0xa7be2180 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst
0xa7be2480 -2147483648> max <integer_cst 0xa7be2498 2147483647>
            pointer_to_this <pointer_type 0xa7a60678>>
        var <var_decl 0xa7897898 p_max1> def_stmt <modify_expr 0xa794fbf4>
        version 118>
    arg 1 <integer_cst 0xa79a1be8 type <integer_type 0xa7bf42e0 unsigned int>
constant invariant 4294967292>>

type mismatch in the MULT_EXPR (signed vs. unsigned).

ol_ltpD.6288::

;; basic block 10, loop depth 1, count 0
;; prev block 17, next block 11
;; pred:       67 (true,exec)
;; succ:       11 (true) 12 (false)
<L24>:;
p_max1_118 = ASSERT_EXPR <p_max1_13, p_max1_13 > 19>;
D.23941_257 = p_max1_118 * 0fffffffc;
D.23942_258 = (Float32 *) D.23941_257;
D.23943_259 = D.23942_258 + &corr[143];
...


-- 


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


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

* [Bug tree-optimization/28162] ICE in set_value_range, at tree-vrp.c:157
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
  2006-06-25 10:01 ` [Bug c/28162] " dcb314 at hotmail dot com
  2006-06-25 10:30 ` rguenth at gcc dot gnu dot org
@ 2006-06-25 10:58 ` rguenth at gcc dot gnu dot org
  2006-06-25 12:26 ` rguenth 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 @ 2006-06-25 10:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2006-06-25 10:30 -------
Reduced testcase, still needs -O3 (and checking enabled):

void Lag_max_wght(float corr[], long wght_flg)
{
     float t0, max;
     const float *ww;
     long i;
     if ( wght_flg > 0 ) {
        for ( i = 143; i >= 20; i-- ) {
           t0 = corr[ - i] * *ww--;
           if ( t0 >= max )
             max = t0;
        }
     }
}


-- 

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         |2006-06-25 10:30:15
               date|                            |


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


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

* [Bug tree-optimization/28162] ICE in set_value_range, at tree-vrp.c:157
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2006-06-25 10:58 ` [Bug tree-optimization/28162] ICE in set_value_range, at tree-vrp.c:157 rguenth at gcc dot gnu dot org
@ 2006-06-25 12:26 ` rguenth at gcc dot gnu dot org
  2006-06-25 17:00 ` [Bug tree-optimization/28162] [4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-06-25 12:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2006-06-25 12:02 -------
.003.original is already wrong:

t0 = *((float *) (i * 0fffffffc) + corr) * (float) *ww-- ;

we ask fold to fold (unsigned)-i * 4U

which continues to ask fold to fold i * -4U (buggy already), which is from

    case MULT_EXPR:
      /* (-A) * (-B) -> A * B  */
      if (TREE_CODE (arg0) == NEGATE_EXPR && negate_expr_p (arg1))
        return fold_build2 (MULT_EXPR, type,
                            TREE_OPERAND (arg0, 0),
                            negate_expr (arg1));

it should use fold_convert () on the args.  The following fixes it:

Index: fold-const.c
===================================================================
--- fold-const.c        (revision 114974)
+++ fold-const.c        (working copy)
@@ -8866,12 +8866,12 @@ fold_binary (enum tree_code code, tree t
       /* (-A) * (-B) -> A * B  */
       if (TREE_CODE (arg0) == NEGATE_EXPR && negate_expr_p (arg1))
        return fold_build2 (MULT_EXPR, type,
-                           TREE_OPERAND (arg0, 0),
-                           negate_expr (arg1));
+                           fold_convert (type, TREE_OPERAND (arg0, 0)),
+                           fold_convert (type, negate_expr (arg1)));
       if (TREE_CODE (arg1) == NEGATE_EXPR && negate_expr_p (arg0))
        return fold_build2 (MULT_EXPR, type,
-                           negate_expr (arg0),
-                           TREE_OPERAND (arg1, 0));
+                           fold_convert (type, negate_expr (arg0)),
+                           fold_convert (type, TREE_OPERAND (arg1, 0)));

       if (! FLOAT_TYPE_P (type))
        {

(obvious, but has to wait until after the summit.)


-- 

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-06-25 10:30:15         |2006-06-25 12:02:00
               date|                            |


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


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

* [Bug tree-optimization/28162] [4.2 Regression] ICE in set_value_range, at tree-vrp.c:157
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2006-06-25 12:26 ` rguenth at gcc dot gnu dot org
@ 2006-06-25 17:00 ` pinskia at gcc dot gnu dot org
  2006-07-05 10:45 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-25 17:00 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
            Summary|ICE in set_value_range, at  |[4.2 Regression] ICE in
                   |tree-vrp.c:157              |set_value_range, at tree-
                   |                            |vrp.c:157
   Target Milestone|---                         |4.2.0


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


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

* [Bug tree-optimization/28162] [4.2 Regression] ICE in set_value_range, at tree-vrp.c:157
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2006-06-25 17:00 ` [Bug tree-optimization/28162] [4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-07-05 10:45 ` patchapp at dberlin dot org
  2006-07-05 15:49 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: patchapp at dberlin dot org @ 2006-07-05 10:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2006-07-05 10:45 -------
Subject: Bug number PR28162

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00133.html


-- 


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


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

* [Bug tree-optimization/28162] [4.2 Regression] ICE in set_value_range, at tree-vrp.c:157
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2006-07-05 10:45 ` patchapp at dberlin dot org
@ 2006-07-05 15:49 ` rguenth at gcc dot gnu dot org
  2006-07-05 15:50 ` rguenth at gcc dot gnu dot org
  2006-07-11 13:57 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-05 15:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2006-07-05 15:49 -------
Subject: Bug 28162

Author: rguenth
Date: Wed Jul  5 15:49:12 2006
New Revision: 115202

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115202
Log:
2006-07-05  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/28162
        * fold-const.c (fold_binary): For (-A) * (-B) -> A * B
        make sure to convert the operands to the correct type.

        * gcc.dg/pr28162.c: New testcase.

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


-- 


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


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

* [Bug tree-optimization/28162] [4.2 Regression] ICE in set_value_range, at tree-vrp.c:157
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2006-07-05 15:49 ` rguenth at gcc dot gnu dot org
@ 2006-07-05 15:50 ` rguenth at gcc dot gnu dot org
  2006-07-11 13:57 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-05 15:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2006-07-05 15:49 -------
Fixed.  Modulo the problem being latent on 4.1.


-- 

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=28162


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

* [Bug tree-optimization/28162] [4.2 Regression] ICE in set_value_range, at tree-vrp.c:157
  2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2006-07-05 15:50 ` rguenth at gcc dot gnu dot org
@ 2006-07-11 13:57 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-11 13:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2006-07-11 13:57 -------
Subject: Bug 28162

Author: rguenth
Date: Tue Jul 11 13:57:05 2006
New Revision: 115333

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115333
Log:
2006-07-11  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/28162
        * fold-const.c (fold_binary): For (-A) * (-B) -> A * B
        make sure to convert the operands to the correct type.

        * gcc.dg/pr28162.c: New testcase.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr28162.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/fold-const.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2006-07-11 13:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-25  9:28 [Bug c/28162] New: ice on valid code dcb314 at hotmail dot com
2006-06-25 10:01 ` [Bug c/28162] " dcb314 at hotmail dot com
2006-06-25 10:30 ` rguenth at gcc dot gnu dot org
2006-06-25 10:58 ` [Bug tree-optimization/28162] ICE in set_value_range, at tree-vrp.c:157 rguenth at gcc dot gnu dot org
2006-06-25 12:26 ` rguenth at gcc dot gnu dot org
2006-06-25 17:00 ` [Bug tree-optimization/28162] [4.2 Regression] " pinskia at gcc dot gnu dot org
2006-07-05 10:45 ` patchapp at dberlin dot org
2006-07-05 15:49 ` rguenth at gcc dot gnu dot org
2006-07-05 15:50 ` rguenth at gcc dot gnu dot org
2006-07-11 13:57 ` 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).