Combo GCC issues with bugs

Ken Brown kbrown@cornell.edu
Sun Aug 4 15:00:00 GMT 2019


[Please don't top post on this list.]

On 8/3/2019 5:02 PM, Denis Vnoukov wrote:
> Yes, gcvt is legacy. But there is no one Linux distribution which has no gcvt in
> the world.
> Moreover gcvt present into MSVC, Intel C, mingw, etc..
> It is true to have gcvt with right declaration.
> FD_ZERO(&read_fd); <== with -Wold-style-cast produced real bogus and suspicious
> warning which looks like bug
> GetTickCount64(); <== recommended part of WINAPI and must be avail via windows.h
> _BitScanReverse64 and _BitScanForward64 must be with "unsigned long *":
> unsigned char _BitScanForward64(
> unsigned long * Index,
> unsigned __int64 Mask
> );
> due to ms specification as well...

There are several mistakes (not GCC bugs) in your program.

1. As I already said in my first message, you need to define the appropriate 
feature-test macro in order to get the declaration of gcvt.  (I suggested 
defining _XOPEN_SOURCE to 500, and that in fact works.)

2. The Microsoft documentation for GetTickCount64 says, "To compile an 
application that uses this function, define _WIN32_WINNT as 0x0600 or later." 
You didn't do this.

3. The Microsoft documentation for _BitScanForward64 says that the first 
argument is of type 'unsigned long *'.  You assumed that Microsoft's unsigned 
long would be the same size as Cygwin's.  You can avoid this problem by using 
ULONG instead of unsigned long.

I'm attaching a fixed version of your program that compiles without warnings and 
runs without crashing on 64-bit Cygwin.

Ken
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190804/fbfb2069/attachment.c>
-------------- next part --------------

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list