diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-15 19:36:42 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-15 19:36:42 +0000 |
commit | 8eb8256c8c55b5b2d2244cf59a8490a1164ed639 (patch) | |
tree | 91f8600207abbecbd0638e2f11fe8eda9705d731 | |
parent | 232364e700c961e4c7d594beffc581975ab5bcce (diff) | |
download | linaro-gcc-8eb8256c8c55b5b2d2244cf59a8490a1164ed639.tar.gz linaro-gcc-8eb8256c8c55b5b2d2244cf59a8490a1164ed639.tar.bz2 linaro-gcc-8eb8256c8c55b5b2d2244cf59a8490a1164ed639.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219681 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/jit/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/jit/libgccjit.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 |
3 files changed, 20 insertions, 0 deletions
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index d15a21424b2..70a3d5707ff 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -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 diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c index a78b3e7514c..0faf0f9529d 100644 --- a/gcc/jit/libgccjit.c +++ b/gcc/jit/libgccjit.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6b2ae3ab4d..d9525d59650 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. |