[PATCH, PR 50744] Prevent overflows in IPA-CP
Jan Hubicka
hubicka@ucw.cz
Thu Dec 1 17:03:00 GMT 2011
> On Thu, Dec 01, 2011 at 05:16:21PM +0100, Jan Hubicka wrote:
> > > This introduces host-dependent code generation differences, right?
> > > You can simply use int64_t for code that is run on the host only.
> >
> > Well, if we rely on int64_t being around now (that is probably the case with
> > C++ switch), HOST_WIDEST_INT is always equivalent, isn't it?
>
> I don't think that is related to C++ switch, because C++03 doesn't have long long,
> only C++11 and C99 has it. We apparently are using int64_t or uint64_t in a
> couple of places already though:
>
> lto-streamer-out.c: uint64_t size;
> lto-streamer-out.c: ? (uint64_t) int_size_in_bytes (TREE_TYPE (t))
> lto-streamer-out.c: : (((uint64_t) TREE_INT_CST_HIGH (DECL_SIZE_UNIT (t))) << 32)
> ada/tb-gcc.c: uwx_get_reg ((struct uwx_env *) uw_context, UWX_REG_IP, (uint64_t *) &pc);
> lto/lto.c:int64_t
> lto/lto.c: uint64_t ret = 0;
> lto/lto.c: int64_t offset;
> lto/lto.h:int64_t lto_parse_hex (const char *p);
Yep, all is relatively new code.
I originally suggested HOST_WIDEST_INT to Martin since bootstrapped compiler
will have it 64bit and the overflow happens only in very extreme case where
function pass constant arguments very many times.
int65_t would work for me too.
Honza
>
> Jakub
More information about the Gcc-patches
mailing list