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]

Re: egcs-20000306 ICE in `size_binop', at fold-const.c:1873


    In get_inner_reference, offset is initialized to size_zero_node.  It's
    never assigned to, except as the result of `size_binop'.  And, yet, it
    ends up not having sizetype, do to oddness in `fold'.  Surely, if we
    just keep calling size_binop, and passing the result back to
    size_binop, we should not have to explicitly convert to size_type
    between each call.  So, either size_binop should convert its result,
    or `fold' should not be doing what it's doing.

    What's odd here is that sizetype is an unsigned type, and yet you've
    found a place where offset is quite reasonably negative.  The fix
    might be that get_inner_reference should use integer_type, rather that
    sizetype.

That's what ssizetype is: it might well be wider than integer_type.

I'll take a closer look at this, but this code will very shortly be totally
rewritten by me, so I on't want to spend too much time on it.

As to the issue of negative offsets, I was thinking about that and now feel
that offsets, in most languages, are always positive.  If they can be negative,
the language should use a signed type for sizetype.  On the other hand, there's
no problem systematically using a signed variant of sizetype for offsets.

What do folks this?

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