* gcc-interface/decl.c (gnat_to_gnu_field): Do not set the alignment
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-pr63969-missing-driver.c
blob733522310debfcdd7a11f4f67deb2ae38251a3d7
1 /* PR jit/63969: libgccjit would segfault inside gcc_jit_context_compile
2 if the driver wasn't found on PATH if GCC_JIT_STR_OPTION_PROGNAME was
3 NULL. */
5 #include <stdlib.h>
6 #include <stdio.h>
8 #include "libgccjit.h"
10 #include "harness.h"
12 void
13 create_code (gcc_jit_context *ctxt, void *user_data)
15 /* Create nothing within the context. */
17 /* harness.h's set_options has set a sane value for
18 GCC_JIT_STR_OPTION_PROGNAME, but PR jit/63969 only segfaulted if it's
19 NULL.
21 Unset it. */
22 gcc_jit_context_set_str_option (ctxt, GCC_JIT_STR_OPTION_PROGNAME, NULL);
24 /* By default, we use an embedded copy of the driver.
25 Opt-in to using an external copy of the driver. */
26 gcc_jit_context_set_bool_use_external_driver (ctxt, 1);
28 /* Break PATH, so that the driver can't be found
29 by gcc::jit::playback::context::compile ()
30 within gcc_jit_context_compile. */
31 unsetenv ("PATH");
34 void
35 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
37 CHECK_VALUE (result, NULL);
39 /* Verify that a sane error message was emitted. */
40 CHECK_STRING_STARTS_WITH (gcc_jit_context_get_first_error (ctxt),
41 "error invoking gcc driver");