jit: handle equality of function pointer types
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 28 Sep 2017 16:00:57 +0000 (16:00 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Thu, 28 Sep 2017 16:00:57 +0000 (16:00 +0000)
commit5a47aa2c8c36571a51552e46f3d971c107d5bf88
tree5896869c2602163e4d7f534581d112054601d4e2
parentf276c46cd81d7a0008c696ddb75638dc6aa25f92
jit: handle equality of function pointer types

gcc/jit/ChangeLog:
* jit-recording.c
(gcc::jit::recording::function_type::is_same_type_as): New function.
* jit-recording.h: In namespace gcc::jit::recording::
(type::accepts_writes_from): Use is_same_type_as rather than pointer
equality.
(type::is_same_type_as): New virtual function.
(function_type::is_same_type_as): New override.

gcc/testsuite/ChangeLog:
* jit.dg/test-error-mismatching-types-in-assignment-fn-ptr.c: New
test case.
* jit.dg/test-returning-function-ptr.c (create_code): Update to
create a function pointer type independently of the call to
gcc_jit_function_get_address, and assign the pointer to a local
before returning it, to exercise the function pointer type
comparison code.

From-SVN: r253255
gcc/jit/ChangeLog
gcc/jit/jit-recording.c
gcc/jit/jit-recording.h
gcc/testsuite/ChangeLog
gcc/testsuite/jit.dg/test-error-mismatching-types-in-assignment-fn-ptr.c [new file with mode: 0644]
gcc/testsuite/jit.dg/test-returning-function-ptr.c