Brooks Moses wrote:
>> Any ideas? (I knew why I did not want to have a test case when I
>> originally submitted the patch.)
> It would be nice if the runtime library could error out on when the
> size overflows, without needing to rely on the result ending up negative.
I think there are two ways this can happen: (a) at compile time - and
this is what happens here - and (b) at run time. At compile time, we
might be able to create a check whether we are overflowing (this is was
happens here). [I don't know whether there is a simple way of doing so,
maybe a test if negative could be build in? Or is the size argument not
easily accessible in the front end? It is in the dumped original tree.
GMP does not seem to supported.]
For run time, I think there is no easy way. I don't have seen may
systems which offer trapping (SIGFPE) of integer overflows. (There are
some which do, as googling shows.)