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:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=d3lRHkEWWykjIj+299CNki1Exbduh ab93PTFW6R/QQ5v2gGrcgfnB8uId4PEBzFyEgWgc3+MOCga5r4pV1r9Tu3ijKOvh 9bsqNIA/5rJtru7QX9B6WH+XqKRLzBoKJ7cdYiEt4gL/zWnFf4mswbxqY/CJIOSx ML+mdIPZp6AcpM= 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:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=1mJCyTYlQkrVsGoA8jwlEi702XU=; b=O9V RRlmx2fHZb8tm+q+RTG78nOZI1VAr/mW1CeWUf+d4OlA0m4M8dMd1UoQeY7jclJN ha/1jMp64Fg7k3fy8xh1AzyWTOW65xczJwRVigvNU9xpSYfwXqt17larZ7/y9/tT RAyZ0XP0CS5HitOOeIcpGiXzEJVPL45gCqway82A= 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-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 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) Date: Sat, 12 Dec 2015 15:49:31 +0100 Message-ID: Subject: g++-5.2.0 miscompiles a simple program From: Piotr Mitas To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 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