This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix pr23046


Richard Henderson <rth@redhat.com> writes:

> On Sat, Aug 06, 2005 at 01:51:23AM -0400, James A. Morrison wrote:
>> 	PR middle-end/23046
>> 	* fold-const.c (fold_binary): Return 0 for X > TYPE_MAX_VALUE or
>> 	X < TYPE_MIN_VALUE.
>
> We've just discussed that it'll break Ada.
>
> Have you tried the patch I suggested to fix this bug?
>
>
> r~
>
>
>
> Index: fold-const.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
> retrieving revision 1.615
> diff -u -p -d -r1.615 fold-const.c
> --- fold-const.c	4 Aug 2005 18:55:14 -0000	1.615
> +++ fold-const.c	9 Aug 2005 18:02:40 -0000
> @@ -9172,7 +9172,7 @@ fold_binary (enum tree_code code, tree t
>        /* Comparisons with the highest or lowest possible integer of
>  	 the specified size will have known values.  */
>        {
> -	int width = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (arg1)));
> +	int width = TYPE_PRECISION (TREE_TYPE (arg1));

 The precision of the type is still 32, but the maxval is 1:

(gdb) p TREE_TYPE (arg1)->type
$6 = {common = {chain = 0x0, type = 0x0, ann = 0x0, code = ENUMERAL_TYPE,
    side_effects_flag = 0, constant_flag = 0, addressable_flag = 0,
    volatile_flag = 0, readonly_flag = 1, unsigned_flag = 1,
    asm_written_flag = 0, nowarning_flag = 0, used_flag = 0, nothrow_flag = 0,
    static_flag = 0, public_flag = 0, private_flag = 0, protected_flag = 0,
    deprecated_flag = 0, invariant_flag = 0, lang_flag_0 = 0, lang_flag_1 = 0,
    lang_flag_2 = 0, lang_flag_3 = 0, lang_flag_4 = 0, lang_flag_5 = 0,
    lang_flag_6 = 0, visited = 0}, values = 0x2000000000419bc0,
  size = 0x20000000002f89f0, size_unit = 0x20000000002f8510, attributes = 0x0,
  uid = 890, precision = 32, mode = SImode, string_flag = 0,
  no_force_blk_flag = 0, needs_constructing_flag = 0,
  transparent_union_flag = 0, packed_flag = 0, restrict_flag = 0,
  contains_placeholder_bits = 0, lang_flag_0 = 0, lang_flag_1 = 0,
  lang_flag_2 = 0, lang_flag_3 = 0, lang_flag_4 = 0, lang_flag_5 = 0,
  lang_flag_6 = 0, user_align = 0, align = 32, pointer_to = 0x0,
  reference_to = 0x0, symtab = {address = 0, pointer = 0x0, die = 0x0},
  name = 0x2000000000343670, minval = 0x20000000004198c0,
  maxval = 0x2000000000419c50, next_variant = 0x0,
  main_variant = 0x200000000046a310, binfo = 0x0, context = 0x0,
  alias_set = -1, lang_specific = 0x0}

(gdb) p TREE_TYPE (arg1)->type->maxval->int_cst
$8 = {common = {chain = 0x0, type = 0x200000000046a310, ann = 0x0,
    code = INTEGER_CST, side_effects_flag = 0, constant_flag = 1,
    addressable_flag = 0, volatile_flag = 0, readonly_flag = 0,
    unsigned_flag = 0, asm_written_flag = 0, nowarning_flag = 0,
    used_flag = 0, nothrow_flag = 0, static_flag = 0, public_flag = 0,
    private_flag = 0, protected_flag = 0, deprecated_flag = 0,
    invariant_flag = 1, lang_flag_0 = 0, lang_flag_1 = 0, lang_flag_2 = 0,
    lang_flag_3 = 0, lang_flag_4 = 0, lang_flag_5 = 0, lang_flag_6 = 0,
    visited = 0}, int_cst = {low = 1, high = 0}}

 So, no this doesn't fix the ice.

-- 
Thanks,
Jim

http://www.csclub.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]