tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Error when manipulating doubles in stack win64


From: Christian Jullien
Subject: Re: [Tinycc-devel] Error when manipulating doubles in stack win64
Date: Thu, 20 Jan 2022 14:17:18 +0100

Hum! What is precisely the issue?

First,
typedef double float_t;

is questionable, both VC++ and gcc protest with an error:

c:\usr\jullien\openlisp>cl test.c && test.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30706 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
test.c(4): error C2371: 'float_t': redefinition; different basic types
C:\Program Files (x86)\Windows 
Kits\10\include\10.0.22000.0\ucrt\corecrt_math.h(59): note: see declaration of 
'float_t'

c:\usr\jullien\openlisp>gcc test.c -o test.exe && test.exe
test.c:4:16: error: conflicting types for ‘float_t’; have ‘double’
    4 | typedef double float_t;
      |                ^~~~~~~
In file included from test.c:1:
/usr/include/math.h:160:20: note: previous declaration of ‘float_t’ with type 
‘float_t’ {aka ‘float’}
  160 |     typedef float  float_t;
      |                    ^~~~~~~

I renamed float_t to FLOAT_T and this time cl, gcc and tcc all produce the same 
result

c:\usr\jullien\openlisp>cl test.c && test.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30706 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
Microsoft (R) Incremental Linker Version 14.30.30706.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj
>>>>> bb=8790 aa=8790
>>>>> err - =0
>>>>> err / =1

c:\usr\jullien\openlisp>gcc test.c -o test.exe && test.exe
>>>>> bb=8790 aa=8790
>>>>> err - =0
>>>>> err / =1

c:\usr\jullien\openlisp>tcc -m64 test.c -o test.exe && test.exe
>>>>> bb=8790 aa=8790
>>>>> err - =0
>>>>> err / =1

I'm using mob on Windows:
c:\usr\jullien\openlisp>tcc -v
tcc version 0.9.27 mob:4e0e9b8 (x86_64 Windows)

-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On 
Behalf Of Clement Franchini
Sent: Thursday, January 20, 2022 11:27
To: tinycc-devel@nongnu.org
Subject: [Tinycc-devel] Error when manipulating doubles in stack win64

Hi,
we encountered an issue when manipulating doubles in the last version (0.9.27) 
of tcc. It looks like the stack is not correctly managed for that type.

The joined test file compute the same values in two different ways. The results 
should be the same, but they're different.

On GNU/Linux, it works perfectly (I only tested 64 bits)

On Windows 10 (64 bits):

32bits: If I compile using -m32, it works.

64bits: if I don't specify or use -m64 it failed. I also did the test by using 
float instead of double and it works. So the problem only occurs for double on 
64 bits Windows.

Cordialement/Regards.
--
Clément Franchini




reply via email to

[Prev in Thread] Current Thread [Next in Thread]