From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28843 invoked by alias); 12 Dec 2015 14:49:35 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 28835 invoked by uid 89); 12 Dec 2015 14:49:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f169.google.com Received: from mail-ig0-f169.google.com (HELO mail-ig0-f169.google.com) (209.85.213.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 12 Dec 2015 14:49:33 +0000 Received: by igbxm8 with SMTP id xm8so57564162igb.1 for ; Sat, 12 Dec 2015 06:49:31 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.50.153.69 with SMTP id ve5mr9153891igb.80.1449931771494; Sat, 12 Dec 2015 06:49:31 -0800 (PST) Received: by 10.107.30.81 with HTTP; Sat, 12 Dec 2015 06:49:31 -0800 (PST) Date: Sat, 12 Dec 2015 14:49:00 -0000 Message-ID: Subject: g++-5.2.0 miscompiles a simple program From: Piotr Mitas To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-12/txt/msg00141.txt.bz2 g++-5.2.0 miscompiles the following program so badly, that gdb can't even break at the exe's entry point. $ cat main.cpp #include #include using namespace std; int main() { string s = "hello"; cout< This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-cygwin". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from a.exe...done. (gdb) info file Symbols from "/cygdrive/c/Users/piotrek/ClionProjects/untitled2/a.exe". Local exec file: `/cygdrive/c/Users/piotrek/ClionProjects/untitled2/a.exe', file type pei-x86-64. Entry point: 0x100401000 0x0000000100401000 - 0x00000001004018b0 is .text 0x0000000100402000 - 0x0000000100402088 is .data 0x0000000100403000 - 0x00000001004033d8 is .rdata 0x0000000100404000 - 0x0000000100404035 is .buildid 0x0000000100405000 - 0x00000001004050f0 is .pdata 0x0000000100406000 - 0x00000001004060b4 is .xdata 0x0000000100407000 - 0x0000000100407220 is .bss 0x0000000100408000 - 0x0000000100408518 is .idata 0x0000000100409000 - 0x00000001004094e8 is .rsrc (gdb) break *0x100401000 Breakpoint 1 at 0x100401000: file /usr/src/debug/cygwin-2.3.1-1/winsup/cygwin/crt0.c, line 23. (gdb) run Starting program: /cygdrive/c/Users/piotrek/ClionProjects/untitled2/a.exe [New Thread 8496.0x20c8] [New Thread 8496.0x1f54] [New Thread 8496.0x1084] [New Thread 8496.0x18a0] [Thread 8496.0x1f54 exited with code 3221225785] [Thread 8496.0x18a0 exited with code 3221225785] During startup program exited with code 0xc0000139. (gdb) Interestingly, compiling with -O2 (but not -O1) makes the program work correctly. I'm new to Cygwin, so perhaps there's something obvious I'm missing? -- 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