[cfe-dev] A problem met during using -ftrapv
peng li
peterlee at cs.utah.edu
Fri May 28 10:01:06 PDT 2010
Hi David
I think the problem is not related to the return type. I have tested it
again after I modified the return type to "long long", the same error
still came out.
Seems that when those arithmetic operations are considered as the 64-bit
operations, this error will occur.
I tested via following simple code:
int64_t operand = -1;
int64_t test = operand - 1;
printf("test: %lld\n", test);
The same compilation error still occurred.
Regards
Peng
David Chisnall wrote:
> On 28 May 2010, at 08:28, peng li wrote:
>
>
>> void overflow_handler(long long a, long long b, char c, char d) {
>> printf("overflow occurs!\n");
>> }
>>
>> void (*__overflow_handler)(long long, long long, char, char) = overflow_handler;
>>
>
>
> The return type of these two should be long long. Not sure if this is related to your problem. The return value from this function will be truncated and used as the result of the operation.
>
> David
>
> -- Sent from my PDP-11
>
More information about the cfe-dev
mailing list