From: "xi (Xi Wang)" Date: 2012-12-31T14:01:43+09:00 Subject: [ruby-core:51205] [ruby-trunk - Bug #7371] Fix undefined overflow checking in bigdecimal Issue #7371 has been updated by xi (Xi Wang). To see how it works, try to compile the following (simplified) code with gcc 4.8. The entire function will be optimized away with "gcc -O2" (just grep "bar" in the resulting assembly code); gcc 4.7 or earlier doesn't do that. #define SIGNED_VALUE long #define BASE_FIG 9 void bar(void); static void AddExponent(SIGNED_VALUE e, SIGNED_VALUE n) { SIGNED_VALUE m = e+n; SIGNED_VALUE eb, mb; if(e>0) { if(n>0) { mb = m*(SIGNED_VALUE)BASE_FIG; eb = e*(SIGNED_VALUE)BASE_FIG; if(mb0) { if(n>0) { mb = m*(SIGNED_VALUE)BASE_FIG; eb = e*(SIGNED_VALUE)BASE_FIG; if(mb