2011/5/14 Eric Botcazou <ebotca...@adacore.com>: >> In Fortran (and maybe other langauges) there are booleans with >> different sizes but the same precision. > > Ada doesn't have a C-like boolean type either. The patches have introduced: > > FAIL: gnat.dg/lto1.adb (test for excess errors) > > > /home/eric/svn/gcc/gcc/testsuite/gnat.dg/lto1_pkg.adb:23:1: error: type > mismatch in binary truth expression > boolean > boolean > boolean > D.2419_18 = D.2417_16 || D.2418_17; > +===========================GNAT BUG DETECTED==============================+ > | 4.7.0 20110513 (experimental) [trunk revision 173737] (i586-suse-linux-gnu) > GCC error:| > | verify_gimple failed
Those issues should be fixed by the attached patch, which relaxes strictness of logical operations in tree-cfg.c file. Not sure if Richard is ok by this, as it shows that FE are generating here gimplify-incompatible SSA trees, which seems to me at least something not that good here. ChangeLog 2011-05-14 Kai Tietz * tree-cfg.c (verify_gimple_assign_unary): Don't enforce boolean_type_node compatible lhs/rhs types for logical expression. (verify_gimple_assign_binary): Likewise. Regards, Kai
Index: gcc/gcc/tree-cfg.c =================================================================== --- gcc.orig/gcc/tree-cfg.c 2011-05-13 17:28:15.000000000 +0200 +++ gcc/gcc/tree-cfg.c 2011-05-14 16:04:31.995831500 +0200 @@ -3350,15 +3350,6 @@ verify_gimple_assign_unary (gimple stmt) return false; case TRUTH_NOT_EXPR: - if (!useless_type_conversion_p (boolean_type_node, rhs1_type)) - { - error ("invalid types in truth not"); - debug_generic_expr (lhs_type); - debug_generic_expr (rhs1_type); - return true; - } - break; - case NEGATE_EXPR: case ABS_EXPR: case BIT_NOT_EXPR: @@ -3558,10 +3549,13 @@ do_pointer_plus_expr_check: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: { - /* We allow only boolean typed or compatible argument and result. */ - if (!useless_type_conversion_p (boolean_type_node, rhs1_type) - || !useless_type_conversion_p (boolean_type_node, rhs2_type) - || !useless_type_conversion_p (boolean_type_node, lhs_type)) + /* The gimplify code ensures that just boolean_type_node types + are present, but ADA and FORTRAN using artificial gimple generation + code which is producing non-gimplify compatible trees. So we need + to allow here any kind of integral typed argument and result. */ + if (!INTEGRAL_TYPE_P (rhs1_type) + || !INTEGRAL_TYPE_P (rhs2_type) + || !INTEGRAL_TYPE_P (lhs_type)) { error ("type mismatch in binary truth expression"); debug_generic_expr (lhs_type);