template<short S>
void foo(void)
{
const unsigned short m = S ? ((unsigned short) 0 | (unsigned short) 0) : 0;
short t = 1 & m;
}
ICEs in:
#0 0x00000000005b136f in operand_equal_p (arg0=0x2aaaae123f60,
arg1=0x2aaaae123f90, flags=0) at ../../gcc/fold-const.c:2421
#1 0x00000000005b5792 in fold_binary (code=BIT_IOR_EXPR, type=0x2aaaae004420,
op0=0x2aaaae12d540, op1=0x2aaaae12d580)
at ../../gcc/fold-const.c:8050
#2 0x00000000005bbde9 in fold_build2_stat (code=2919253024, type=0x0,
op0=0x74, op1=0x0) at ../../gcc/fold-const.c:10597
#3 0x00000000005445c6 in convert_to_integer (type=0x2aaaae004420, expr=<value
optimized out>) at ../../gcc/convert.c:641
#4 0x0000000000462e4a in ocp_convert (type=0x2aaaae004420, expr=<value
optimized out>, convtype=15, flags=35)
at ../../gcc/cp/cvt.c:698
#5 0x00000000005445e9 in convert_to_integer (type=0x2aaaae004420,
expr=0x2aaaadff8730) at ../../gcc/convert.c:683
#6 0x0000000000462e4a in ocp_convert (type=0x2aaaae004420, expr=<value
optimized out>, convtype=15, flags=3)
at ../../gcc/cp/cvt.c:698
#7 0x000000000045e349 in default_conversion (exp=0x2aaaae004420) at
../../gcc/cp/typeck.c:1435
as C++ specific trees (cast_expr in
<bit_ior_expr 0x2aaaadff8780
type <integer_type 0x2aaaae0044d0 int public type_6 SI
size <integer_cst 0x2aaaadff2a20 constant invariant 32>
unit size <integer_cst 0x2aaaadff2540 constant invariant 4>
align 32 symtab 0 alias set -1 precision 32 min <integer_cst
0x2aaaadff2990 -2147483648> max <integer_cst 0x2aaaadff29c0 2147483647>
pointer_to_this <pointer_type 0x2aaaae017790>>
side-effects
arg 0 <cast_expr 0x2aaaae12d540
type <integer_type 0x2aaaae004420 short unsigned int public unsigned
type_6 HI
size <integer_cst 0x2aaaadff2840 constant invariant 16>
unit size <integer_cst 0x2aaaadff2870 constant invariant 2>
align 16 symtab 0 alias set -1 precision 16 min <integer_cst
0x2aaaadff2960 0> max <integer_cst 0x2aaaadff2930 65535>>
side-effects
arg 0 <tree_list 0x2aaaae123f60
value <integer_cst 0x2aaaae00f660 constant invariant 0>>>
arg 1 <cast_expr 0x2aaaae12d580 type <integer_type 0x2aaaae004420 short
unsigned int>
side-effects
arg 0 <tree_list 0x2aaaae123f90 value <integer_cst 0x2aaaae00f660 0>>>>
are passed to convert_to_integer/fold.
This certainly didn't ICE in 3.2.3, and doesn't ICE in 4.2+ either
(I believe PR27506 made the difference here).
--
Summary: [4.1 regression] default_conversion ICE while
processing_template_decl
Product: gcc
Version: 4.1.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31714