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


    I think having sizetype not be the same type as `size_t' is pretty
    confusing in C.

It is the same type from all but a very low-level view.

     It seems to me that offsets should have type `ptrdiff_t', and sizes
    should have type `size_t'; I guess those are spelled `ssizetype' and
    `sizetype'. 

Right.

    But, then, it should be allowed to add a `ssizetype' to a `sizetype',
    just as in C you can add a `ptrdiff_t' to a `size_t'.

Yes, but when you do that in C, we generate a tree that has a conversion,
so we should do so internally as well.

    I don't know about "most languages", but offsets can definitely be
    negative in C and C++.  Any time that `p' and `q' are two pointers, `p
    - q' is a signed quantity, and that's well-defined, as long as `p' and
    `q' point into the same array.

Sorry, that's not what I meant by "offset".  I meant the value
returned by get_inner_reference or stored in DECL_FIELD_BITPOS: can
the value we use as an offset from a composite variable in order to
access a component of that variable ever be negative?

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