libgomp: Document 'GOMP_teams4'
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-register-variable-size-mismatch.c
blobedea50f81040896ee9eee1e8deae7e034d373c25
1 /*
3 Test that the proper error is triggered when we build a register variable
4 with a register name that doesn't exist.
6 */
8 #include <stdlib.h>
9 #include <stdio.h>
11 #include "libgccjit.h"
12 #include "harness.h"
14 void
15 create_code (gcc_jit_context *ctxt, void *user_data)
17 gcc_jit_type *int_type =
18 gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
19 gcc_jit_type *array_type =
20 gcc_jit_context_new_array_type (ctxt, NULL, int_type, 4096);
21 gcc_jit_lvalue *global_variable =
22 gcc_jit_context_new_global (
23 ctxt, NULL, GCC_JIT_GLOBAL_EXPORTED, array_type, "global_variable");
24 gcc_jit_lvalue_set_register_name(global_variable, "r12");
27 void
28 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
30 /* Ensure that the bad API usage prevents the API giving a bogus
31 result back. */
32 CHECK_VALUE (result, NULL);
34 /* Verify that the correct error message was emitted. */
35 CHECK_STRING_VALUE
36 (gcc_jit_context_get_last_error (ctxt),
37 "data type of 'global_variable' isn't suitable for a register");