int main(){
char a = -5;
char b = -6;
int c = a+b;
return 0;
}
I'm getting different results for the above code in different architectures, using gcc.
on x86 the variable c is properly sign extended and I get -11.
On some other architectures c is not sign extended, you get the result of a+b bit-casted to an int and I get 501.
Is this undefined behaviour?