jit: prevent ICE with type mismatch in gcc_jit_block_add_assignment_op

gcc/jit/ChangeLog:
	* libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
	lvalue and the rvalue are of compatible type.

gcc/testsuite/ChangeLog:
	* jit.dg/test-error-mismatching-types-in-assignment-op.c: New
	test case.

From-SVN: r219681
This commit is contained in:
David Malcolm 2015-01-15 19:36:42 +00:00 committed by David Malcolm
parent 548c43e724
commit 96a8798199
3 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2015-01-15 David Malcolm <dmalcolm@redhat.com>
* libgccjit.c (gcc_jit_block_add_assignment_op): Check that the
lvalue and the rvalue are of compatible type.
2015-01-13 David Malcolm <dmalcolm@redhat.com>
* docs/cp/topics/contexts.rst (Debugging): Add

View File

@ -1900,6 +1900,16 @@ gcc_jit_block_add_assignment_op (gcc_jit_block *block,
"unrecognized value for enum gcc_jit_binary_op: %i",
op);
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
RETURN_IF_FAIL_PRINTF4 (
compatible_types (lvalue->get_type (),
rvalue->get_type ()),
ctxt, loc,
"mismatching types:"
" assignment to %s (type: %s) involving %s (type: %s)",
lvalue->get_debug_string (),
lvalue->get_type ()->get_debug_string (),
rvalue->get_debug_string (),
rvalue->get_type ()->get_debug_string ());
gcc::jit::recording::statement *stmt = block->add_assignment_op (loc, lvalue, op, rvalue);

View File

@ -1,3 +1,8 @@
2015-01-15 David Malcolm <dmalcolm@redhat.com>
* jit.dg/test-error-mismatching-types-in-assignment-op.c: New
test case.
2015-01-15 Mike Stump <mikestump@comcast.net>
* gcc.dg/inline_1.c: Rename gcc.dg/inline_[1-4].c to inline-3[6-9].c.