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

            Bug ID: 66896
           Summary: ipa-prop.c:2479 runtime error: member call on null
                    pointer of type 'struct ipa_polymorphic_call_context'
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com
  Target Milestone: ---

//must be compiled with -O2 , or "-O[1] -fdevirtualize"
//ipa-prop.c:2479:30: runtime error: member call on null pointer of type
'struct ipa_polymorphic_call_context'
//gcc ipa-prop.c source line "dst_ctx->combine_with (ctx);"
//because dst_ctx is NULL
//double checked with "gcc_assert(dst_ctx);"
void f2 (void *);
void f3 ();

struct A
{
  int *a;
  A ();
  ~A () { a3 (); }
  int a1 (int * p) { if (!p) f3 (); f2 (p); }
  void a3 () { if (*a) a1 (a); }
};

struct B : A {~B () { a3 ();}};

struct F {};

struct G : F {B g;};

void foo () {G g;}

Reply via email to