On 08/28/2015 09:03 AM, Charles Baylis wrote:
Hi

This patch is an attempt to fix
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67280. I have written up
an analysis of the bug there.

When cgraph_node::create_wrapper() updates the callgraph for the new
function, it sets the can_throw_external flag to false, even when
wrapping a function which can throw. This causes the ipa-pure-const
phase to mark the wrapper function as nothrow which results in
incorrect unwinding tables. (more details on bugzilla)
Seems clearly wrong. I wonder if there are other properties that should be set but aren't in the thunk.


The attached patch addresses the problem in
cgraph_node::create_wrapper(). A slightly more general approach would
be to change symbol_table::create_edge() so that it checks
TREE_NOTHROW(callee->decl) when call_stmt is NULL.
I'm not well versed in the cgraph code -- my worry with this approach would be that the wrapper's state is inconsistent with what the wrapper can call. It seems cleaner to make sure these various flags are correct when we create the wrapper.


This patch passed make check with no new regressions on gcc-5-branch
on arm-linux-gnueabihf using qemu.

I will do a bootstrap on ARM hardware over the weekend. Do I also need
to test x86_64?
A bootstrap on your native target of choice is sufficient.


I plan to add a test case, but it seems it's worth getting review for
the approach in the mean time.

Thanks,
Charles


gcc/ChangeLog:

2015-08-28  Charles Baylis  <charles.bay...@linaro.org>

         * cgraphunit.c (cgraph_node::create_wrapper): Set can_throw_external
         in new callgraph edge.
Ultimately Jan's call.

Jeff

Reply via email to