[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pure64 & -ftrapv



On Mon, Jan 17, 2005 at 07:37:37PM +1300, Adam Warner wrote:
> Hi all,
> 
> I'm enjoying Debian pure64. It's astonishing how many applications have
> been correctly ported. Many thanks for all the fantastic work!
> 
> #include <stdio.h>
> #include <stdint.h>
> 
> int32_t a=0x7FFFFFFF;
> 
> int main(void) {
>   printf("a+1=%i\n", a+1);
>   return 0;
> }
> 
> The above code compiled with gcc-3.3, gcc-3.4 and gcc-4.0 (pulled in from
> gcc-3.4 experimental) and the -ftrapv option prints a+1=-214748364 each
> time. It should abort.

It returns:
a+1=-2147483648

No matter what I tried.
Or did you make an error in pasting the result and lost the 8?

-2147483648 is the result you should expect, but I assume your
problem is that it's not generating a trap?

> Once this works I going to attempt catching signed integer overflow to
> promote dynamically typed signed 32-bit integer arithmetic to signed
> 64-bit.
[...]

Do you still have a question here?  I'm not really sure what
you're all talking about.  Are you talking about people using an
int to store a pointer in?


Kurt



Reply to: