aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2008-02-06 20:31:43 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2008-02-06 20:31:43 +0000
commit04941f7657cd5e392e3b9e3bf217a5696ecde77a (patch)
tree39c1b476e34a52ca79f0a50996d69317e822f22a /gcc/cp
parentfb208bed52791b758dd4de3143cef4be0e1bb793 (diff)
downloadgcc-04941f7657cd5e392e3b9e3bf217a5696ecde77a.zip
gcc-04941f7657cd5e392e3b9e3bf217a5696ecde77a.tar.gz
gcc-04941f7657cd5e392e3b9e3bf217a5696ecde77a.tar.bz2
re PR c++/35056 (ICE in copy_to_mode_reg, at explow.c:621)
gcc/cp/ChangeLog: PR c++/35056 * tree.c: Include tree-flow.h. (build_target_expr): Check type compatibility. * Make-lang.in (cp/tree.o): Depend on $(TREE_FLOW_H). * call.c (convert_like_real): Convert bitfield to expected type. gcc/testsuite/ChangeLog: PR c++/35056 * g++.dg/conversion/bitfield8.C: New. From-SVN: r132158
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/Make-lang.in4
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/tree.c10
4 files changed, 21 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3aa5e76..e609de4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2008-02-06 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/35056
+ * tree.c: Include tree-flow.h.
+ (build_target_expr): Check type compatibility.
+ * Make-lang.in (cp/tree.o): Depend on $(TREE_FLOW_H).
+ * call.c (convert_like_real): Convert bitfield to expected type.
+
2008-02-06 Douglas Gregor <doug.gregor@gmail.com>
PR c++/35049
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 500f712..0aea4cf 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -1,6 +1,6 @@
# Top level -*- makefile -*- fragment for GNU C++.
# Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2007
+# 2005, 2007, 2008
# Free Software Foundation, Inc.
#This file is part of GCC.
@@ -261,7 +261,7 @@ cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h $(FLAGS_H) toplev.h \
cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H)
cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H) \
insn-config.h $(INTEGRATE_H) $(TREE_INLINE_H) $(REAL_H) gt-cp-tree.h \
- $(TARGET_H) debug.h
+ $(TARGET_H) debug.h $(TREE_FLOW_H)
cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H)
cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h convert.h \
$(TARGET_H) gt-cp-rtti.h
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c4e4c79..745c8e8 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4507,6 +4507,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
expr, ref_type);
return error_mark_node;
}
+ if (lvalue & clk_bitfield)
+ expr = convert_bitfield_to_declared_type (expr);
expr = build_target_expr_with_type (expr, type);
}
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 7459266..b14462f 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1,6 +1,6 @@
/* Language-dependent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "target.h"
#include "convert.h"
+#include "tree-flow.h"
static tree bot_manip (tree *, int *, void *);
static tree bot_replace (tree *, int *, void *);
@@ -259,6 +260,13 @@ build_target_expr (tree decl, tree value)
{
tree t;
+#ifdef ENABLE_CHECKING
+ gcc_assert (VOID_TYPE_P (TREE_TYPE (value))
+ || TREE_TYPE (decl) == TREE_TYPE (value)
+ || useless_type_conversion_p (TREE_TYPE (decl),
+ TREE_TYPE (value)));
+#endif
+
t = build4 (TARGET_EXPR, TREE_TYPE (decl), decl, value,
cxx_maybe_build_cleanup (decl), NULL_TREE);
/* We always set TREE_SIDE_EFFECTS so that expand_expr does not