So i've been running a C code with an unsigned integer value set to 4294967295 which is the maximum value that can be stored in an unsigned int variable in C . Upon adding the value of 2147483648 to it in the statement of (v+=2147483648 ;) and then using gdb to disassemble the compiled executable file of this code in order to check the eflags after running this exact statement , I get a Carry flag (CF) which understandably will show up since we went out of range of unsigned numbers in this addition , but why exactly do we get an overflow flag (OF) ? I do understand that computers don't care about them being signed or unsigned and have their own way of interpreting wheather we got an overflow flag or a carry or both . I just want to know the mechanism on which it decided to give an overflow flag in addition to a carry flag .
So Here is a screenshot of that C program that i compiled and disassembled back with gdb The C code , and after running the line where v is added to that big value i end up getting both a Carry flag and an Overflow flag gdb disassembled C code view . whats the reason for getting the Overflow flag in particular ? Here is the Assembly code for further details Assembly disassembled code