Skip to content

Commit

Permalink
Merge pull request #55 from zedar/extend_compatible_types
Browse files Browse the repository at this point in the history
Make is_same_type_as() supporting floating point types. Improve type coparison.
  • Loading branch information
antoyo authored Apr 29, 2024
2 parents 8620316 + 8535da8 commit ac1853f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions gcc/jit/jit-recording.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,7 @@ class type : public memento

virtual bool is_same_type_as (type *other)
{
if (is_int ()
&& other->is_int ()
if ((is_int () && other->is_int () || is_float() && other->is_float())
&& get_size () == other->get_size ()
&& is_signed () == other->is_signed ())
{
Expand Down
2 changes: 1 addition & 1 deletion gcc/jit/libgccjit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,7 @@ gcc_jit_context_new_comparison (gcc_jit_context *ctxt,
RETURN_NULL_IF_FAIL (a, ctxt, loc, "NULL a");
RETURN_NULL_IF_FAIL (b, ctxt, loc, "NULL b");
RETURN_NULL_IF_FAIL_PRINTF4 (
a->get_type ()->unqualified () == b->get_type ()->unqualified (),
compatible_types(a->get_type()->unqualified(), b->get_type()->unqualified()),
ctxt, loc,
"mismatching types for comparison:"
" a: %s (type: %s) b: %s (type: %s)",
Expand Down

0 comments on commit ac1853f

Please sign in to comment.