aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2020-05-31 13:28:41 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2020-06-02 18:24:47 -0400
commit44564c4c811f4751daf363ca019a9f9bed702f4f (patch)
treeeb9631e477cf5657f5944924a54e56c4838c34e2 /libgcc
parent4b68cb38ddca37a14a6f2f43de3a6d396ee1bc79 (diff)
downloadgcc-44564c4c811f4751daf363ca019a9f9bed702f4f.zip
gcc-44564c4c811f4751daf363ca019a9f9bed702f4f.tar.gz
gcc-44564c4c811f4751daf363ca019a9f9bed702f4f.tar.bz2
jit: fix __builtin_unreachable [PR 95426]
PR jit/95426 reports a crash deep inside "expand" when using __builtin_unreachable via gcc_jit_context_get_builtin_function, due to BLOCK_FOR_INSN being erroneously used on a barrier within rtl_verify_bb_pointers. The root cause turns out to be that I didn't implement LANG_HOOKS_COMMON_ATTRIBUTE_TABLE and LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE for the jit "frontend". When building a decl for the builtin, the libgccjit frontend generates a chain of attributes names, but when this is passed to decl_attributes and the attributes are looked up by namespace and name within lookup_scoped_attribute_spec, attributes_table is empty. Hence no attributes were being associated with the fndecl, and so ECF_NORETURN was not set on the gimple_call (along with various other flags missing on the decl, etc), and so the call is treated as not terminating its BB, and so the CFG rapidly diverges from the equivalent created by the C frontend. This patch fixes things by implementing these langhooks, copying the minimal attribute-handling code from LTO. I stepped through the creation of the fndecl and verified that with this fix it has the same attributes as the equivalent created by the C frontend. gcc/jit/ChangeLog: PR jit/95426 * dummy-frontend.c: Include "options.h", "stringpool.h", and "attribs.h". (ATTR_EXCL): New, copied from lto/lto-lang.c. (attr_noreturn_exclusions): Likewise. (attr_returns_twice_exclusions): Likewise. (attr_const_pure_exclusions): Likewise. (jit_attribute_table): Likewise, copied from lto_attribute_table. (jit_format_attribute_table): Likewise, copied from lto_format_attribute_table. (handle_noreturn_attribute): New, copied from lto/lto-lang.c. (handle_leaf_attribute): Likewise. (handle_const_attribute): Likewise. (handle_malloc_attribute): Likewise. (handle_pure_attribute): Likewise. (handle_novops_attribute): Likewise. (get_nonnull_operand): Likewise. (handle_nonnull_attribute): Likewise. (handle_nothrow_attribute): Likewise. (handle_sentinel_attribute): Likewise. (handle_type_generic_attribute): Likewise. (handle_transaction_pure_attribute): Likewise. (handle_returns_twice_attribute): Likewise. (handle_patchable_function_entry_attribute): Likewise. (ignore_attribute): Likewise. (handle_format_attribute): Likewise. (handle_format_arg_attribute): Likewise. (handle_fnspec_attribute): Likewise. (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Define. (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Define. gcc/testsuite/ChangeLog: PR jit/95426 * jit.dg/all-non-failing-tests.h: Add note about... * jit.dg/test-builtin-unreachable.c: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions