[Bug libgcc/100415] New: runtime error: reference binding to null pointer of type 'const struct __forced_unwind'

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 4 13:14:05 GMT 2021


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

            Bug ID: 100415
           Summary: runtime error: reference binding to null pointer of
                    type 'const struct __forced_unwind'
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <pthread.h>
#include <cxxabi.h>

int main()
{
  try
  {
    pthread_exit(0);
  } catch (const __cxxabiv1::__forced_unwind&)
  {
    throw;
  }
}

This produces a UBsan error:

$ g++ -fsanitize=undefined fu.C
$ ./a.out
fu.C:9:45: runtime error: reference binding to null pointer of type 'const
struct __forced_unwind'

Is libgcc creating a fake object at address 0?

Should __forced_unwind exceptions be caught by value instead?


More information about the Gcc-bugs mailing list