diff options
author | Richard Biener <rguenther@suse.de> | 2020-03-19 10:15:52 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-03-19 10:18:01 +0100 |
commit | 73bc09fa8c6b973a928a599498caa66a25c8bc8d (patch) | |
tree | b05b87310a0bca42f13f0e8d6949193424a819d5 /gcc/testsuite | |
parent | b5562f1187d47b0e8a20687a8d31d00c187aada9 (diff) | |
download | gcc-73bc09fa8c6b973a928a599498caa66a25c8bc8d.zip gcc-73bc09fa8c6b973a928a599498caa66a25c8bc8d.tar.gz gcc-73bc09fa8c6b973a928a599498caa66a25c8bc8d.tar.bz2 |
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.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr94216.C | 45 |
2 files changed, 50 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9e5fecd..e828b7f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/testsuite/g++.dg/torture/pr94216.C b/gcc/testsuite/g++.dg/torture/pr94216.C new file mode 100644 index 0000000..e67239de9 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr94216.C @@ -0,0 +1,45 @@ +// { 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) {} |