Skip to content

Commit 0503f28

Browse files
Robert Zakrzewskiantoyo
authored andcommitted
Make is_same_type_as() supporting floating point types. Improve type comparision
1 parent a96e3f2 commit 0503f28

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

gcc/jit/jit-recording.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,7 @@ class type : public memento
635635

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

gcc/jit/libgccjit.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,7 @@ gcc_jit_context_new_comparison (gcc_jit_context *ctxt,
23122312
RETURN_NULL_IF_FAIL (a, ctxt, loc, "NULL a");
23132313
RETURN_NULL_IF_FAIL (b, ctxt, loc, "NULL b");
23142314
RETURN_NULL_IF_FAIL_PRINTF4 (
2315-
a->get_type ()->unqualified () == b->get_type ()->unqualified (),
2315+
compatible_types(a->get_type()->unqualified(), b->get_type()->unqualified()),
23162316
ctxt, loc,
23172317
"mismatching types for comparison:"
23182318
" a: %s (type: %s) b: %s (type: %s)",

0 commit comments

Comments
 (0)