Commit 73bc09fa by Richard Biener

middle-end/94216 fix another build_fold_addr_expr use

2020-03-19  Richard Biener  <rguenther@suse.de>

	PR middle-end/94216
	* fold-const.c (fold_binary_loc): Avoid using
	build_fold_addr_expr when we really want an ADDR_EXPR.

	* g++.dg/torture/pr94216.C: New testcase.
parent b5562f11
2020-03-19 Richard Biener <rguenther@suse.de>
PR middle-end/94216
* fold-const.c (fold_binary_loc): Avoid using
build_fold_addr_expr when we really want an ADDR_EXPR.
2020-03-18 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/constraints.md (wd, wf, wi, ws, ww): New undocumented
......
......@@ -10284,7 +10284,7 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type,
if (!base)
return NULL_TREE;
return fold_build2 (MEM_REF, type,
build_fold_addr_expr (base),
build1 (ADDR_EXPR, TREE_TYPE (arg0), base),
int_const_binop (PLUS_EXPR, arg1,
size_int (coffset)));
}
......
2020-03-19 Richard Biener <rguenther@suse.de>
PR middle-end/94216
* g++.dg/torture/pr94216.C: New testcase.
2020-03-18 Martin Sebor <msebor@redhat.com>
PR ipa/92799
......
// { dg-do compile }
// { dg-additional-options "-g" }
template <int _Nm> struct A { typedef int _Type[_Nm]; };
template <int _Nm> struct B {
typename A<_Nm>::_Type _M_elems;
void operator[](int) { int a = *_M_elems; }
};
class C {
struct D {
using type = int *;
};
public:
using pointer = D::type;
};
class F {
public:
using pointer = C::pointer;
F(pointer);
};
struct G {
int data;
};
template <int MaxDimensions> struct H {
using dimensions_t = B<MaxDimensions>;
dimensions_t dimensions;
G mem;
};
template <int MaxDimensions, typename Allocator, typename DimT, typename AlignT>
H<MaxDimensions> alloc_view(int, DimT, AlignT, Allocator) {
H<MaxDimensions> b;
b.dimensions[0];
return b;
}
namespace memory {
template <typename> using DynMdView = H<6>;
}
class I {
I();
memory::DynMdView<void> m_view;
F m_memory;
};
int c, d, e;
I::I() : m_view(alloc_view<6>(c, d, e, [] {})), m_memory(&m_view.mem.data) {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment