On Fri, Apr 04, 2014 at 11:50:04AM -0600, Jeff Law wrote: > On 04/04/14 11:14, Marek Polacek wrote: > > > >So what happens here is that normally we initialize the builtins via > >c_common_nodes_and_builtins, which has: > > > > 5711 if (!flag_preprocess_only) > > 5712 c_define_builtins (va_list_ref_type_node, va_list_arg_type_node); > > > >c_define_builtins defines builtins in builtins.def, that includes even > >sanitizer.def. I guess that flag_preprocess_only was in effect due to PCH > >and we didn't define the builtins. I still haven't managed to create > >some sweet & small testcase, but I've found another ICE with PCH: > What doesn't make sense to me is I don't see where PCH sets > flag_preprocess_only. If you can point me to where that happens, > then I think we'd just need a comment that PCH turns on > flag_preprocess_only, which guards the creation of some builtins.
I'm sorry, my guess was wrong, it's not about flag_preprocess_only at all. But still it's about PCH ;). In short: we define the builtins, but PCH then removes the definitions. The thing is, we define the builtins just fine (via c_common_nodes_and_builtins -> c_define_builtins), but the problem is that later on we call c_common_read_pch that calls gt_pch_restore which "reads the state of the compiler back in from file" -- and as a part of this, it overwrites the table with defined builtins (builtin_info.decl). And so we end up with zapped table and thus it's needed to re-initialize it. I don't see an easy way how to tell PCH to not to do the removal. Marek