diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-10-29 00:27:49 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-10-29 00:36:30 +0200 |
commit | 10f1489dcb3bd9adccc88898bc12f53398fa3583 (patch) | |
tree | 34a837c0418846d2fd1ec9562c0bd067cd515122 /gcc | |
parent | 5d2a360f0a541646abb11efdbabc33c6a04de7ee (diff) | |
download | gcc-10f1489dcb3bd9adccc88898bc12f53398fa3583.zip gcc-10f1489dcb3bd9adccc88898bc12f53398fa3583.tar.gz gcc-10f1489dcb3bd9adccc88898bc12f53398fa3583.tar.bz2 |
d: Fix ICE: in verify_gimple_in_seq on powerpc-darwin9 [PR112270]
This ICE was seen during stage2 on powerpc-darwin9 only. There were
still some uses of GCC's boolean_type_node in the D front-end, which
caused a type mismatch to trigger as D bool size is fixed to 1 byte on
all targets.
So two new nodes have been introduced - d_bool_false_node and
d_bool_true_node - which have replaced all remaining uses of
boolean_false_node and boolean_true_node respectively.
PR d/112270
gcc/d/ChangeLog:
* d-builtins.cc (d_build_d_type_nodes): Initialize d_bool_false_node,
d_bool_true_node.
* d-codegen.cc (build_array_struct_comparison): Use d_bool_false_node
instead of boolean_false_node.
* d-convert.cc (d_truthvalue_conversion): Use d_bool_false_node and
d_bool_true_node instead of boolean_false_node and boolean_true_node.
* d-tree.h (enum d_tree_index): Add DTI_BOOL_FALSE and DTI_BOOL_TRUE.
(d_bool_false_node): New macro.
(d_bool_true_node): New macro.
* modules.cc (build_dso_cdtor_fn): Use d_bool_false_node and
d_bool_true_node instead of boolean_false_node and boolean_true_node.
(register_moduleinfo): Use d_bool_type instead of boolean_type_node.
gcc/testsuite/ChangeLog:
* gdc.dg/pr112270.d: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/d/d-builtins.cc | 3 | ||||
-rw-r--r-- | gcc/d/d-codegen.cc | 2 | ||||
-rw-r--r-- | gcc/d/d-convert.cc | 10 | ||||
-rw-r--r-- | gcc/d/d-tree.h | 6 | ||||
-rw-r--r-- | gcc/d/modules.cc | 4 | ||||
-rw-r--r-- | gcc/testsuite/gdc.dg/pr112270.d | 7 |
6 files changed, 24 insertions, 8 deletions
diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index cf998d2..f6ea026 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -956,6 +956,9 @@ d_build_d_type_nodes (void) d_bool_type = make_unsigned_type (1); TREE_SET_CODE (d_bool_type, BOOLEAN_TYPE); + d_bool_false_node = TYPE_MIN_VALUE (d_bool_type); + d_bool_true_node = TYPE_MAX_VALUE (d_bool_type); + char8_type_node = make_unsigned_type (8); TYPE_STRING_FLAG (char8_type_node) = 1; diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc index 91ddb1b..270cb5e 100644 --- a/gcc/d/d-codegen.cc +++ b/gcc/d/d-codegen.cc @@ -1115,7 +1115,7 @@ build_array_struct_comparison (tree_code code, StructDeclaration *sd, if (length == 0 || result OP 0) break; */ t = build_boolop (EQ_EXPR, length, d_convert (lentype, integer_zero_node)); t = build_boolop (TRUTH_ORIF_EXPR, t, build_boolop (code, result, - boolean_false_node)); + d_bool_false_node)); t = build1 (EXIT_EXPR, void_type_node, t); add_stmt (t); diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc index 2b9d8e7..71d7a41 100644 --- a/gcc/d/d-convert.cc +++ b/gcc/d/d-convert.cc @@ -132,13 +132,13 @@ d_truthvalue_conversion (tree expr) return expr; case INTEGER_CST: - return integer_zerop (expr) ? boolean_false_node - : boolean_true_node; + return integer_zerop (expr) ? d_bool_false_node + : d_bool_true_node; case REAL_CST: return real_compare (NE_EXPR, &TREE_REAL_CST (expr), &dconst0) - ? boolean_true_node - : boolean_false_node; + ? d_bool_true_node + : d_bool_false_node; case ADDR_EXPR: /* If we are taking the address of a decl that can never be null, @@ -148,7 +148,7 @@ d_truthvalue_conversion (tree expr) warning (OPT_Waddress, "the address of %qD will always evaluate as %<true%>", TREE_OPERAND (expr, 0)); - return boolean_true_node; + return d_bool_true_node; } break; diff --git a/gcc/d/d-tree.h b/gcc/d/d-tree.h index ed26533..7763695 100644 --- a/gcc/d/d-tree.h +++ b/gcc/d/d-tree.h @@ -444,6 +444,9 @@ enum d_tree_index DTI_NULL_ARRAY, DTI_BOTTOM_TYPE, + DTI_BOOL_FALSE, + DTI_BOOL_TRUE, + DTI_MAX }; @@ -480,6 +483,9 @@ extern GTY(()) tree d_global_trees[DTI_MAX]; #define null_array_node d_global_trees[DTI_NULL_ARRAY] /* The bottom type, referred to as `noreturn` in code. */ #define noreturn_type_node d_global_trees[DTI_BOTTOM_TYPE] +/* D boolean values are always byte-sized, unlike boolean_type_node. */ +#define d_bool_false_node d_global_trees[DTI_BOOL_FALSE] +#define d_bool_true_node d_global_trees[DTI_BOOL_TRUE] /* A prefix for internal variables, which are not user-visible. */ #if !defined (NO_DOT_IN_LABEL) diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc index 8d6c8f0..e3c1ef9 100644 --- a/gcc/d/modules.cc +++ b/gcc/d/modules.cc @@ -330,7 +330,7 @@ static tree build_dso_cdtor_fn (bool ctor_p) { const char *name = ctor_p ? GDC_PREFIX ("dso_ctor") : GDC_PREFIX ("dso_dtor"); - tree condition = ctor_p ? boolean_true_node : boolean_false_node; + tree condition = ctor_p ? d_bool_true_node : d_bool_false_node; /* Declaration of dso_ctor/dso_dtor is: @@ -453,7 +453,7 @@ register_moduleinfo (Module *decl, tree minfo) d_finish_decl (dso_slot_node); dso_initialized_node = build_dso_registry_var (GDC_PREFIX ("dso_initialized"), - boolean_type_node); + d_bool_type); d_finish_decl (dso_initialized_node); /* Declare dso_ctor() and dso_dtor(). */ diff --git a/gcc/testsuite/gdc.dg/pr112270.d b/gcc/testsuite/gdc.dg/pr112270.d new file mode 100644 index 0000000..591c798 --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr112270.d @@ -0,0 +1,7 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112270 +// { dg-do compile } +class CPPNamespaceDeclaration { } +bool isNamespaceEqual (CPPNamespaceDeclaration a) +{ + return a ? true : isNamespaceEqual(a); +} |