This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug plugins/62252] a callback to event PLUGIN_FINISH_TYPE segfaults
- From: "klemen.jan.enova at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 24 Aug 2014 20:29:00 +0000
- Subject: [Bug plugins/62252] a callback to event PLUGIN_FINISH_TYPE segfaults
- Auto-submitted: auto-generated
- References: <bug-62252-4 at http dot gcc dot gnu dot org/bugzilla/>
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.