Bug 40640 - [4.5 Regression] ICE in set_value_range, at tree-vrp.c:383
Summary: [4.5 Regression] ICE in set_value_range, at tree-vrp.c:383
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2009-07-03 15:20 UTC by Joel Sherrill
Modified: 2009-07-03 22:09 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work: 4.4.0
Known to fail:
Last reconfirmed: 2009-07-03 19:49:58


Attachments
preprocessed test case (hw_opic.c (16.23 KB, application/x-bzip2)
2009-07-03 15:24 UTC, Joel Sherrill
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joel Sherrill 2009-07-03 15:20:53 UTC
gcc (GCC) 4.5.0 20090702 (experimental) [trunk revision 149195]

building gdb head as of today.  preprocessed file and coming in next update

gcc -c -g -O2 -DDEFAULT_INLINE=PSIM_INLINE_LOCALS     -DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN -DWITH_SMP=5        -DWITH_TRACE=1      -DHAVE_TERMIOS_STRUCTURE -DHAVE_TERMIOS_CLINE -DHAVE_DEVZERO     -I. -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../../include -I../../bfd -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../../bfd -I../../gdb -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../../gdb  -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../../gdb/config  -DHAVE_COMMON_FPU -I../common -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../common targ-map.c
gcc -c -g -O2 -DDEFAULT_INLINE=PSIM_INLINE_LOCALS     -DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN -DWITH_SMP=5        -DWITH_TRACE=1      -DHAVE_TERMIOS_STRUCTURE -DHAVE_TERMIOS_CLINE -DHAVE_DEVZERO     -I. -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../../include -I../../bfd -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../../bfd -I../../gdb -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../../gdb  -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../../gdb/config  -DHAVE_COMMON_FPU -I../common -I/home/joel/test-gcc/gdb-cvs/src/sim/ppc/../common /home/joel/test-gcc/gdb-cvs/src/sim/ppc/main.c
/home/joel/test-gcc/gdb-cvs/src/sim/ppc/hw_opic.c: In function ‘hw_opic_io_read_buffer’:
/home/joel/test-gcc/gdb-cvs/src/sim/ppc/hw_opic.c:1613:1: internal compiler error: in set_value_range, at tree-vrp.c:383
Comment 1 Joel Sherrill 2009-07-03 15:24:30 UTC
Created attachment 18135 [details]
preprocessed test case (hw_opic.c

preprocessed version of gdb/sim/ppc/hw_opic.c

FAILS: gcc -O2 -c t.c 
PASSES: gcc -O1 -c t.c
Comment 2 Richard Biener 2009-07-03 19:26:35 UTC
Reducing.
Comment 3 Richard Biener 2009-07-03 19:42:25 UTC
Confirmed.

enum { gcr0_8259_bit = 0x20000000, gcr0_reset_bit = 0x80000000 };
void decode_opic_address(int *);
void hw_opic_io_read_buffer(int index)
{
  unsigned reg = 0;
  decode_opic_address(&index);
  switch (index)
    {
    case 0:
      reg |= gcr0_8259_bit;
    }
  sim_io_printf_filtered2 (index, reg);
}
Comment 4 Richard Biener 2009-07-03 19:49:58 UTC
switch-conversion triggers this, but it looks like a VRP issue after all.  Mine.
Comment 5 Richard Biener 2009-07-03 20:04:56 UTC
(gdb) call debug_tree (limit)
 <integer_cst 0xb7d5ac40 type <integer_type 0xb7d2aee0> constant 0>
(gdb) call vrp_val_is_max (limit)
$6 = 1 '\001'
(gdb) call vrp_val_is_min (limit)
$7 = 1 '\001'

err ...

(gdb) call debug_tree (0xb7d2aee0)
 <integer_type 0xb7d2aee0
    type <integer_type 0xb7ccd000 unsigned int public unsigned sizetype SI
        size <integer_cst 0xb7cbe4b4 constant 32>
        unit size <integer_cst 0xb7cbe2a0 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0xb7ccd000 precision 32 min <integer_cst 0xb7cbe4d0 0> max <integer_cst 0xb7cbea64 -1>>
    public SI size <integer_cst 0xb7cbe4b4 32> unit size <integer_cst 0xb7cbe2a0 4>
    align 32 symtab 0 alias set -1 canonical type 0xb7d2aee0 precision 32 min <integer_cst 0xb7cbe2bc 0> max <integer_cst 0xb7cbe2bc 0>>


hmm - single-valued integer subtypes.

I have a patch.
Comment 6 Richard Biener 2009-07-03 22:09:23 UTC
Fixed.
Comment 7 Richard Biener 2009-07-03 22:09:26 UTC
Subject: Bug 40640

Author: rguenth
Date: Fri Jul  3 22:09:12 2009
New Revision: 149211

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

	PR tree-optimization/40640
	* tree-switch-conversion.c (build_arrays): Perform arithmetic
	in original type.

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

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr40640.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-switch-conversion.c

Comment 8 hjl@gcc.gnu.org 2009-07-04 16:10:41 UTC
Subject: Bug 40640

Author: hjl
Date: Sat Jul  4 16:10:28 2009
New Revision: 149231

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149231
Log:
2009-07-04  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-07-03  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/40640
	* gcc.c-torture/compile/pr40640.c: New testcase.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr40640.c
      - copied unchanged from r149230, trunk/gcc/testsuite/gcc.c-torture/compile/pr40640.c
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog