aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-10-14 11:59:47 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-10-14 11:59:47 +0000
commit1e85e7204d437c3e0fd2aea6996ad7820c5913ee (patch)
tree4a7d9fe94ac20b96bfc133ea6e4ddea9e9aeaede /gcc
parenta16ced220ff332c70645ad5f9ad2e247f5a50581 (diff)
downloadgcc-1e85e7204d437c3e0fd2aea6996ad7820c5913ee.zip
gcc-1e85e7204d437c3e0fd2aea6996ad7820c5913ee.tar.gz
gcc-1e85e7204d437c3e0fd2aea6996ad7820c5913ee.tar.bz2
re PR c++/44561 (using nullptr_t with -flto/-fwhopr causes ICE: tree code 'lang_type' is not supported in gimple streams)
2010-10-14 Richard Guenther <rguenther@suse.de> PR lto/44561 * tree.def (NULLPTR_TYPE): New tree code. * dbxout.c (dbxout_type): Handle NULLPTR_TYPE. * dwarf2out.c (is_base_type): Likewise. (gen_type_die_with_usage): Likewise. * sdbout.c (plain_type_1): Likewise. * tree.c (build_int_cst_wide): Likewise. * gimple.c (gimple_types_compatible_p_1): NULLPTR_TYPE types are equal. cp/ * cp-tree.h (NULLPTR_TYPE_P): Adjust. * decl.c (cxx_init_decl_processing): Build a NULLPTR_TYPE node, use build_int_cst. * error.c (dump_type): Handle NULLPTR_TYPE. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. * mangle.c (write_type): Likewise. * name-lookup.c (arg_assoc_type): Likewise. * rtti.c (typeinfo_in_lib_p): Likewise. * pt.c (tsubst): Likewise. * g++.dg/lto/20101010-3_0.C: New testcase. * g++.dg/lto/20101010-4_0.C: Likewise. From-SVN: r165462
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/cp/ChangeLog14
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/error.c6
-rw-r--r--gcc/cp/mangle.c11
-rw-r--r--gcc/cp/name-lookup.c2
-rw-r--r--gcc/cp/pt.c1
-rw-r--r--gcc/cp/rtti.c5
-rw-r--r--gcc/dbxout.c1
-rw-r--r--gcc/dwarf2out.c2
-rw-r--r--gcc/gimple.c4
-rw-r--r--gcc/sdbout.c1
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/lto/20101010-3_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20101010-4_0.C9
-rw-r--r--gcc/tree.c4
-rw-r--r--gcc/tree.def11
18 files changed, 83 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 771de10..640d05e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-14 Richard Guenther <rguenther@suse.de>
+
+ PR lto/44561
+ * tree.def (NULLPTR_TYPE): New tree code.
+ * dbxout.c (dbxout_type): Handle NULLPTR_TYPE.
+ * dwarf2out.c (is_base_type): Likewise.
+ (gen_type_die_with_usage): Likewise.
+ * sdbout.c (plain_type_1): Likewise.
+ * tree.c (build_int_cst_wide): Likewise.
+ * gimple.c (gimple_types_compatible_p_1): NULLPTR_TYPE types
+ are equal.
+
2010-10-14 Joseph Myers <joseph@codesourcery.com>
* params.c (params_finished): New.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ec89755..ea6f0f5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-14 Richard Guenther <rguenther@suse.de>
+
+ PR lto/44561
+ * cp-tree.h (NULLPTR_TYPE_P): Adjust.
+ * decl.c (cxx_init_decl_processing): Build a NULLPTR_TYPE node,
+ use build_int_cst.
+ * error.c (dump_type): Handle NULLPTR_TYPE.
+ (dump_type_prefix): Likewise.
+ (dump_type_suffix): Likewise.
+ * mangle.c (write_type): Likewise.
+ * name-lookup.c (arg_assoc_type): Likewise.
+ * rtti.c (typeinfo_in_lib_p): Likewise.
+ * pt.c (tsubst): Likewise.
+
2010-10-13 Jason Merrill <jason@redhat.com>
PR c++/45984
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 29a4bdb..626e452 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3051,9 +3051,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
|| TREE_CODE (TYPE) == COMPLEX_TYPE)
/* True iff TYPE is cv decltype(nullptr). */
-#define NULLPTR_TYPE_P(TYPE) \
- (TREE_CODE (TYPE) == LANG_TYPE \
- && TYPE_MAIN_VARIANT (TYPE) == nullptr_type_node)
+#define NULLPTR_TYPE_P(TYPE) (TREE_CODE (TYPE) == NULLPTR_TYPE)
/* [basic.types]
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7fcfb8b..55e231b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3552,15 +3552,14 @@ cxx_init_decl_processing (void)
global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype);
push_cp_library_fn (VEC_DELETE_EXPR, deltype);
- nullptr_type_node = make_node (LANG_TYPE);
+ nullptr_type_node = make_node (NULLPTR_TYPE);
TYPE_SIZE (nullptr_type_node) = bitsize_int (GET_MODE_BITSIZE (ptr_mode));
TYPE_SIZE_UNIT (nullptr_type_node) = size_int (GET_MODE_SIZE (ptr_mode));
TYPE_UNSIGNED (nullptr_type_node) = 1;
TYPE_PRECISION (nullptr_type_node) = GET_MODE_BITSIZE (ptr_mode);
SET_TYPE_MODE (nullptr_type_node, Pmode);
record_builtin_type (RID_MAX, "decltype(nullptr)", nullptr_type_node);
- nullptr_node = make_node (INTEGER_CST);
- TREE_TYPE (nullptr_node) = nullptr_type_node;
+ nullptr_node = build_int_cst (nullptr_type_node, 0);
}
abort_fndecl
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 185b361..3b5cf0a 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -500,6 +500,10 @@ dump_type (tree t, int flags)
pp_cxx_right_paren (cxx_pp);
break;
+ case NULLPTR_TYPE:
+ pp_string (cxx_pp, "std::nullptr_t");
+ break;
+
default:
pp_unsupported_tree (cxx_pp, t);
/* Fall through to error. */
@@ -728,6 +732,7 @@ dump_type_prefix (tree t, int flags)
case DECLTYPE_TYPE:
case TYPE_PACK_EXPANSION:
case FIXED_POINT_TYPE:
+ case NULLPTR_TYPE:
dump_type (t, flags);
pp_base (cxx_pp)->padding = pp_before;
break;
@@ -830,6 +835,7 @@ dump_type_suffix (tree t, int flags)
case DECLTYPE_TYPE:
case TYPE_PACK_EXPANSION:
case FIXED_POINT_TYPE:
+ case NULLPTR_TYPE:
break;
default:
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 39001c5..6bab309 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1943,17 +1943,16 @@ write_type (tree type)
write_char ('E');
break;
+ case NULLPTR_TYPE:
+ write_string ("Dn");
+ break;
+
case TYPEOF_TYPE:
sorry ("mangling typeof, use decltype instead");
break;
case LANG_TYPE:
- if (NULLPTR_TYPE_P (type))
- {
- write_string ("Dn");
- break;
- }
- /* else fall through. */
+ /* fall through. */
default:
gcc_unreachable ();
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index e980cb6..8b2e542 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4932,6 +4932,7 @@ arg_assoc_type (struct arg_lookup *k, tree type)
case BOOLEAN_TYPE:
case FIXED_POINT_TYPE:
case DECLTYPE_TYPE:
+ case NULLPTR_TYPE:
return false;
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_P (type))
@@ -4963,7 +4964,6 @@ arg_assoc_type (struct arg_lookup *k, tree type)
return false;
case LANG_TYPE:
gcc_assert (type == unknown_type_node
- || NULLPTR_TYPE_P (type)
|| type == init_list_type_node);
return false;
case TYPE_PACK_EXPANSION:
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9ddb4fd..a365603 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10097,6 +10097,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case COMPLEX_TYPE:
case VECTOR_TYPE:
case BOOLEAN_TYPE:
+ case NULLPTR_TYPE:
case LANG_TYPE:
return t;
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index d7a151d..da56d4d 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -1051,12 +1051,11 @@ typeinfo_in_lib_p (tree type)
case BOOLEAN_TYPE:
case REAL_TYPE:
case VOID_TYPE:
+ case NULLPTR_TYPE:
return true;
case LANG_TYPE:
- if (NULLPTR_TYPE_P (type))
- return true;
- /* else fall through. */
+ /* fall through. */
default:
return false;
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 2eb4f0b..c9ca04d 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -1863,6 +1863,7 @@ dbxout_type (tree type, int full)
switch (TREE_CODE (type))
{
case VOID_TYPE:
+ case NULLPTR_TYPE:
case LANG_TYPE:
/* For a void type, just define it as itself; i.e., "5=5".
This makes us consider it defined
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9832fa9..47d98f3 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -12611,6 +12611,7 @@ is_base_type (tree type)
case METHOD_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
+ case NULLPTR_TYPE:
case OFFSET_TYPE:
case LANG_TYPE:
case VECTOR_TYPE:
@@ -20215,6 +20216,7 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
/* No DIEs needed for fundamental types. */
break;
+ case NULLPTR_TYPE:
case LANG_TYPE:
/* Just use DW_TAG_unspecified_type. */
{
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 54e6857..fca7803 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -3661,6 +3661,10 @@ gimple_types_compatible_p_1 (tree t1, tree t2, enum gtc_mode mode,
goto different_types;
}
+ case NULLPTR_TYPE:
+ /* There is only one decltype(nullptr). */
+ goto same_types;
+
case INTEGER_TYPE:
case BOOLEAN_TYPE:
{
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index 5d2896c..53075ac 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -495,6 +495,7 @@ plain_type_1 (tree type, int level)
switch (TREE_CODE (type))
{
case VOID_TYPE:
+ case NULLPTR_TYPE:
return T_VOID;
case BOOLEAN_TYPE:
case INTEGER_TYPE:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4f4d137..de4fe20 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-14 Richard Guenther <rguenther@suse.de>
+
+ PR lto/44561
+ * g++.dg/lto/20101010-3_0.C: New testcase.
+ * g++.dg/lto/20101010-4_0.C: Likewise.
+
2010-10-14 Iain Sandoe <iains@gcc.gnu.org>
* objc.dg/pr45878.m: Update to include NSConstantString interface
diff --git a/gcc/testsuite/g++.dg/lto/20101010-3_0.C b/gcc/testsuite/g++.dg/lto/20101010-3_0.C
new file mode 100644
index 0000000..ed3b8d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101010-3_0.C
@@ -0,0 +1,5 @@
+// { dg-lto-do link }
+// { dg-lto-options { "-flto -std=c++0x" } }
+
+decltype(nullptr) a;
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20101010-4_0.C b/gcc/testsuite/g++.dg/lto/20101010-4_0.C
new file mode 100644
index 0000000..01beb21
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101010-4_0.C
@@ -0,0 +1,9 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -std=c++0x -flto -r -nostdlib } { -std=c++0x -flto -g -r -nostdlib } } }
+
+typedef decltype(nullptr) nullptr_t;
+class shared_ptr {
+public:
+ shared_ptr(nullptr_t __p);
+};
+shared_ptr p = nullptr;
diff --git a/gcc/tree.c b/gcc/tree.c
index 28cc2d8..4d505b7 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1178,6 +1178,10 @@ build_int_cst_wide (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi)
switch (TREE_CODE (type))
{
+ case NULLPTR_TYPE:
+ gcc_assert (hi == 0 && low == 0);
+ /* Fallthru. */
+
case POINTER_TYPE:
case REFERENCE_TYPE:
/* Cache NULL pointer. */
diff --git a/gcc/tree.def b/gcc/tree.def
index 9343e5e..24729e8 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -162,15 +162,18 @@ DEFTREECODE (REAL_TYPE, "real_type", tcc_type, 0)
The TREE_TYPE points to the node for the type pointed to. */
DEFTREECODE (POINTER_TYPE, "pointer_type", tcc_type, 0)
+/* A reference is like a pointer except that it is coerced
+ automatically to the value it points to. Used in C++. */
+DEFTREECODE (REFERENCE_TYPE, "reference_type", tcc_type, 0)
+
+/* The C++ decltype(nullptr) type. */
+DEFTREECODE (NULLPTR_TYPE, "nullptr_type", tcc_type, 0)
+
/* _Fract and _Accum types in Embedded-C. Different fixed-point types
are distinguished by machine mode and by the TYPE_SIZE and the
TYPE_PRECISION. */
DEFTREECODE (FIXED_POINT_TYPE, "fixed_point_type", tcc_type, 0)
-/* A reference is like a pointer except that it is coerced
- automatically to the value it points to. Used in C++. */
-DEFTREECODE (REFERENCE_TYPE, "reference_type", tcc_type, 0)
-
/* The ordering of the following codes is optimized for the checking
macros in tree.h. Changing the order will degrade the speed of the
compiler. COMPLEX_TYPE, VECTOR_TYPE, ARRAY_TYPE. */