https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64501

            Bug ID: 64501
           Summary: Unreachable catch BB for try blocks that cannot create
                    an exception of specific type
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org

Hello.

I've been wondering if following catch branch in main can be optimized out as
unreachable:

void linker_error (void);

void t()
{
  try
    {
      throw (char)(1);
    }
  catch (char t) {}
}

int
main()
{
  try
    {
      t();
    }
  catch (void *v)
    {
      linker_error ();
    }
}

As there's no possible emission of an exception of void*, can by call of
linker_error removed?

Thanks,
Martin

Reply via email to