Compile the following C program for x86 (mingw, i686) using "gcc -ftrapv -S -O0 <filename>" (Note: Includes omitted for brevity; GCC will warn. Including stdio.h or stdlib.h does not fix the bug):
printf("Enter two signed int values: ");
printf("\na + b = %d, a * b = %d, a - b = %d\n",a+b,a*b,a-b);
The assembly listing produced does not include a call to __addvsi3. It does, however, contain calls to __subvsi3 and __mulvsi3. This occurs at all optimisation levels with GCC 4.0.2.
I also tested this with GCC 3.4.0 (RedHat Linux 9, i686). The call to __addvsi3 is correctly done at -O0 and -O1, but not at any higher optimisation levels, where it is replaced by an explicit "addl".
*** This bug has been marked as a duplicate of 19020 ***