Failed assertion dialog box

William M. (Mike) Miller william.m.miller@gmail.com
Sun Nov 15 13:12:23 GMT 2020


On Sat, Nov 14, 2020 at 11:49 PM Duncan Roe <duncan_roe@optusnet.com.au>
wrote:

> On Fri, Nov 13, 2020 at 11:21:12PM -0500, cygwin wrote:
> > On Fri, Nov 13, 2020 at 10:45 PM Duncan Roe <duncan_roe@optusnet.com.au>
> > wrote:
> >
> > > Hi William,
> > >
> > > On Fri, Nov 13, 2020 at 12:27:57PM -0500, cygwin wrote:
> > > > I've run into a problem running a collection of tests under Cygwin
> and I
> > > > wonder if anyone can suggest a way around it.
> > > >
> > > > The problem occurs when a program being run fails a C/C++ runtime
> > > > assertion. Ordinarily, this just writes an error message on stderr
> and
> > > > aborts. Under Cygwin, however, if both stdin and stderr are
> redirected to
> > > > files, the program instead pops up a dialog box that must be
> > > interactively
> > > > dismissed before the failed program will exit - holding up all the
> tests
> > > > that follow it.
> > > >
> > > > Specifically, if I have the following as assert.cpp:
> > > >
> > > >     #include <assert.h>
> > > >     int main() {
> > > >       assert(false);
> > > >     }
> > > >
> > > > and say
> > > >
> > > >     gcc assert.cpp
> > > >     ./a.exe < /dev/null > output 2>&1
> > > >
> > > > I get an error dialog box saying
> > > >
> > > >     Failed assertion
> > > >         false
> > > >     at line 3 of file assert.cpp
> > > >     in function int main()
> > > >
> > > > If I omit either the stdin or the stderr redirection, the program
> behaves
> > > > as desired with no dialog box.
> > > >
> > > > Is there an environment setting or compiler command-line option I can
> > > give
> > > > to suppress the dialog box and always just write a message to stderr
> and
> > > > abort? Thanks for any insights.
> > >
> > > Your example WFFM, (Cygwin64, gcc 10.2.0, everything else also up to
> date).
> > >
> > > Do you still see this behaviour if you run the installer?
> > >
> >
> > Thanks for your reply; unfortunately, yes, it does. I had refreshed
> > the installation fairly recently, and running the installer only updated
> a
> > few things, not cygwin.dll and not gcc; my installation is the same as
> > yours. I've tried it with three different shells (tcsh, bash, mksh) and
> > with both gcc and clang, and all have the same behavior. (Interestingly,
> if
> > I compile the example with MSVC and run it in a Cygwin shell, it does
> _not_
> > pop up an error dialog box, so presumably it's in the Cygwin runtime,
> > specifically the definition of __assert_func.)
>
> Sorry, should have mentioned running on Win7 Home.
>
> When I try it on my wife's Win10 system, I get the dialog box same as you.
>

That's disappointing. Thanks for the additional information, though.

-- 
William M. (Mike) Miller | Edison Design Group
william.m.miller@gmail.com


More information about the Cygwin mailing list