[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2010-02-19 Thread vincent at vinc17 dot org
--- Comment #11 from vincent at vinc17 dot org 2010-02-19 13:08 --- (In reply to comment #10) This issue was discussed on the WG14 reflector in October 2008, and the general view was that the standard should not make INT_MIN % -1 well defined (as this would impose a significant

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2009-02-21 Thread jsm28 at gcc dot gnu dot org
--- Comment #10 from jsm28 at gcc dot gnu dot org 2009-02-21 18:45 --- This issue was discussed on the WG14 reflector in October 2008, and the general view was that the standard should not make INT_MIN % -1 well defined (as this would impose a significant performance cost on many

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2008-09-12 Thread nightstrike at gmail dot com
--- Comment #7 from nightstrike at gmail dot com 2008-09-12 20:32 --- *** Bug 37503 has been marked as a duplicate of this bug. *** -- nightstrike at gmail dot com changed: What|Removed |Added

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2008-09-12 Thread jsm28 at gcc dot gnu dot org
--- Comment #9 from jsm28 at gcc dot gnu dot org 2008-09-12 20:41 --- Note libgcc functions would only need to get it right for CPUs defining the macro, if in other cases the source checks would be inserted anyway. Or the macro could depend on the mode of the division/modulo operation.

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2008-09-12 Thread jsm28 at gcc dot gnu dot org
--- Comment #8 from jsm28 at gcc dot gnu dot org 2008-09-12 20:39 --- I suggest an option such as -fdivide-checks, off by default. -std=c99 and other conformance options, for languages where INT_MIN % -1 is defined, would enable this option unless -fno-divide-checks is specified by the

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2007-01-17 Thread veksler at il dot ibm dot com
--- Comment #6 from veksler at il dot ibm dot com 2007-01-17 08:49 --- (In reply to comment #0) The program below shows (at all the optimization levels) a miscompilation of the remainder expression that causes INT_MIN % -1 to cause a SIGFPE on CPUs of the i386 family. For the record

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2007-01-16 Thread vincent at vinc17 dot org
--- Comment #1 from vincent at vinc17 dot org 2007-01-16 22:03 --- Is this specific to x86? On PowerPC (gcc 4.0.1 from Mac OS X), I get: -2147483648 % -1 - -2147483648 Ditto with: #include limits.h #include stdio.h int main (void) { volatile int i = INT_MIN, j = -1; printf

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2007-01-16 Thread vincent at vinc17 dot org
--- Comment #2 from vincent at vinc17 dot org 2007-01-16 22:10 --- -2147483648, this was on a G5, with gcc 4.0.1 under Mac OS X. On a G4 under Linux, with gcc 4.1.2 prerelease (Debian), I get 2147483647. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30484

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2007-01-16 Thread pinskia at gcc dot gnu dot org
--- Comment #3 from pinskia at gcc dot gnu dot org 2007-01-16 22:11 --- (In reply to comment #1) Is this specific to x86? On PowerPC (gcc 4.0.1 from Mac OS X), I get: This is because the PPC ISA says for divide: If an attempt is made to perform either of the divisions -- 0x8000_ /

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2007-01-16 Thread pinskia at gcc dot gnu dot org
--- Comment #4 from pinskia at gcc dot gnu dot org 2007-01-16 22:15 --- (In reply to comment #3) So the ISA in fact even mentions this case :). But the PPC compiler writers guide does not talk about that case, hmmm. -- pinskia at gcc dot gnu dot org changed: What

[Bug target/30484] Miscompilation of remainder expressions on CPUs of the i386 family

2007-01-16 Thread jv244 at cam dot ac dot uk
--- Comment #5 from jv244 at cam dot ac dot uk 2007-01-17 07:14 --- (In reply to comment #0) The program below shows (at all the optimization levels) a miscompilation of the remainder expression that causes INT_MIN % -1 to cause a SIGFPE on CPUs of the i386 family. notice that this