diff options
-rw-r--r-- | gcc/jit/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/jit/jit-builtins.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/jit.dg/test-error-gcc_jit_context_get_builtin_function-unknown-builtin.c | 22 |
4 files changed, 38 insertions, 1 deletions
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index d06722c..63d8b06 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,9 @@ +2017-09-14 David Malcolm <dmalcolm@redhat.com> + + PR jit/82174 + * jit-builtins.c (matches_builtin): Ignore entries with a NULL + name. + 2017-08-18 David Malcolm <dmalcolm@redhat.com> PR tree-optimization/46805 diff --git a/gcc/jit/jit-builtins.c b/gcc/jit/jit-builtins.c index 7840915..35c4db0 100644 --- a/gcc/jit/jit-builtins.c +++ b/gcc/jit/jit-builtins.c @@ -68,7 +68,10 @@ matches_builtin (const char *in_name, const struct builtin_data& bd) { const bool debug = 0; - gcc_assert (bd.name); + + /* Ignore entries with a NULL name. */ + if (!bd.name) + return false; if (debug) fprintf (stderr, "seen builtin: %s\n", bd.name); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 005c0b9..c03547b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-09-14 David Malcolm <dmalcolm@redhat.com> + + PR jit/82174 + * jit.dg/test-error-gcc_jit_context_get_builtin_function-unknown-builtin.c: + New test case. + 2017-09-14 Pat Haugen <pthaugen@us.ibm.com> * gcc.target/powerpc/r2_shrink-wrap.c: New. diff --git a/gcc/testsuite/jit.dg/test-error-gcc_jit_context_get_builtin_function-unknown-builtin.c b/gcc/testsuite/jit.dg/test-error-gcc_jit_context_get_builtin_function-unknown-builtin.c new file mode 100644 index 0000000..b1e389c --- /dev/null +++ b/gcc/testsuite/jit.dg/test-error-gcc_jit_context_get_builtin_function-unknown-builtin.c @@ -0,0 +1,22 @@ +#include <stdlib.h> +#include <stdio.h> + +#include "libgccjit.h" + +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + gcc_jit_context_get_builtin_function (ctxt, + "this_is_not_a_builtin"); +} + +void +verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) +{ + CHECK_VALUE (result, NULL); + + CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt), + "builtin \"this_is_not_a_builtin\" not found"); +} |