This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug plugins/62252] a callback to event PLUGIN_FINISH_TYPE segfaults


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

--- Comment #3 from klemen.jan.enova at gmail dot com ---
It works on gcc, though.

in gcc/c/c-parser.c:

>	  if (!typespec_ok)
>	    goto out;


>         invoke_plugin_callbacks (PLUGIN_FINISH_TYPE, t.spec);
>	  declspecs_add_type (loc, specs, t);

in gcc/cp/parser.c:

>      type_spec = cp_parser_class_specifier (parser);
>      invoke_plugin_callbacks (PLUGIN_FINISH_TYPE, type_spec);
>      /* If that worked, we're done.  */
>      if (cp_parser_parse_definitely (parser))
>	{
>	  if (declares_class_or_enum)
>	    *declares_class_or_enum = 2;
>	  if (decl_specs)
>	    cp_parser_set_decl_spec_type (decl_specs,
>					  type_spec,
>					  token,
>					  /*type_definition_p=*/true);
>	  return type_spec;
>	}


I see a pattern. The call to invoke_plugin_callbacks() should probably be
before something_that_adds_the_type_to_decl_spec(). Also, there is a test in
both cases (typespec_ok VS cp_parser_parse_definitely). I will try to compile
gcc with this patch, and see what comes out.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]