I'm still looking in ISO standard if there is a note on this conversion.
Anyway, tcc behaves differently from gcc (and *all* other compiler I know
where is conversion truncates) while tcc rounds

#include <stdio.h>
int
main()
{
        {
        double d = 206.6;
        int i = (int)d;
        printf("%f %d\n", d, i);
        }
        {
        double d = -206.6;
        int i = (int)d;
        printf("%f %d\n", d, i);
        }
}

jullien ~/openlisp-10.0.0/src $ tcc -o foo foo.c && ./foo
206.600000 207
-206.600000 -207
jullien ~/openlisp-10.0.0/src $ gcc -o foo foo.c && ./foo
206.600000 206
-206.600000 -206

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Christian Jullien
Sent: lundi 4 février 2013 07:24
To: [email protected]
Subject: Re: [Tinycc-devel] Another ARM (RPi) compiler bug

Thx Daniel,
This one is fixed (was related to round function in my OpenLisp code) yet my
non-regression test shows now a bug in truncate (probably a similar bug).
I'm going to isolate this bug.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Daniel Glöckner
Sent: dimanche 3 février 2013 23:52
To: [email protected]
Subject: Re: [Tinycc-devel] Another ARM (RPi) compiler bug

On Sun, Feb 03, 2013 at 10:14:16PM +0100, Christian Jullien wrote:
> Wrong double -> int conversion when double is < 0

Should be fixed as well now.
Same type of error. Must have had a bad day.

  Daniel

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to