public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301
@ 2005-06-01  3:39 john dot carter at tait dot co dot nz
  2005-06-01  3:41 ` [Bug tree-optimization/21858] " john dot carter at tait dot co dot nz
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: john dot carter at tait dot co dot nz @ 2005-06-01  3:39 UTC (permalink / raw)
  To: gcc-bugs

Preprocessed file supplied (bug.i)

This would appear to be related to RESOLVED bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21188 and
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21227

As far as I can make out the fixes for those bugs have been checked in, I'm
using gcc tip of CVS mainline as at Wed Jun  1 02:00 UTC 2005 and the bug is
still present. ie. This is either a different bug manifesting in the same place
or the old bug revived. This affects both the arm and the i686 backends, so I
suspect it is before it hits the backend.)

/usr/local/bin/arm-elf-gcc -v
Using built-in specs.
Target: arm-elf
Configured with: ../combined/configure --target=arm-elf --enable-languages=c,c++
--with-gnu-as --with-gnu-ld --with-newlib
Thread model: single
gcc version 4.1.0 20050601 (experimental)

Also...
/opt/gcc4_1/bin/gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=c --prefix=/opt/gcc4_1
Thread model: posix
gcc version 4.1.0 20050601 (experimental)

Using gcc -v I can see what gcc is running when it crashes, and hence reproduce
the bug like so...
cd /home/johnc/tmp
/opt/gcc4_1/libexec/gcc/i686-pc-linux-gnu/4.1.0/cc1 -fpreprocessed
/home/johnc/tmp/bug.i  -dumpbase bug.i -auxbase bug -Os -std=c9x -v -o
/home/johnc/tmp/bug.s
ignoring nonexistent directory
"/opt/gcc4_1/lib/gcc/i686-pc-linux-gnu/4.1.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /opt/gcc4_1/include
 /opt/gcc4_1/lib/gcc/i686-pc-linux-gnu/4.1.0/include
 /usr/include
End of search list.
 strcoll
 dsdblm_CreateBlock

/home/johnc/tmp/bug.i: In function 'dsdblm_CreateBlock':
/home/johnc/tmp/bug.i:201: warning: comparison between pointer and integer
 dsdblm_WriteBlock

Analyzing compilation unitPerforming intraprocedural optimizations
Assembling functions:
 dsdblm_CreateBlock

/home/johnc/tmp/bug.i: In function 'dsdblm_CreateBlock':
/home/johnc/tmp/bug.i:196: internal compiler error: in compare_values, at
tree-vrp.c:301


I can then use gdb on cc1 and put a breakpoint on fancy_abort and get a stack
trace...
where
#0  fancy_abort (file=0x12d <Address 0x12d out of bounds>, line=0,
function=0x12d <Address 0x12d out of bounds>)
    at ../../combined/gcc/diagnostic.c:588
#1  0x08382ab8 in compare_values (val1=0xb7fa8680, val2=0xb7ddfc30) at
../../combined/gcc/tree-vrp.c:410
#2  0x083848bd in compare_range_with_value (comp=LE_EXPR, vr=0xb7dc9840,
val=0xb7ddfc30) at ../../combined/gcc/tree-vrp.c:1234
#3  0x08386e64 in vrp_evaluate_conditional (cond=0xb7d66798) at
../../combined/gcc/tree-vrp.c:1992
#4  0x08387025 in vrp_visit_cond_stmt (stmt=0xb7d6c168, taken_edge_p=0xbf9bec20)
at ../../combined/gcc/tree-vrp.c:2044
#5  0x083874df in vrp_visit_stmt (stmt=0xb7d6c168, taken_edge_p=0x12d,
output_p=0x12d) at ../../combined/gcc/tree-vrp.c:2089
#6  0x08163401 in simulate_stmt (stmt=0xb7d6c168) at
../../combined/gcc/tree-ssa-propagate.c:302
#7  0x08163896 in simulate_block (block=0xb7de2af8) at
../../combined/gcc/tree-ssa-propagate.c:425
#8  0x08164a7d in ssa_propagate (visit_stmt=0x12d, visit_phi=0x12d) at
../../combined/gcc/tree-ssa-propagate.c:667
#9  0x08388526 in execute_vrp () at ../../combined/gcc/tree-vrp.c:2383
#10 0x080d2c02 in execute_one_pass (pass=0x8507600) at
../../combined/gcc/tree-optimize.c:623
#11 0x080d2d28 in execute_pass_list (pass=0x8507600) at
../../combined/gcc/tree-optimize.c:660
#12 0x080d2d48 in execute_pass_list (pass=0x85053c0) at
../../combined/gcc/tree-optimize.c:661
#13 0x080d3008 in tree_rest_of_compilation (fndecl=0xb7de157c) at
../../combined/gcc/tree-optimize.c:793
#14 0x0805d44d in c_expand_body (fndecl=0xb7de157c) at
../../combined/gcc/c-decl.c:6593
#15 0x083adf7a in cgraph_expand_function (node=0xb7de1b64) at
../../combined/gcc/cgraphunit.c:949
#16 0x083ae14b in cgraph_expand_all_functions () at
../../combined/gcc/cgraphunit.c:1013
#17 0x083ae41a in cgraph_optimize () at ../../combined/gcc/cgraphunit.c:1115
#18 0x0834d136 in compile_file () at ../../combined/gcc/toplev.c:1008
#19 0x0834e78b in do_compile () at ../../combined/gcc/toplev.c:2123
#20 0x0834e805 in toplev_main (argc=301, argv=0xbf9bef34) at
../../combined/gcc/toplev.c:2155
#21 0x080b110b in main (argc=301, argv=0x12d) at ../../combined/gcc/main.c:35

-- 
           Summary: ICE in compare_values, at tree-vrp.c:301
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john dot carter at tait dot co dot nz
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i486-elf-linux
GCC target triplet: arm-elf && i686-pc-linux-gnu


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


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

* [Bug tree-optimization/21858] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
@ 2005-06-01  3:41 ` john dot carter at tait dot co dot nz
  2005-06-01  3:43 ` john dot carter at tait dot co dot nz
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: john dot carter at tait dot co dot nz @ 2005-06-01  3:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From john dot carter at tait dot co dot nz  2005-06-01 03:40 -------
Created an attachment (id=9005)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9005&action=view)
Preprocessed source that triggers ICE

I have tried to trim this down as much as I can, but it is still quite hairy.

-- 


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


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

* [Bug tree-optimization/21858] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
  2005-06-01  3:41 ` [Bug tree-optimization/21858] " john dot carter at tait dot co dot nz
@ 2005-06-01  3:43 ` john dot carter at tait dot co dot nz
  2005-06-01  7:08 ` [Bug tree-optimization/21858] [4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: john dot carter at tait dot co dot nz @ 2005-06-01  3:43 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code


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


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

* [Bug tree-optimization/21858] [4.1 Regression] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
  2005-06-01  3:41 ` [Bug tree-optimization/21858] " john dot carter at tait dot co dot nz
  2005-06-01  3:43 ` john dot carter at tait dot co dot nz
@ 2005-06-01  7:08 ` pinskia at gcc dot gnu dot org
  2005-06-01 19:31 ` [Bug middle-end/21858] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-01  7:08 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org, dnovillo at gcc dot gnu
                   |                            |dot org
            Summary|ICE in compare_values, at   |[4.1 Regression] ICE in
                   |tree-vrp.c:301              |compare_values, at tree-
                   |                            |vrp.c:301
   Target Milestone|---                         |4.1.0


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


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

* [Bug middle-end/21858] [4.1 Regression] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
                   ` (2 preceding siblings ...)
  2005-06-01  7:08 ` [Bug tree-optimization/21858] [4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-06-01 19:31 ` pinskia at gcc dot gnu dot org
  2005-06-01 19:38 ` dnovillo at redhat dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-01 19:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-01 19:31 -------
Confirmed, reduced testcase:
unsigned int dsdblm_GetBlockAddress();
void error_LocalAssert(void);
int dsdblm_CreateBlock(unsigned int address)
{
   address = dsdblm_GetBlockAddress();
   if (address >= (void*)0x00020000)
     error_LocalAssert();
   return address;
}
This is either a front-end bug or a fold bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|tree-optimization           |middle-end
     Ever Confirmed|                            |1
   GCC host triplet|i486-elf-linux              |
 GCC target triplet|arm-elf && i686-pc-linux-gnu|
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-01 19:31:22
               date|                            |


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


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

* [Bug middle-end/21858] [4.1 Regression] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
                   ` (3 preceding siblings ...)
  2005-06-01 19:31 ` [Bug middle-end/21858] " pinskia at gcc dot gnu dot org
@ 2005-06-01 19:38 ` dnovillo at redhat dot com
  2005-06-01 19:41 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dnovillo at redhat dot com @ 2005-06-01 19:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dnovillo at redhat dot com  2005-06-01 19:38 -------
Subject: Re:  [4.1 Regression] ICE in compare_values, at tree-vrp.c:301

On Wed, Jun 01, 2005 at 07:31:24PM -0000, pinskia at gcc dot gnu dot org wrote:
> 
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-01 19:31 -------
> Confirmed, reduced testcase:
> unsigned int dsdblm_GetBlockAddress();
> void error_LocalAssert(void);
> int dsdblm_CreateBlock(unsigned int address)
> {
>    address = dsdblm_GetBlockAddress();
>    if (address >= (void*)0x00020000)
>      error_LocalAssert();
>    return address;
> }
> This is either a front-end bug or a fold bug.
> 
Is this legal C?

vrp15.c: In function `dsdblm_CreateBlock':
vrp15.c:6: warning: comparison between pointer and integer

This is very similar to what I found in the Fortran FE a few days
ago.  The .gimple form is already "wrong":

  D.1242 = dsdblm_GetBlockAddress ();
  address = D.1242;
  if (address > 131071B)

We lose, or never emit, the cast to convert the constant to integer.

However, the optimizers should probably not be ICEing here.  I
will remove the assert in compare_values, to simply refuse to do
anything when pointers and non-pointers are mixed in the same
predicate.


Diego.


-- 


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


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

* [Bug middle-end/21858] [4.1 Regression] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
                   ` (4 preceding siblings ...)
  2005-06-01 19:38 ` dnovillo at redhat dot com
@ 2005-06-01 19:41 ` pinskia at gcc dot gnu dot org
  2005-06-03  9:26 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-01 19:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-01 19:40 -------
(In reply to comment #3)
> Is this legal C?

This is not valid C but valid GNU C.  The front-end should be converting the types correctly

Please don't remove the assert, it catches things like this.

-- 


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


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

* [Bug middle-end/21858] [4.1 Regression] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
                   ` (5 preceding siblings ...)
  2005-06-01 19:41 ` pinskia at gcc dot gnu dot org
@ 2005-06-03  9:26 ` rguenth at gcc dot gnu dot org
  2005-06-03 15:15 ` cvs-commit at gcc dot gnu dot org
  2005-06-03 15:18 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-06-03  9:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-06-03 09:26 -------
Revised patch with testcase:
http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00243.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |06/msg00243.html
             Status|NEW                         |ASSIGNED
           Keywords|                            |patch
   Last reconfirmed|2005-06-01 19:31:22         |2005-06-03 09:26:36
               date|                            |


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


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

* [Bug middle-end/21858] [4.1 Regression] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
                   ` (6 preceding siblings ...)
  2005-06-03  9:26 ` rguenth at gcc dot gnu dot org
@ 2005-06-03 15:15 ` cvs-commit at gcc dot gnu dot org
  2005-06-03 15:18 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-03 15:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-03 15:15 -------
Subject: Bug 21858

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rguenth@gcc.gnu.org	2005-06-03 15:15:46

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr21858.c 

Log message:
	2005-06-03  Richard Guenther  <rguenth@gcc.gnu.org>
	
	PR middle-end/21858
	* fold-const.c (fold_binary): Fix type mismatches in folding
	of comparisons.
	
	* gcc.dg/pr21858.c: New testcase.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9021&r2=2.9022
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.590&r2=1.591
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5583&r2=1.5584
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr21858.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug middle-end/21858] [4.1 Regression] ICE in compare_values, at tree-vrp.c:301
  2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
                   ` (7 preceding siblings ...)
  2005-06-03 15:15 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-03 15:18 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-06-03 15:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-06-03 15:18 -------
Fixed.

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


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


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

end of thread, other threads:[~2005-06-03 15:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-01  3:39 [Bug tree-optimization/21858] New: ICE in compare_values, at tree-vrp.c:301 john dot carter at tait dot co dot nz
2005-06-01  3:41 ` [Bug tree-optimization/21858] " john dot carter at tait dot co dot nz
2005-06-01  3:43 ` john dot carter at tait dot co dot nz
2005-06-01  7:08 ` [Bug tree-optimization/21858] [4.1 Regression] " pinskia at gcc dot gnu dot org
2005-06-01 19:31 ` [Bug middle-end/21858] " pinskia at gcc dot gnu dot org
2005-06-01 19:38 ` dnovillo at redhat dot com
2005-06-01 19:41 ` pinskia at gcc dot gnu dot org
2005-06-03  9:26 ` rguenth at gcc dot gnu dot org
2005-06-03 15:15 ` cvs-commit at gcc dot gnu dot org
2005-06-03 15:18 ` 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).