This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/27116] New: Incorrect integer division (wrong sign).
- From: "laurent at komite dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Apr 2006 10:28:15 -0000
- Subject: [Bug c/27116] New: Incorrect integer division (wrong sign).
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following test demonstrates an incorrect sign in the following division :
#include <stdio.h>
int main (void)
{
volatile long int n;
n = -2;
printf ("%ld\n", (-2147483647L - 1L) / (-n));
return 0;
}
I get a correct result with 4.0.3, and a wrong sign with snapshots 20060325 and
20060408. Also reported in debian :
http://bugs.debian.org/361883
--
Summary: Incorrect integer division (wrong sign).
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: laurent at komite dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27116