I've committed the following fixes to the dmalcolm/jit branch: (Found via fuzz testing)
gcc/jit/ * internal-api.c (gcc::jit::function::add_eval): Handle non-NULL locations. (gcc::jit::context::handle_locations): Fix test for the various kinds of declarations, replacing use of DECL_MINIMAL_CHECK, which aborts on failure (such as if we saw a type). * libgccjit.h (GCC_JIT_BOOL_OPTION_DEBUGINFO): Fix out-of-date comment. --- gcc/jit/ChangeLog.jit | 10 ++++++++++ gcc/jit/internal-api.c | 6 ++++-- gcc/jit/libgccjit.h | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit index 6308c6d..30664be 100644 --- a/gcc/jit/ChangeLog.jit +++ b/gcc/jit/ChangeLog.jit @@ -1,3 +1,13 @@ +2013-10-24 David Malcolm <dmalc...@redhat.com> + + * internal-api.c (gcc::jit::function::add_eval): Handle non-NULL + locations. + (gcc::jit::context::handle_locations): Fix test for the various + kinds of declarations, replacing use of DECL_MINIMAL_CHECK, + which aborts on failure (such as if we saw a type). + * libgccjit.h (GCC_JIT_BOOL_OPTION_DEBUGINFO): Fix out-of-date + comment. + 2013-10-23 David Malcolm <dmalc...@redhat.com> * internal-api.c: Update for rename of tree-flow.h to tree-cfg.h diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c index 574aef0..b21aaa6 100644 --- a/gcc/jit/internal-api.c +++ b/gcc/jit/internal-api.c @@ -883,10 +883,12 @@ gcc::jit::function:: add_eval (location *loc, rvalue *rvalue) { - gcc_assert (NULL == loc); gcc_assert (rvalue); gcc_assert (m_kind != GCC_JIT_FUNCTION_IMPORTED); + if (loc) + set_tree_location (rvalue->as_tree (), loc); + tsi_link_after (&m_stmt_iter, rvalue->as_tree (), TSI_CONTINUE_LINKING); } @@ -1444,7 +1446,7 @@ handle_locations () /* This covers expressions: */ if (CAN_HAVE_LOCATION_P (t)) SET_EXPR_LOCATION (t, srcloc); - else if (DECL_MINIMAL_CHECK (t)) + else if (CODE_CONTAINS_STRUCT(TREE_CODE(t), TS_DECL_MINIMAL)) DECL_SOURCE_LOCATION (t) = srcloc; else { diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index f058162..0712533 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -144,8 +144,8 @@ enum gcc_jit_bool_option be able to inspect variables and step through your code. Note that you can't step through code unless you set up source - location information for the code, and that isn't yet supported - in the API. */ + location information for the code (by creating and passing in + gcc_jit_location instances). */ GCC_JIT_BOOL_OPTION_DEBUGINFO, /* If true, gcc_jit_context_compile will dump its initial "tree" -- 1.7.11.7