Skip to content

Commit ac1853f

Browse files
authored
Merge pull request #55 from zedar/extend_compatible_types
Make is_same_type_as() supporting floating point types. Improve type coparison.
2 parents 8620316 + 8535da8 commit ac1853f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

gcc/jit/jit-recording.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,7 @@ class type : public memento
634634

635635
virtual bool is_same_type_as (type *other)
636636
{
637-
if (is_int ()
638-
&& other->is_int ()
637+
if ((is_int () && other->is_int () || is_float() && other->is_float())
639638
&& get_size () == other->get_size ()
640639
&& is_signed () == other->is_signed ())
641640
{

gcc/jit/libgccjit.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2331,7 +2331,7 @@ gcc_jit_context_new_comparison (gcc_jit_context *ctxt,
23312331
RETURN_NULL_IF_FAIL (a, ctxt, loc, "NULL a");
23322332
RETURN_NULL_IF_FAIL (b, ctxt, loc, "NULL b");
23332333
RETURN_NULL_IF_FAIL_PRINTF4 (
2334-
a->get_type ()->unqualified () == b->get_type ()->unqualified (),
2334+
compatible_types(a->get_type()->unqualified(), b->get_type()->unqualified()),
23352335
ctxt, loc,
23362336
"mismatching types for comparison:"
23372337
" a: %s (type: %s) b: %s (type: %s)",

0 commit comments

Comments
 (0)