X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34D433861034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1598723892; bh=f8YV+TsQ438bo4W7Zv3MKFhj+NTfkAazWGlvHMbvtZk=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=EeoSOHfvGiFMl17fLnQKS5FsQpOejJ5Cdoe5LQjdsUgrm9CK3bySA6uGqUNzOLHA7 Xt9fuUGzuBcaceR5i0efGEvyRNnoQWj736JooHu6pHGpurfHEcFTkmXVqAx6Dv5TY3 Ap/RZzmpIDpYLO3VBhzL8cXDwDCQnOIHjLkaHNuk= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5EDC63857C64 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=loh22+rGLfWS8AYyA5oNBqQdXHvjcaxuM5g+drNoToHkscGr4CvofYgQCT17NIe7WBWn09B14nlGBuPQkS4UmgCKk5cGnyBOhh7fotS/qEmfbR4RZC5GPHKcNa1MhaBKL3U86qrbf0CD8urzQrOkT0dDvU15rPxXrBzYnw4IhYRQBQasNwm8xUg/RkmXPBTDFCUHVFlHMs6NIKjv3C3twpEpQBRvnF+WIRaKaTUC0rPaWRCUUXAFqyCJpQGHo88enMG/P3idSX9pGW3L+2c+tgx9C4dapSvp0sd8URMq6a1aONbjNWGyWNNh93rmcvmPccBqVUkkoPB5yuPeOh5Fkg== 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=8pUARY1bvDXzE8SayQQk/eykDHndvny4jvQp1avaj6E=; b=FzVTgtY94C/2S8yb27oOpxWU4QJzvDvJ0mGWhXDR4PjBsbEK/7HSyfY9BWQwL6Lah+BUvsZ9cfRS10rvqHuOkARfy3jqpRGKjQUGpriTB3/9QaOgj7QfRfOFiO4cVVkDX/IEnlAglvuKNdQitkczE6DI5zjE7Csc4e1MTI97OGi+C4EkXYjRcN9MqUKO5voWzHwUYfIG6MOZJnteUCxQF0yZ833FiC8UWA0Hagonrso3Oym9pC88yCxTptcs8PaE/QcyI7yV94GcK2RvDXEJH+43fGatmQJXu+1wiLP/BB215AGlCPvn76M3zEWHfrVBoPlDU7ZRKJkbuBWgq5opNg== 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 Subject: Re: cpp /usr/include/threads.h fails; modfl segfaults To: airplanemath , cygwin AT cygwin DOT com References: <02b16d2e-9d51-de58-807b-3b31b2565b59 DOT ref AT aol DOT com> <02b16d2e-9d51-de58-807b-3b31b2565b59 AT aol DOT com> Message-ID: <9f819e67-5476-ea48-a13f-f7a4b25d6e69@cornell.edu> Date: Sat, 29 Aug 2020 13:57:59 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 In-Reply-To: <02b16d2e-9d51-de58-807b-3b31b2565b59@aol.com> Content-Language: en-US X-ClientProxiedBy: MN2PR18CA0030.namprd18.prod.outlook.com (2603:10b6:208:23c::35) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by MN2PR18CA0030.namprd18.prod.outlook.com (2603:10b6:208:23c::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Sat, 29 Aug 2020 17:58:07 +0000 X-Originating-IP: [68.175.129.7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 097331cd-3ae9-4bed-13b2-08d84c4515a6 X-MS-TrafficTypeDiagnostic: MN2PR04MB6079: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q13Bw+lqvHZg16q4bH1H3Gant8PW+r89P5gUWsPNiYnFsCE9zfaqmEWwlssou5ja4Q3dfmNTS+HA9iO82KHWgl0PW1NlrlLjvG4tL9pHAGwG6PuaVIEgsldlaL9nmtV599PhqEtmCZrwguq0omgCErCCaqcWWncHuuNoIJqIsFx2Q6oimtBSJbgtGa+mkl3ylqQCP6Lzy2s//XaI7q5vf8a8eM3gw0TlGPVHyeQs5ceb8cRx9ujGUPTZCTnZ0G4n7vkeEyw6LWvehH7x9ZUR7feH+5mEzrfykfcVAZLr2LrveWJ0LyFuAQQa8zrxVXtxICuRq2ZYvfXxX1eNu3mgezTk3t35EhOHEn0gKXxXo/Yqks6k7INprfrJcSzLpeSCJSpmnHj0C57nwmlZbAYHaZXUEGlifznJTxGYQOBOUN+EntH3TNH2aglPV8+89RaD X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR04MB6176.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39860400002)(396003)(136003)(376002)(346002)(2906002)(478600001)(6666004)(186003)(53546011)(26005)(66556008)(36756003)(956004)(6486002)(75432002)(8676002)(8936002)(52116002)(66476007)(66946007)(86362001)(316002)(786003)(2616005)(5660300002)(31686004)(31696002)(16576012)(43740500002)(460985005)(2480315003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: lGuRory10GlhETX7DrpQ0hcU0W16pcVChzGihp3/HfP0YiXXmPK1myvQQi6brJg8cKs1c6IHn8Vd4RT5v06Li3KyHqANZnqCxodxU+dGp2vsasIe/9CPFjJYAX7a+ASpAQqw2cbN9TekVo+vvjWgZuAmWiRpBGE1W2EfsjC2PWyuw1hXyPaFZcCYsnYN6trYaA+f1LdrNd1ZlM0AtsvXXBfCyhPhhz+HDKEYJc5TCC8zBujEPtg5gfMeaay0KT8A6WdTzN78biKGNqgNRrOTOhV8D0J05kN/lr7e92flfSTQrojWhTc5vJtffhkJbG10gHzo4xXvhpRoDeJyqqAjdlfy6W/Ax5mAELiDuWdZcUYw+sIfCGBC3I07o5c5HB6ByIOUnyRfjxvC7NIw8AvoM2znu6SfsetsQrV/q6gIjK0ufb8T/7TIciiAGAF6NoOKx0KcN079hzzKoEU7HQIdmNDD77Zuiidh4uEamzqpUQ8sHSp+T7zQdbOoeavDPeZPPM54Io2UsEXjHqJnhQwIukYVqRb/VeW4MNyD0c3klEf24J5m1gASWkaJi0YWYCMuS3BwVtChN4OI2yLSAb+D17xNn32iTqIUdYW8sjKLkD0Dr+VEg7OKgHC1HYjbKuy4OnAymFZofj1yX3pAMDaynw== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 097331cd-3ae9-4bed-13b2-08d84c4515a6 X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2020 17:58:07.5363 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CL+7mJL6AdVol1+HWndjqQVxUBok7wUppCe3iHrSkU0jPvmCkckFzEdqMwS+yn8CYmATs2I8TNEqxmX7/0Nv3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6079 X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_ILLEGAL_IP, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Ken Brown via Cygwin Reply-To: Ken Brown Content-Type: text/plain; charset="windows-1252"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 07THwfaW025659 On 8/29/2020 8:52 AM, airplanemath via Cygwin wrote: > Hello, > > I have two reports.  A brief description of the system: > $ uname -a | sed "s/${HOSTNAME}/\${HOSTNAME}/g" > CYGWIN_NT-10.0 ${HOSTNAME} 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin In the future, please use two separate emails for two unrelated bug reports. > The first report: > > $ cpp /usr/include/threads.h > # 1 "/usr/include/threads.h" > # 1 "" > # 1 "" > # 1 "/usr/include/threads.h" > /usr/include/threads.h:30:10: fatal error: machine/_threads.h: No such > file or directory >    30 | #include >       |          ^~~~~~~~~~~~~~~~~~~~ > compilation terminated. > > $ cygcheck -p machine/_threads.h > Found 0 matches for machine/_threads.h It looks like /usr/include/threads.h is a Newlib header that's intended for RTEMS. Here's the commit where it was introduced: commit c98d01ee0cbc6eb7bbca8f2cde4a46b90ded3784 Author: Jeff Johnston Date: Tue Oct 13 17:52:34 2015 -0400 Import from latest FreeBSD. - Move types and defines to so that it can be customized per target. * libc/include/threads.h: New. * libc/sys/rtems/include/machine/_threads.h: Likewise. There's no machine/_threads.h in the repository for any platform other than RTEMS. My guess is that it shouldn't be included in the Cygwin distro. > The second report: > > $ cat test.c > #include > #include > #include > > int main(int argc, char *argv[]) { >   long double a, b, c; >   char *num_end = NULL; >   a = b = c = 0.0L; >   if (argc != 2) { >     fprintf(stderr, "Usage: %s NUMBER\n", argv[0]); >     exit(1); >   } >   a = strtold(argv[1], &num_end); >   b = modfl(a, &c); >   printf("%Lf %Lf %Lf\n", a, b, c); >   return 0; > } > > $ gcc -Og -ggdb -g3 -Wall -Wextra -std=c99 -pedantic test.c -o test.exe > > $ ./test.exe 123.456 > Segmentation fault (core dumped) > > $ gdb --args ./test.exe 123.456 > GNU gdb (GDB) (Cygwin 8.3.1-1) 8.3.1 > ... > Reading symbols from ./test.exe... > (gdb) break modfl > (gdb) run > Starting program: /home/Daniel/test.exe 123.456 > [New Thread 13960.0x3cf4] > [New Thread 13960.0xbdc] > [New Thread 13960.0x4028] > [New Thread 13960.0x3224] > [New Thread 13960.0x3810] > [New Thread 13960.0x1ae4] > [New Thread 13960.0x3714] > [Thread 13960.0x4028 exited with code 3697672192] > [Thread 13960.0x3714 exited with code 0] > > Thread 1 "test" hit Breakpoint 1, modfl (value=, > iptr=iptr AT entry=0xffffcbd0) at > /usr/src/debug/cygwin-3.1.7-1/winsup/cygwin/math/modfl.c:16 > 16        asm ("subq $8, %%rsp\n" > (gdb) step > 38        if (iptr) > (gdb) step > 39          *iptr = int_part; > (gdb) step > 40        return (isinf (value) ?  0.0L : value - int_part); > (gdb) step >       0 [main] test 28439 cygwin_exception::open_stackdumpfile: Dumping > stack trace to test.exe.stackdump > [Thread 13960.0x3b5c exited with code 35584] > [Thread 13960.0x1ae4 exited with code 35584] > [Thread 13960.0x3810 exited with code 35584] > [Thread 13960.0xbdc exited with code 35584] > [Thread 13960.0x3cf4 exited with code 35584] > [Inferior 1 (process 13960) exited with code 0105400] > (gdb) > > isinf and isinfl both work just fine, so I'm not sure what's going on there. I built a version of cygwin1.dll without optimization in the hopes of making debugging easier, but the problem doesn't occur with that DLL. So this is somehow tied up with optimization. BTW, isinf is a macro that expands to __builtin_isinf_sign, again suggesting that optimization is involved. That's as far as I can take it. Ken -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple