On Wed, Oct 31, 2012 at 7:14 PM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Wed, Oct 31, 2012 at 6:57 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >> On Wed, Oct 31, 2012 at 3:53 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >>> On Wed, Oct 31, 2012 at 7:29 AM, Eric Botcazou <ebotca...@adacore.com> >>> wrote: >>>> >>>> > It failed with revision 188008. >>>> >>>> OK, thanks. So the testcase never compiled on the trunk (except for about >>>> 24 >>>> hours between 188009 & 188118) or did it compile before 188008 at some >>>> point? >>>> >>>> -- >>>> Eric Botcazou >>> >>> It was OK until revision 187042: >>> >>> 2012-05-02 Richard Guenther <rguent...@suse.de> >>> >>> * tree.c (valid_constant_size_p): New function. >>> * tree.h (valid_constant_size_p): Declare. >>> * cfgexpand.c (expand_one_var): Adjust check for too large >>> variables by using valid_constant_size_p. >>> * varasm.c (assemble_variable): Likewise. >>> >>> c/ >>> * c-decl.c (grokdeclarator): Properly check for sizes that >>> cover more than half of the address-space. >>> >>> cp/ >>> * decl.c (grokdeclarator): Properly check for sizes that >>> cover more than half of the address-space. >>> >>> 2012-05-02 Richard Guenther <rguent...@suse.de> >>> >>> * fold-const.c (div_if_zero_remainder): sizetypes no longer >>> sign-extend. >>> (int_const_binop_1): New worker for int_const_binop with >>> overflowable parameter. Pass it through >>> to force_fit_type_double. >>> (int_const_binop): Wrap around int_const_binop_1 with overflowable >>> equal to one. >>> (size_binop_loc): Call int_const_binop_1 with overflowable equal >>> to minus one, forcing overflow detection for even unsigned types. >>> (extract_muldiv_1): Remove bogus TYPE_IS_SIZETYPE special-casing. >>> (fold_binary_loc): Call try_move_mult_to_index with signed offset. >>> * stor-layout.c (initialize_sizetypes): sizetypes no longer >>> sign-extend. >>> (layout_type): For zero-sized arrays ignore overflow on the >>> size calculations. >>> * tree-ssa-ccp.c (bit_value_unop_1): Likewise. >>> (bit_value_binop_1): Likewise. >>> * tree.c (double_int_to_tree): Likewise. >>> (double_int_fits_to_tree_p): Likewise. >>> (force_fit_type_double): Likewise. >>> (host_integerp): Likewise. >>> (int_fits_type_p): Likewise. >>> * varasm.c (output_constructor_regular_field): Sign-extend the >>> field-offset to cater for negative offsets produced by the Ada >>> frontend. >>> * omp-low.c (extract_omp_for_data): Convert the loop step to >>> signed for pointer adjustments. >>> >>> which gave: >>> >>> /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc >>> -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O3 -Wall -mx32 >>> -maddress-mode=long -fPIC -S x.i >>> x.i: In function ‘dl_start’: >>> x.i:30:1: error: unrecognizable insn: >>> } >>> ^ >>> (insn 54 53 55 7 (set (reg:SI 108) >>> (const:SI (plus:SI (symbol_ref:SI ("_dl_rtld_map") [flags >>> 0x42] <var_decl 0x7f02997bb140 _dl_rtld_map>) >>> (const_int -1073742800 [0xffffffffbffffc30])))) x.i:22 -1 >>> (nil)) >>> x.i:30:1: internal compiler error: in extract_insn, at recog.c:2130 >>> } >>> ^ >>> Please submit a full bug report, >>> with preprocessed source if appropriate. >>> See <http://gcc.gnu.org/bugs.html> for instructions. >>> >> >> It looks like we are using unsigned type for array index: >> >> (gdb) list >> 2163 tree element = TREE_TYPE (type); >> 2164 >> 2165 build_pointer_type (element); >> 2166 >> 2167 /* We need to know both bounds in order to compute the size. >> */ >> 2168 if (index && TYPE_MAX_VALUE (index) && TYPE_MIN_VALUE (index) >> 2169 && TYPE_SIZE (element)) >> 2170 { >> 2171 tree ub = TYPE_MAX_VALUE (index); >> 2172 tree lb = TYPE_MIN_VALUE (index); >> (gdb) call debug_tree (index) >> <integer_type 0x7ffff1ab6000 >> type <integer_type 0x7ffff199d000 sizetype public unsigned sizetype SI >> size <integer_cst 0x7ffff1989d40 constant 32> >> unit size <integer_cst 0x7ffff1989d60 constant 4> >> align 32 symtab 0 alias set -1 canonical type 0x7ffff199d000 >> precision 32 min <integer_cst 0x7ffff1989d80 0> max <integer_cst >> 0x7ffff1989000 4294967295>> >> SI size <integer_cst 0x7ffff1989d40 32> unit size <integer_cst >> 0x7ffff1989d60 4> >> align 32 symtab 0 alias set -1 canonical type 0x7ffff1ab6000 >> precision 32 min <integer_cst 0x7ffff1989d80 0> max <integer_cst >> 0x7ffff1aa3260 33>> >> (gdb) >> > > size type is changed to unsigned: > > - /* Size types *are* sign extended. */ > - bool sign_extended_type = (!TYPE_UNSIGNED (type) > - || (TREE_CODE (type) == INTEGER_TYPE > - && TYPE_IS_SIZETYPE (type))); > + bool sign_extended_type = !TYPE_UNSIGNED (type); > > But we use size type in places where signed size type > should be used. >
For example, array index computation must be signed, not unsigned. -- H.J.