[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Another ARM (RPi) compiler bug
From: |
Christian Jullien |
Subject: |
[Tinycc-devel] Another ARM (RPi) compiler bug |
Date: |
Sun, 3 Feb 2013 22:14:16 +0100 |
Wrong double -> int conversion when double is < 0
#include <stdio.h>
int
main()
{
// Ok if d >0
{
double d = 413.55;
long l = (long)d;
int i = (int)d;
printf("d=%f, i=%d (OK), l=%ld (OK)\n", d, i, l);
}
// BUG if d <0
{
double d = -413.55;
long l = (long)d;
int i = (int)d;
printf("d=%f, i=%d (BUG), l=%ld (BUG)\n", d, i, l);
}
}
jullien~/openlisp/src $ tcc foo.c && ./a.out
d=413.550000, i=414 (OK), l=414 (OK)
d=-413.550000, i=0 (BUG), l=0 (BUG)
- [Tinycc-devel] Another ARM (RPi) compiler bug,
Christian Jullien <=
- Re: [Tinycc-devel] Another ARM (RPi) compiler bug, Daniel Glöckner, 2013/02/03
- Re: [Tinycc-devel] Another ARM (RPi) compiler bug, Christian Jullien, 2013/02/04
- Re: [Tinycc-devel] Another ARM (RPi) compiler bug, Christian Jullien, 2013/02/04
- Re: [Tinycc-devel] Another ARM (RPi) compiler bug, Daniel Glöckner, 2013/02/04
- Re: [Tinycc-devel] Another ARM (RPi) compiler bug, Thomas Preud'homme, 2013/02/04
- [Tinycc-devel] RE :Re: Another ARM (RPi) compiler bug, Christian JULLIEN, 2013/02/04
- Re: [Tinycc-devel] RE :Re: Another ARM (RPi) compiler bug, Daniel Glöckner, 2013/02/04
- [Tinycc-devel] RE :Re: RE :Re: Another ARM (RPi) compiler bug, Christian JULLIEN, 2013/02/04
- Re: [Tinycc-devel] RE :Re: RE :Re: Another ARM (RPi) compiler bug, Daniel Glöckner, 2013/02/04
- Re: [Tinycc-devel] RE :Re: Another ARM (RPi) compiler bug, Thomas Preud'homme, 2013/02/05