Assigning directly to cfun doesn't properly update the target and
optimization options for the new function, which causes trouble if we load a
function from a module that has different options than the one we were in
the middle of when the load happened. This broke the use of #pragma
optimize in 23_containers/array/iterators/begin_end.cc.
Nathan's comment in module.cc complained about the API doing too much, but
set_cfun seems to me to be exactly what we want here.
gcc/cp/ChangeLog:
* module.cc (module_state::read_cluster): Use set_cfun.
(post_load_processing): Likewise.
}
}
- /* Look, function.cc's interface to cfun does too much for us, we
- just need to restore the old value. I do not want to go
- redesigning that API right now. */
-#undef cfun
- cfun = old_cfun;
+ set_cfun (old_cfun);
current_function_decl = old_cfd;
comparing_dependent_aliases--;
DECL_EXTERNAL (decl) = false;
}
- cfun = old_cfun;
+ set_cfun (old_cfun);
current_function_decl = old_cfd;
}