public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/34030]  New: ICE in in compare_values_warnv, at tree-vrp.c:701
@ 2007-11-08 16:56 christophe dot lyon at st dot com
  2007-11-08 18:37 ` [Bug tree-optimization/34030] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: christophe dot lyon at st dot com @ 2007-11-08 16:56 UTC (permalink / raw)
  To: gcc-bugs

When compiling this sample code
int myvar;

int foo(int mynum)
{
    if ((((void *)0) ==
         (
          myvar & ((1U<<0) << mynum)
         )
         )
        && (mynum > 0)
        )
      {
        return 1;
      }
    return 0;
}

with GCC-4.1.1, 4.1.2, 4.2.2, I get:
internal compiler error: in compare_values_warnv, at tree-vrp.c:701

It occurs only when compiling at -O2, -O3 or -Os, not at -O1.

If I remove the (void*) cast, compilation is successful.


-- 
           Summary: ICE in in compare_values_warnv, at tree-vrp.c:701
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: christophe dot lyon at st dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug tree-optimization/34030] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
@ 2007-11-08 18:37 ` pinskia at gcc dot gnu dot org
  2007-11-09  8:39 ` christophe dot lyon at st dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-08 18:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-11-08 18:37 -------
This might have been already fixed in 4.2.3.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/34030] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
  2007-11-08 18:37 ` [Bug tree-optimization/34030] " pinskia at gcc dot gnu dot org
@ 2007-11-09  8:39 ` christophe dot lyon at st dot com
  2007-11-16 18:17 ` [Bug tree-optimization/34030] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: christophe dot lyon at st dot com @ 2007-11-09  8:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from christophe dot lyon at st dot com  2007-11-09 08:39 -------
In any case, I would appreciate a pointer to the patch, such that I can
backport it to my local 4.1.x branch.


-- 


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


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

* [Bug tree-optimization/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
  2007-11-08 18:37 ` [Bug tree-optimization/34030] " pinskia at gcc dot gnu dot org
  2007-11-09  8:39 ` christophe dot lyon at st dot com
@ 2007-11-16 18:17 ` rguenth at gcc dot gnu dot org
  2007-11-16 18:20 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 18:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2007-11-16 18:17 -------
Confirmed.  Still broken on the 4.1 and 4.2 branches.  Wrong types on the
comparison:

D.1530_7 == 0B
(gdb) call debug_tree (expr)
 <eq_expr 0xb7c0f1d4
    type <boolean_type 0xb7c1a4ac _Bool public unsigned QI
        size <integer_cst 0xb7c081f8 constant invariant 8>
        unit size <integer_cst 0xb7c08210 constant invariant 1>
        align 8 symtab 0 alias set -1 precision 1 min <integer_cst 0xb7c085e8
0> max <integer_cst 0xb7c08618 1>>

    arg 0 <ssa_name 0xb7c9a480
        type <integer_type 0xb7c1a2e0 unsigned int public unsigned SI
            size <integer_cst 0xb7c083f0 constant invariant 32>
            unit size <integer_cst 0xb7c08180 constant invariant 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst
0xb7c08468 0> max <integer_cst 0xb7c08450 4294967295>>
        var <var_decl 0xb7c14268 D.1530> def_stmt <modify_expr 0xb7c0f2f4>
        version 7>
    arg 1 <integer_cst 0xb7c08a98 type <pointer_type 0xb7c1a8fc> constant
invariant 0>>

  _Bool D.1532;
  _Bool D.1531;
  unsigned int D.1530;
  unsigned int D.1529;
  unsigned int myvar.1;
  int myvar.0;

<bb 2>:
  myvar.0_3 = myvar;
  myvar.1_4 = (unsigned int) myvar.0_3;
  D.1529_6 = myvar.1_4 >> mynum_5;
  D.1530_7 = D.1529_6 & 1;
  D.1531_8 = D.1530_7 == 0B;

probably some fold bug.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
      Known to work|4.0.0                       |4.0.0 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-16 18:17:11
               date|                            |
            Summary|ICE in in                   |[4.1/4.2 Regression] ICE in
                   |compare_values_warnv, at    |in compare_values_warnv, at
                   |tree-vrp.c:701              |tree-vrp.c:701
   Target Milestone|---                         |4.2.3


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


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

* [Bug tree-optimization/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
                   ` (2 preceding siblings ...)
  2007-11-16 18:17 ` [Bug tree-optimization/34030] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
@ 2007-11-16 18:20 ` rguenth at gcc dot gnu dot org
  2007-11-16 18:34 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 18:20 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 809 bytes --]



------- Comment #4 from rguenth at gcc dot gnu dot org  2007-11-16 18:20 -------
Or rather a frontend bug if it doesn't promote either the integer to a pointer
or the pointer to an integer:

./cc1 -quiet -O2 t.i -quiet
t.i: In function ‘foo’:
t.i:9: warning: comparison between pointer and integer
                      ^^^^^^^
t.i:4: internal compiler error: in compare_values_warnv, at tree-vrp.c:701
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

with trunk we get

  if ((void *) (1 << mynum & (unsigned int) myvar) == 0B && mynum > 0)

while with 4.2 we have

  if (((unsigned int) myvar >> mynum & 1) == 0B && mynum > 0)

which hints at a fold bug again.


-- 


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


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

* [Bug tree-optimization/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
                   ` (3 preceding siblings ...)
  2007-11-16 18:20 ` rguenth at gcc dot gnu dot org
@ 2007-11-16 18:34 ` rguenth at gcc dot gnu dot org
  2007-11-16 18:38 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 18:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2007-11-16 18:33 -------
Mine.  Still wrong on the trunk.


-- 

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|2007-11-16 18:17:11         |2007-11-16 18:33:57
               date|                            |


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


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

* [Bug tree-optimization/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
                   ` (4 preceding siblings ...)
  2007-11-16 18:34 ` rguenth at gcc dot gnu dot org
@ 2007-11-16 18:38 ` rguenth at gcc dot gnu dot org
  2007-11-16 18:48 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2007-11-16 18:38 -------
On the trunk this doesn't fail because there STRIP_SIGN_NOPS (as applied to
comparisons) doesn't strip conversions to/from pointers.


-- 


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


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

* [Bug tree-optimization/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
                   ` (5 preceding siblings ...)
  2007-11-16 18:38 ` rguenth at gcc dot gnu dot org
@ 2007-11-16 18:48 ` rguenth at gcc dot gnu dot org
  2007-11-16 21:35 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 18:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2007-11-16 18:48 -------
Created an attachment (id=14565)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14565&action=view)
patch

Still needs testing, applies to all branches and trunk.


-- 


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


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

* [Bug tree-optimization/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
                   ` (6 preceding siblings ...)
  2007-11-16 18:48 ` rguenth at gcc dot gnu dot org
@ 2007-11-16 21:35 ` rguenth at gcc dot gnu dot org
  2007-11-16 21:46 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 21:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2007-11-16 21:35 -------
Subject: Bug 34030

Author: rguenth
Date: Fri Nov 16 21:34:39 2007
New Revision: 130238

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

        PR middle-end/34030
        * fold-const.c (fold_binary): Use correct types for folding
        1 << X & Y to Y >> X & 1.

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

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr34030.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug tree-optimization/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
                   ` (7 preceding siblings ...)
  2007-11-16 21:35 ` rguenth at gcc dot gnu dot org
@ 2007-11-16 21:46 ` rguenth at gcc dot gnu dot org
  2007-11-16 21:50 ` rguenth at gcc dot gnu dot org
  2007-11-16 21:51 ` [Bug middle-end/34030] " rguenth at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 21:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2007-11-16 21:45 -------
Subject: Bug 34030

Author: rguenth
Date: Fri Nov 16 21:44:58 2007
New Revision: 130240

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

        PR middle-end/34030
        * fold-const.c (fold_binary): Use correct types for folding
        1 << X & Y to Y >> X & 1.

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

Added:
    branches/gcc-4_2-branch/gcc/testsuite/gcc.c-torture/compile/pr34030.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=34030


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

* [Bug tree-optimization/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
                   ` (8 preceding siblings ...)
  2007-11-16 21:46 ` rguenth at gcc dot gnu dot org
@ 2007-11-16 21:50 ` rguenth at gcc dot gnu dot org
  2007-11-16 21:51 ` [Bug middle-end/34030] " rguenth at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 21:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2007-11-16 21:50 -------
Subject: Bug 34030

Author: rguenth
Date: Fri Nov 16 21:50:20 2007
New Revision: 130242

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

        PR middle-end/34030
        * fold-const.c (fold_binary): Use correct types for folding
        1 << X & Y to Y >> X & 1.

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

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.c-torture/compile/pr34030.c
      - copied unchanged from r130238,
trunk/gcc/testsuite/gcc.c-torture/compile/pr34030.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=34030


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

* [Bug middle-end/34030] [4.1/4.2 Regression] ICE in in compare_values_warnv, at tree-vrp.c:701
  2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
                   ` (9 preceding siblings ...)
  2007-11-16 21:50 ` rguenth at gcc dot gnu dot org
@ 2007-11-16 21:51 ` rguenth at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-16 21:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rguenth at gcc dot gnu dot org  2007-11-16 21:51 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
          Component|tree-optimization           |middle-end
         Resolution|                            |FIXED
   Target Milestone|4.2.3                       |4.1.4


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


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

end of thread, other threads:[~2007-11-16 21:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08 16:56 [Bug c/34030] New: ICE in in compare_values_warnv, at tree-vrp.c:701 christophe dot lyon at st dot com
2007-11-08 18:37 ` [Bug tree-optimization/34030] " pinskia at gcc dot gnu dot org
2007-11-09  8:39 ` christophe dot lyon at st dot com
2007-11-16 18:17 ` [Bug tree-optimization/34030] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
2007-11-16 18:20 ` rguenth at gcc dot gnu dot org
2007-11-16 18:34 ` rguenth at gcc dot gnu dot org
2007-11-16 18:38 ` rguenth at gcc dot gnu dot org
2007-11-16 18:48 ` rguenth at gcc dot gnu dot org
2007-11-16 21:35 ` rguenth at gcc dot gnu dot org
2007-11-16 21:46 ` rguenth at gcc dot gnu dot org
2007-11-16 21:50 ` rguenth at gcc dot gnu dot org
2007-11-16 21:51 ` [Bug middle-end/34030] " 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).