From e3a5c77388ae3791afed4f4286ec7e41e5b9f7c3 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Wed, 29 Jun 2022 19:56:56 -0400 Subject: libgccjit: Fix bug where unary_op will return an integer type instead of the correct type 2022-06-29 Antoni Boucher gcc/jit/ PR jit/105812 * jit-playback.cc: Use the correct return type when folding in as_truth_value. gcc/testsuite/ PR jit/105812 * jit.dg/test-asm.cc: Add include missing to make the test pass. * jit.dg/test-pr105812-bool-operations.c: New test. --- gcc/jit/jit-playback.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/jit') diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc index 7971413..d227d36 100644 --- a/gcc/jit/jit-playback.cc +++ b/gcc/jit/jit-playback.cc @@ -1024,8 +1024,9 @@ as_truth_value (tree expr, location *loc) if (loc) set_tree_location (typed_zero, loc); + tree type = TREE_TYPE (expr); expr = fold_build2_loc (UNKNOWN_LOCATION, - NE_EXPR, integer_type_node, expr, typed_zero); + NE_EXPR, type, expr, typed_zero); if (loc) set_tree_location (expr, loc); -- cgit v1.1