* cfgloopmanip.c (duplicate_loop_to_header_edge): Cleanup profile
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-index-not-a-numeric-type.c
bloba3540b2cb3703066418f3e84c8162a834ab03712
1 #include <stdlib.h>
2 #include <stdio.h>
4 #include "libgccjit.h"
6 #include "harness.h"
8 void
9 create_code (gcc_jit_context *ctxt, void *user_data)
11 /* Let's try to access an array at an index that isn't of a numeric
12 type and verify that the API complains about the bad type.
14 gcc_jit_rvalue *string =
15 gcc_jit_context_new_string_literal (ctxt,
16 "hello world");
18 (void)gcc_jit_context_new_array_access (
19 ctxt, NULL,
20 string, /* ptr */
21 string /* index, not of numeric type */);
24 void
25 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
27 CHECK_VALUE (result, NULL);
29 /* Verify that the correct error message was emitted. */
30 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
31 "gcc_jit_context_new_array_access:"
32 " index: \"hello world\" (type: const char *)"
33 " is not of numeric type");