Question about __builtin_add_overflow and friends

Scotty sbauer@eng.utah.edu
Thu Apr 23 05:42:00 GMT 2015


This link https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html says "As the addition is performed in infinite signed precision, these built-in functions have fully defined behavior for all argument values. "

I'm curious if these types of builtins are well defined for things like the following:

int a, b;
a = 5;
b = 10;
__builtin_add_overflow(a,b,&a);

Notice the re-use of the variable a. I'm wondering if there is a sequencing issue and we need to use a third variable for the storage or if this is fine as well.


Thanks,
Scotty



More information about the Gcc-help mailing list