PR rtl-optimization/88018
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-gcc_jit_type_get_aligned-non-power-of-two.c
blob8f3233b46ace7c758f8d89c9576588e0cfc78485
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 gcc_jit_type *int_type =
12 gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
14 /* Trigger an API error by passing a bad alignment. */
15 (void)gcc_jit_type_get_aligned (int_type, 7);
18 void
19 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
21 /* Ensure that the bad API usage prevents the API giving a bogus
22 result back. */
23 CHECK_VALUE (result, NULL);
25 /* Verify that the correct error message was emitted. */
26 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
27 ("gcc_jit_type_get_aligned:"
28 " alignment not a power of two: 7"));