X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; q=dns; s=default; b=rJ5mQQboLtNl5lvLyUuNMtCtQwZlw ijrFp3BEvtdtFsWbMARKwzCLFVkdGLCJUgWhbX3V9O/Pf8RO53l8k1BAhxzZJ/vM qnq1Fy+zuFNqV7SgSdl85rGaxdABxmzAsq1V7pkH3CtghoU6opdz5vequ265lZVl 2YhFHgvCAFaMno= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; s=default; bh=yB1HwJv5Kdr6HqHXn3xyIw3okY4=; b=b46 cwuTc9wlrcH5iIUNhfLLegbvjDBE/RSAn4neEoRk6vCGh+AG4jITlGO4LEPF1B/o jd6aZOZu2gEPcruazh4ZTwzaQX5E0Q0+cRGanjrRRUnEXeD+vOFjN4n/sjqM+oAL WIly+pA+ET4YzozQDhO7LVxh927Db9gyhs9mw0xE= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=denis, Denis, Vnoukov, combo X-HELO: NAM01-BY2-obe.outbound.protection.outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hf3r4DKZkVF6FT7G+uaSmJM+GUfODSIKgIfRqKie3QexTgXQmW1IGIatgtRQDp0O4ZReCIVQwQ99x27KJCEN6ze2j1ttzS0XQBANJ3zUgQwzaCn56JH3/rm4A0qE945ci6AtXRHT3HZDfOYtYzW68mY+8H5J++4Ji0hg3akT7ASI7/w2fMytjr0nPd4bZ9eJRs2kDWFH3fZ5PWKH8iJPxGgjSRGmODZepTFqHIDpFmPKQnxwpeoV+TRQxPT3S+rd0sa+HNic1fzQylryjHhfcI/1oEY/yj+uYpnXB4q0YnhOnX8O6AmpplEmGWzEVMTsN/vUEo25/fvFDK9iA1rovg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=onZm7LsvkGl9hL3g6EloX/0bYHgyA65DmJx0InAHH9o=; b=cgSGnFs1tkyK2GYAicyF30q2tHiLRDE87wIn3mYH4AIiq43AADk2svH3Rl7wR0sI0sD3/Pl5PCfLej/ue3db2D+72pHYcPjDpxrUAlasgPC8dmiRVSBe4fFdGmzBTBJaQj5cl1k/z3ui277kRR4jD/k33lJ7S/4FyVV4kKCgEBt7NFApAnfStUwVEoBBxfvPUJLkULnu1L9GFQkOY5J86XSb25yPuZGueTjppY7DduKnG+WwPMCkRVlFrEdRiAdcNW6vFPJmnclvJgqJjPYQ+QBftrAsj+/UPt1MGKn3Q5zxY86j/sVXYOksg34iIA7h8YiVXIY5g3wlZfRYhWBqTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=cornell.edu;dmarc=pass action=none header.from=cornell.edu;dkim=pass header.d=cornell.edu;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=onZm7LsvkGl9hL3g6EloX/0bYHgyA65DmJx0InAHH9o=; b=cMXaPBmEvDHO99sr7pqAII4FtDHwDR2El+UtqQsyiy9eClXJWJWwADgv4mmgI8M6pnY98uJq+g8C5IIjoX61F7lHJkAJCLQXNqUbFMRvdV6tGYMIAA7X/S5sJ/IvoBMpOa11ySp9tR6qnrotAMXg/n5mwlTq1AZRh43mxDS4lWg= From: Ken Brown To: "cygwin AT cygwin DOT com" CC: Denis Vnoukov Subject: Re: Combo GCC issues with bugs Date: Sat, 3 Aug 2019 18:59:06 +0000 Message-ID: References: <1564779921 DOT 24964 DOT 28908 DOT 35526 AT mail DOT rambler DOT ru> In-Reply-To: <1564779921.24964.28908.35526@mail.rambler.ru> user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown AT cornell DOT edu; x-ms-exchange-purlcount: 4 x-ms-oob-tlc-oobclassifiers: OLM:6430; received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ksb2 AT cornell DOT edu X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id x73IxlmX000313 On 8/2/2019 5:05 PM, Denis Vnoukov wrote: > Code Example: > #include > #include > #include > #include > #include > #include int main() > { > // https://github.com/msys2/MSYS2-packages/issues/1711 > char buf[50]; > char * str = gcvt(3.141592653589793238462643383279502884197169399375, 49, buf); > printf("buffer: %s", str);// https://github.com/msys2/MSYS2-packages/issues/1270 > fd_set read_fd; > FD_ZERO(&read_fd);GetTickCount64();// > https://github.com/msys2/MSYS2-packages/issues/1262 > unsigned long index; > uint64_t b = 0xbedabedadeadc0de; > _BitScanForward64(&index, b); > _BitScanReverse64(&index, b);return 0; > } > If we compile it with gcc as .c: > $ gcc main.c > main.c: In function ‘main’: > main.c:16:15: warning: implicit declaration of function ‘gcvt’ > [-Wimplicit-function-declaration] > char * str = gcvt(3.141592653589793238462643383279502884197169399375, 49, buf); > ^~~~ > main.c:16:15: warning: initialization makes pointer from integer without a cast > [-Wint-conversion] > main.c:23:2: warning: implicit declaration of function ‘GetTickCount64’; did you > mean ‘GetTickCount’? [-Wimplicit-function-declaration] > GetTickCount64(); > ^~~~~~~~~~~~~~ > GetTickCount > main.c:28:20: warning: passing argument 1 of ‘_BitScanForward64’ from > incompatible pointer type [-Wincompatible-pointer-types] > _BitScanForward64(&index, b); > ^ > In file included from /usr/include/w32api/winnt.h:27:0, > from /usr/include/w32api/minwindef.h:163, > from /usr/include/w32api/windef.h:8, > from /usr/include/w32api/windows.h:69, > from main.c:8: > /usr/include/w32api/psdk_inc/intrin-impl.h:749:1: note: expected ‘unsigned int *’ > but argument is of type ‘long unsigned int *’ > __buildbitscan(_BitScanForward64, unsigned __int64, "bsf{q %[Mask],%[Index] | > %[Index],%[Mask]}") > ^ > main.c:29:20: warning: passing argument 1 of ‘_BitScanReverse64’ from > incompatible pointer type [-Wincompatible-pointer-types] > _BitScanReverse64(&index, b); > ^ > In file included from /usr/include/w32api/winnt.h:27:0, > from /usr/include/w32api/minwindef.h:163, > from /usr/include/w32api/windef.h:8, > from /usr/include/w32api/windows.h:69, > from main.c:8: > /usr/include/w32api/psdk_inc/intrin-impl.h:756:1: note: expected ‘unsigned int *’ > but argument is of type ‘long unsigned int *’ > __buildbitscan(_BitScanReverse64, unsigned __int64, "bsr{q %[Mask],%[Index] | > %[Index],%[Mask]}") > ^ > So... > 1. gcvt function must be into stdlib.h, but we have a warning The Linux man page for gcvt says, "Marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the specification of gcvt(), recommending the use of sprintf(3) instead (though snprintf(3) may be preferable)." Cygwin's stdlib.h is consistent with this. It guards the declaration of gcvt with #if __XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112 If you really need to use gcvt, I think you probably have to #define _XOPEN_SOURCE to be 500. (I haven't tested this.) > 2. gcvt function in all standards has declaration like:char *gcvt(double number, > int ndigit, char *buf);but we have a warning about "int-conversion" and get core > dump on line:printf("buffer: %s", str); This is a consequence of the fact that gcvt hasn't been declared. I haven't looked at the rest of the warnings/errors in your message, but I suspect you can figure out the causes yourself by looking at the relevant headers and/or by looking at the result of preprocessing. You might also find the following helpful: https://cygwin.com/faq.html#faq.programming.64bitporting Ken -- 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