public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56742] New: Optimization bug lead to uncaught throw
@ 2013-03-26 15:56 ktietz at gcc dot gnu.org
  2013-03-26 15:59 ` [Bug c++/56742] " ktietz at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: ktietz at gcc dot gnu.org @ 2013-03-26 15:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56742

             Bug #: 56742
           Summary: Optimization bug lead to uncaught throw
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ktietz@gcc.gnu.org
            Target: x86_64-w64-mingw32, x86_64-pc-cygwin


Hi,

the following testcase:

#include <string>

static int main_worker(int argc)
{
  std::string s[32]; // [31] => no segfault
  if (argc < 2)
    throw 42;
  return argc;
}

int main(int argc, char **argv)
{
  try {
    return main_worker(argc);
  }
  catch (int i) {
    return i;
  }
}

produces with optimization -O2 on execution the message:
 "terminate called after throwing an instance of 'int'"
and abort gets called.

If compiled with optimization level -O1, execution works as expected.


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-01-14 21:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-26 15:56 [Bug c++/56742] New: Optimization bug lead to uncaught throw ktietz at gcc dot gnu.org
2013-03-26 15:59 ` [Bug c++/56742] " ktietz at gcc dot gnu.org
2013-03-26 20:11 ` pinskia at gcc dot gnu.org
2013-03-26 21:14 ` ktietz at gcc dot gnu.org
2013-03-26 23:43 ` steven at gcc dot gnu.org
2013-03-27  9:40 ` ktietz at gcc dot gnu.org
2013-03-27 13:48 ` [Bug rtl-optimization/56742] " jason at gcc dot gnu.org
2013-03-27 14:43 ` ktietz at gcc dot gnu.org
2013-03-27 14:50 ` [Bug rtl-optimization/56742] [4.8 regression] " ktietz at gcc dot gnu.org
2013-04-26 18:16 ` jakub at gcc dot gnu.org
2013-05-22 20:54 ` [Bug rtl-optimization/56742] [4.8/4.9 " rth at gcc dot gnu.org
2013-05-22 20:55 ` rth at gcc dot gnu.org
2013-05-22 20:57 ` rth at gcc dot gnu.org
2013-05-22 23:19 ` rth at gcc dot gnu.org
2013-05-31 23:18 ` rth at gcc dot gnu.org
2014-01-14 21:15 ` g63marty at yahoo dot com
2014-01-14 21:20 ` g63marty at yahoo dot com

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).