From 45c8342998c3c431a06366f37c48be9082de8906 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 27 Jan 2012 10:54:51 +0000 Subject: [PATCH] re PR middle-end/51959 (ICE in set_mem_alias_set, at emit-rtl.c:1884) 2012-01-27 Richard Guenther PR middle-end/51959 * expr.c (store_field): Use the alias-set of the scratch memory for storing to it. * g++.dg/torture/pr51959.C: New testcase. From-SVN: r183616 --- gcc/ChangeLog | 6 ++ gcc/expr.c | 2 +- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.dg/torture/pr51959.C | 80 ++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr51959.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e7fb05d9bad..a18f505691e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-01-27 Richard Guenther + + PR middle-end/51959 + * expr.c (store_field): Use the alias-set of the scratch memory + for storing to it. + 2012-01-27 Tom de Vries PR tree-optimization/51990 diff --git a/gcc/expr.c b/gcc/expr.c index 8698f18e1e6..48c3e0a19d5 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6299,7 +6299,7 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos, store_field (blk_object, bitsize, bitpos, bitregion_start, bitregion_end, - mode, exp, type, alias_set, nontemporal); + mode, exp, type, MEM_ALIAS_SET (blk_object), nontemporal); emit_move_insn (target, object); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 58311bce48b..bdd2792e388 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-01-27 Richard Guenther + + PR middle-end/51959 + * g++.dg/torture/pr51959.C: New testcase. + 2012-01-27 Tom de Vries PR tree-optimization/51990 diff --git a/gcc/testsuite/g++.dg/torture/pr51959.C b/gcc/testsuite/g++.dg/torture/pr51959.C new file mode 100644 index 00000000000..da0be71ebd8 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr51959.C @@ -0,0 +1,80 @@ +// { dg-do compile } + +namespace std { + typedef __SIZE_TYPE__ size_t; +} +inline void* operator new(std::size_t, void* __p) throw() { + return __p; +} +template class QTypeInfo { +}; +enum { Q_COMPLEX_TYPE = 0, Q_PRIMITIVE_TYPE = 0x1, Q_STATIC_TYPE = 0, Q_MOVABLE_TYPE = 0x2, Q_DUMMY_TYPE = 0x4 }; +template class QFlags { + int i; + inline QFlags(Enum f) : i(f) { } +}; +class __attribute__((visibility("default"))) QSize { +public: + bool isEmpty() const; + friend inline bool operator==(const QSize &, const QSize &); + int wd; + int ht; +}; +template<> class QTypeInfo { +public: + enum { + isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QSize)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; +}; +class __attribute__((visibility("default"))) QBasicAtomicInt { +public: + inline bool operator!=(int value) const { } +}; +struct __attribute__((visibility("default"))) QListData { + struct Data { + QBasicAtomicInt ref; + }; + void **append(); +}; +template class QList { + struct Node { + void *v; + }; + union { + QListData p; + QListData::Data *d; + }; +public: + void append(const T &t); + inline void push_back(const T &t) { + append(t); + } + void node_construct(Node *n, const T &t); + void node_destruct(Node *n); +}; +template inline void QList::node_construct(Node *n, const T &t) { + if (QTypeInfo::isLarge || QTypeInfo::isStatic) n->v = new T(t); + else if (QTypeInfo::isComplex) new (n) T(t); +} +template inline void QList::node_destruct(Node *n) { +} +template void QList::append(const T &t) { + if (d->ref != 1) { + try { + } + catch (...) { + } + if (QTypeInfo::isLarge || QTypeInfo::isStatic) { + } + else { + Node *n, copy; + node_construct(©, t); + try { n = reinterpret_cast(p.append());; } + catch (...) { node_destruct(©); throw; } + *n = copy; + } + } +}; +void virtual_hook(QSize sz, QList &arg) +{ + arg.push_back(sz); +} -- 2.30.2