mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 15:11:08 +08:00
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
This commit is contained in:
parent
fb208bed52
commit
04941f7657
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,8 @@
|
||||
2008-02-06 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
PR c++/35056
|
||||
* g++.dg/conversion/bitfield8.C: New.
|
||||
|
||||
2008-02-06 Douglas Gregor <doug.gregor@gmail.com>
|
||||
|
||||
* g++.dg/ext/vector13.C: Fix for compilation under -pedantic.
|
||||
|
16
gcc/testsuite/g++.dg/conversion/bitfield8.C
Normal file
16
gcc/testsuite/g++.dg/conversion/bitfield8.C
Normal file
@ -0,0 +1,16 @@
|
||||
// PR c++/35056
|
||||
// { dg-do compile }
|
||||
// { dg-options "-O2" }
|
||||
|
||||
enum EBorderStyle { bla = 1 };
|
||||
inline bool compare_ref(const unsigned int &t, const EBorderStyle &u)
|
||||
{ return t == u; }
|
||||
inline bool compare_val(const unsigned int t, const EBorderStyle u)
|
||||
{ return t == u; }
|
||||
struct S {
|
||||
unsigned m_style : 4;
|
||||
};
|
||||
void call_ref (S *s, EBorderStyle v)
|
||||
{ if (!compare_ref(s->m_style, v)) s->m_style = v; }
|
||||
void call_val (S *s, EBorderStyle v)
|
||||
{ if (!compare_val(s->m_style, v)) s->m_style = v; }
|
Loading…
x
Reference in New Issue
Block a user