PR jit/66783: prevent use of opaque structs
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 7 Jul 2015 19:29:58 +0000 (19:29 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 7 Jul 2015 19:29:58 +0000 (19:29 +0000)
commit3457d39ea5c16b07c5e1a1d4691b1db27f1e5223
tree4e27cf9de6ad3f9acd2c9a0c0386dbab0e1f4e2e
parentbada4bed71933a5170b41585b6fb52a45eaf5e8a
PR jit/66783: prevent use of opaque structs

gcc/jit/ChangeLog:
PR jit/66783
* jit-recording.h: Within namespace gcc:jit::recording...
(type::has_known_size): New virtual function.
(struct_has_known_size): New function.
* libgccjit.c (gcc_jit_context_new_field): Verify that the type
has a known size.
(gcc_jit_context_new_global): Likewise.
(gcc_jit_function_new_local): Likewise.

gcc/testsuite/ChangeLog:
PR jit/66783
* jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c: New
test case.
* jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c:
New test case.
* jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c:
New test case.
* jit.dg/test-error-mismatching-types-in-call.c (create_code):
Avoid using an opaque struct for local "f".

From-SVN: r225523
gcc/jit/ChangeLog
gcc/jit/jit-recording.h
gcc/jit/libgccjit.c
gcc/testsuite/ChangeLog
gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_field-opaque-struct.c [new file with mode: 0644]
gcc/testsuite/jit.dg/test-error-gcc_jit_context_new_global-opaque-struct.c [new file with mode: 0644]
gcc/testsuite/jit.dg/test-error-gcc_jit_function_new_local-opaque-struct.c [new file with mode: 0644]
gcc/testsuite/jit.dg/test-error-mismatching-types-in-call.c