Re: [Mingw-w64-public] Merging lib32/*.def and lib-common/*.def files?

2024-12-09 Thread LIU Hao
在 2024-12-10 05:59, Pali Rohár 写道: What about having one def file kernel32.def.in where would be also @STDCALL suffixes and when building non-I386 variant, the build process will filter that file over sed 's/@[0-9]*$//' and then process by cpp preprocessor? (Or first process by cpp and then by se

Re: [Mingw-w64-public] [PATCH 1/6] crt: Fix __getmainargs() and __wgetmainargs() ABI for msvcrt40.dll and msvcrt.dll

2024-12-09 Thread LIU Hao
在 2024-11-28 01:33, Pali Rohár 写道: +{ + /* + * ABI of msvcrt.dll __getmainargs() function was changed in Windows XP. + * In Windows 2000 and older versions of msvcrt.dll, including the original + * Visual C++ 6.0 msvcrt.dll version, __getmainargs() has void return value This should be 'v

Re: [Mingw-w64-public] [PATCH 6/6] crt: Fix executing of functions in __xi_a[] ... __xi_z[] array

2024-12-09 Thread LIU Hao
在 2024-12-10 06:11, Pali Rohár 写道: Also the casting from function pointer which returns int to function pointer which returns void sounds like a bug in code. I guess that currently it is working only because the return value on x86 is passed via register and it can be ignored by the caller. Ye

Re: [Mingw-w64-public] [PATCH 6/6] crt: Fix executing of functions in __xi_a[] ... __xi_z[] array

2024-12-09 Thread Pali Rohár
On Wednesday 27 November 2024 18:33:37 Pali Rohár wrote: > Use _initterm_e() for executing functions in __xi_a[] ... __xi_z[] array. > This function properly stops execution on error and returns error value. > Same logic is doing Visual C++ startup code. > > This fixes error handling of function c

Re: [Mingw-w64-public] [PATCH 1/6] crt: Fix __getmainargs() and __wgetmainargs() ABI for msvcrt40.dll and msvcrt.dll

2024-12-09 Thread Pali Rohár
See one inline comment below. On Wednesday 27 November 2024 18:33:32 Pali Rohár wrote: > Visual C++ CRT DLL libraries older than VC70 / msvcr70.dll have different > ABI of __getmainargs() and __wgetmainargs() functions. Their return value > is void, instead of int. This includes VC++ libs crtdll.d

[Mingw-w64-public] Merging lib32/*.def and lib-common/*.def files?

2024-12-09 Thread Pali Rohár
Hello, I see that in mingw-w64-crt/lib32/ are lot of def files which are basically same as def files in mingw-w64-crt/lib-common/, just lib32 variants have @STDCALL suffixes. They have same set of functions (just sometimes there are arch-specific available only for I386 or similar). I was thinkin

Re: [Mingw-w64-public] Possible mingw gcc bug when testing -9223372036854775808 (2 ** 63)

2024-12-09 Thread David Grayson
Right, signed integer overflow is undefined in C. Try using -fwrapv to make the compiler treat it more sanely, or do your arithmetic using unsigned types and just cast to a signed type at the end. --David Grayson On Mon, Dec 9, 2024, 11:46 AM Hannes Domani via Mingw-w64-public < mingw-w64-public

Re: [Mingw-w64-public] Possible mingw gcc bug when testing -9223372036854775808 (2 ** 63)

2024-12-09 Thread Hannes Domani via Mingw-w64-public
Am Montag, 9. Dezember 2024 um 19:50:19 MEZ hat Johannes Khoshnazar-Thoma Folgendes geschrieben: > Hi: > > When compiling following C program: > > #include > > int main(int argc, char ** argv) > { > volatile unsigned long long a = 0; > volatile unsigned long long b = a + (1ULL << 63);

[Mingw-w64-public] Possible mingw gcc bug when testing -9223372036854775808 (2 ** 63)

2024-12-09 Thread Johannes Khoshnazar-Thoma
Hi: When compiling following C program: #include int main(int argc, char ** argv) { volatile unsigned long long a = 0; volatile unsigned long long b = a + (1ULL << 63); if (((long long) a - (long long) b) >= 0) printf("wrong\n"); else

Re: [Mingw-w64-public] powl() doesn't always return correct result.

2024-12-09 Thread sisyphus
On Mon, Dec 9, 2024 at 5:27 PM LIU Hao wrote: > > In mingw-w64 it's implemented in 'mingw-w64-crt/math/powi.def.h'. Mostly > it's because rounding > errors accumulate. > > Maybe `powl` shouldn't be implemented that way, however I don't know how > to do that correctly. > I doubt that I'd be of mu