This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/27116] New: Incorrect integer division (wrong sign).


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]