public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: JonY <10walls@gmail.com>
To: cygwin@cygwin.com
Subject: Re: unhandled C++ exceptions not propagating
Date: Sun, 16 Aug 2020 03:25:43 +0000	[thread overview]
Message-ID: <85e96870-818a-78a5-e78a-d1cfa48772ee@gmail.com> (raw)
In-Reply-To: <vritk0xzfpk6.fsf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1714 bytes --]

On 8/15/20 11:38 PM, David McFarland via Cygwin wrote:
> 
> I was just debugging a c++ app (b2 build system from boost), and noticed
> that it would appear to exit unexpectedly without an error.  This turned
> out to be when an unhandled C++ exception was thrown.
> 
> On a fresh install of cygwin with gcc-g++, this program will throw an
> exception from the std::string constructor:
> 
> c++ -x c++ - <<END
> #include <string>
> int main() { std::string str(nullptr); return 0; }
> END
> 
> When it's executed from the shell it returns zero, but execution stops
> at the exception.
> 
> $ ./a; echo $?
> 0
> 
> When executed under gdb, the exception is caught, and the process exits
> non-zero when continued:
> 
> (gdb) r
> Starting program: /home/corngood/a
> [New Thread 4300.0x1390]
> [New Thread 4300.0x1d24]
> [New Thread 4300.0x1d48]
> [New Thread 4300.0x80c]
> gdb: unknown target exception 0x20474343 at 0x7ff8d2cfa799
> Thread 1 "a" received signal ?, Unknown signal.
> 0x00007ff8d2cfa799 in RaiseException () from /cygdrive/c/WINDOWS/System32/KERNELBASE.dll
> (gdb) c
> Continuing.
> [Thread 4300.0x1d24 exited with code 541541187]
> [Thread 4300.0x1870 exited with code 541541187]
> [Thread 4300.0x1d48 exited with code 541541187]
> [Thread 4300.0x1390 exited with code 541541187]
> [Inferior 1 (process 4300) exited with code 04021641503]
> (gdb)
> 
> When executed under strace, it exits with an error as expected:
> 
> $ strace -o /dev/null a; echo $?
> 67
> 
> That's as far as I've investigated so far.

Can you try if different (older) GCC versions exhibit the same problem?
You'll need to recompile your example with said version as well.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-08-16  3:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15 23:38 David McFarland
2020-08-16  3:25 ` JonY [this message]
2020-08-16  3:53 ` Takashi Yano
2020-08-16 13:21   ` Ken Brown
2020-08-16 13:52     ` Takashi Yano
2020-08-16 14:56       ` Ken Brown
2020-08-16 22:38         ` Ken Brown
2020-08-17 17:36           ` [Attn: gcc maintainers] " Ken Brown
2020-08-17 18:13             ` Corinna Vinschen
2020-08-17 18:44               ` Achim Gratz
2020-08-17 19:06               ` Ken Brown
2020-08-17 20:40                 ` Ken Brown
2020-08-17 20:50                   ` Ken Brown
2020-08-18  0:09                     ` JonY
2020-08-18  0:20                       ` Ken Brown
2020-08-18  1:46                         ` JonY
2020-08-16 14:17   ` David McFarland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85e96870-818a-78a5-e78a-d1cfa48772ee@gmail.com \
    --to=10walls@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).