[PATCH PR d/87866] Committed use lrealpath to get canonical name

2018-11-24 Thread Iain Buclaw
Hi,

This patch fixes PR d/87866. The libiberty function is more portable
than the one provided by the dmd front-end.  I checked other places
where FileName::canonicalName is used internally to dmd, but found
none that would be used by us.

Bootstrapped, ran D2 testsuite on x86_64-linux-gnu.  Commited to trunk
as r266429.

Iain

---
gcc/d/ChangeLog:

2018-11-24  Iain Buclaw  

PR d/87866
* d-incpath.cc (add_globalpaths): Use lrealpath to get canonical name.
(add_filepaths): Likewise.

---
diff --git a/gcc/d/d-incpath.cc b/gcc/d/d-incpath.cc
index be08ccb5f3b..87db8164134 100644
--- a/gcc/d/d-incpath.cc
+++ b/gcc/d/d-incpath.cc
@@ -78,7 +78,7 @@ add_globalpaths (Strings *paths)
   for (size_t i = 0; i < paths->dim; i++)
 	{
 	  const char *path = (*paths)[i];
-	  const char *target = FileName::canonicalName (path);
+	  const char *target = lrealpath (path);
 
 	  if (target == NULL || !FileName::exists (target))
 	{
@@ -105,7 +105,7 @@ add_filepaths (Strings *paths)
   for (size_t i = 0; i < paths->dim; i++)
 	{
 	  const char *path = (*paths)[i];
-	  const char *target = FileName::canonicalName (path);
+	  const char *target = lrealpath (path);
 
 	  if (!FileName::exists (target))
 	{


[PATCH, d] Fix IdentityExp comparison for complex floats

2018-11-24 Thread Johannes Pfau
Currently all identity comparisons for complex types (c1 is c2) return
true. This is caused by the rrent implementation being only correct for
real types, so this adds new code for the complex type cases.

Fixes https://bugzilla.gdcproject.org/show_bug.cgi?id=309

Tested on x86_64-linux-gnu and on the GDC CI
(https://github.com/D-Programming-GDC/GDC/pull/768)
--
Johannes


---
gcc/d/ChangeLog:

2018-11-24  Johannes Pfau  

* expr.cc (ExprVisitor::visit(IdentityExp)): Add support for complex 
types.
(ExprVisitor::build_float_identity): New function. 

gcc/testsuite/ChangeLog:

2018-11-24  Johannes Pfau  

* gdc.dg/runnable.d: Test IdentityExp for complex types.


 gcc/d/expr.cc   | 44 +
 gcc/testsuite/gdc.dg/runnable.d | 22 +
 2 files changed, 56 insertions(+), 10 deletions(-)

diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc
index 9a1aad42d..7eef00ac0 100644
--- a/gcc/d/expr.cc
+++ b/gcc/d/expr.cc
@@ -255,6 +255,21 @@ public:
 this->result_ = build_condition (build_ctype (e->type), cond, t1, t2);
   }
 
+  /* Helper function for floating point identity comparison. Compare
+ only well-defined bits, ignore padding (e.g. for X86 80bit real).  */
+
+  static tree build_float_identity (tree_code code, tree t1, tree t2)
+  {
+/* For floating-point values, identity is defined as the bits in the
+   operands being identical.  */
+tree tmemcmp = builtin_decl_explicit (BUILT_IN_MEMCMP);
+tree size = size_int (TYPE_PRECISION (TREE_TYPE (t1)) / BITS_PER_UNIT);
+
+tree result = build_call_expr (tmemcmp, 3, build_address (t1),
+  build_address (t2), size);
+return build_boolop (code, result, integer_zero_node);
+  }
+
   /* Build an identity comparison expression.  Operands go through the
  usual conversions to bring them to a common type before comparison.
  The result type is bool.  */
@@ -275,19 +290,28 @@ public:
this->result_ = d_convert (build_ctype (e->type),
   build_boolop (code, t1, t2));
   }
-else if (tb1->isfloating () && tb1->ty != Tvector)
+else if (tb1->iscomplex () && tb1->ty != Tvector)
   {
-   /* For floating-point values, identity is defined as the bits in the
-  operands being identical.  */
-   tree t1 = d_save_expr (build_expr (e->e1));
-   tree t2 = d_save_expr (build_expr (e->e2));
+   tree e1 = d_save_expr (build_expr (e->e1));
+   tree e2 = d_save_expr (build_expr (e->e2));
+   tree re1 = real_part (e1);
+   tree im1 = imaginary_part (e1);
+   tree re2 = real_part (e2);
+   tree im2 = imaginary_part (e2);
 
-   tree tmemcmp = builtin_decl_explicit (BUILT_IN_MEMCMP);
-   tree size = size_int (TYPE_PRECISION (TREE_TYPE (t1)) / BITS_PER_UNIT);
+   tree req = build_float_identity (code, re1, re2);
+   tree ieq = build_float_identity (code, im1, im2);
 
-   tree result = build_call_expr (tmemcmp, 3, build_address (t1),
-  build_address (t2), size);
-   this->result_ = build_boolop (code, result, integer_zero_node);
+   if (code == EQ_EXPR)
+ this->result_ = build_boolop (TRUTH_ANDIF_EXPR, req, ieq);
+   else
+ this->result_ = build_boolop (TRUTH_ORIF_EXPR, req, ieq);
+  }
+else if (tb1->isfloating () && tb1->ty != Tvector)
+  {
+   tree e1 = d_save_expr (build_expr (e->e1));
+   tree e2 = d_save_expr (build_expr (e->e2));
+   this->result_ = build_float_identity (code, e1, e2);
   }
 else if (tb1->ty == Tstruct)
   {
diff --git a/gcc/testsuite/gdc.dg/runnable.d b/gcc/testsuite/gdc.dg/runnable.d
index 4f1ef76e4..2d33d7d10 100644
--- a/gcc/testsuite/gdc.dg/runnable.d
+++ b/gcc/testsuite/gdc.dg/runnable.d
@@ -1533,6 +1533,27 @@ void test286()
 assert(0);
 }
 
+/**/
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=309
+
+void test309()
+{
+creal f1 = +0.0 + 0.0i;
+creal f2 = +0.0 - 0.0i;
+creal f3 = -0.0 + 0.0i;
+creal f4 = +0.0 + 0.0i;
+
+assert(f1 !is f2);
+assert(f1 !is f3);
+assert(f2 !is f3);
+assert(f1 is f4);
+
+assert(!(f1 is f2));
+assert(!(f1 is f3));
+assert(!(f2 is f3));
+assert(!(f1 !is f4));
+}
+
 /**/
 
 void main()
@@ -1570,6 +1591,7 @@ void main()
 test273();
 test285();
 test286();
+test309();
 
 printf("Success!\n");
 }
-- 
2.19.1



Re: LRA patch for PR87718

2018-11-24 Thread Christophe Lyon
On Thu, 22 Nov 2018 at 18:30, Vladimir Makarov  wrote:
>
>The following patch fixes
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87718
>
>The patch adds a special treatment for moves with a hard register in
> register cost and class calculation.
>
>The patch was bootstrapped and tested on x86-64 and ppc64.
>
>I found two testsuite regressions because of the patch.  The expected
> generated code for PR82361 test is too specific.  GCC with the patch
> generates the same quality code but with a different hard register on
> x86-64.  So I just changed the test for  PR82361.
>
>Another test is for ppc64.  I think the expected generated code for
> this test is wrong.  I'll submit a changed test for a discussion later.
>
>Although I spent much time on the solution and I think it is the
> right one, the patch is in very sensitive area of RA and may affect
> expected code generation for many targets.  I am ready to work on the
> new regressions as soon as they are found.
>
>The patch was committed as rev. 260385.
>

Hi,

This patch introduced at least several ICEs on arm targets:
on arm-none-linux-gnueabi --with-cpu=cortex-a9:
  Executed from: gcc.target/arm/arm.exp
gcc.target/arm/attr-neon-fp16.c (internal compiler error)
gcc.target/arm/pr51968.c (internal compiler error)
gcc.target/arm/pr68620.c (internal compiler error)
  Executed from: gcc.target/arm/simd/simd.exp
gcc.target/arm/simd/vextp16_1.c (internal compiler error)
gcc.target/arm/simd/vextp8_1.c (internal compiler error)
gcc.target/arm/simd/vexts16_1.c (internal compiler error)
gcc.target/arm/simd/vexts8_1.c (internal compiler error)
gcc.target/arm/simd/vextu16_1.c (internal compiler error)
gcc.target/arm/simd/vextu8_1.c (internal compiler error)
gcc.target/arm/simd/vrev16p8_1.c (internal compiler error)
gcc.target/arm/simd/vrev16s8_1.c (internal compiler error)
gcc.target/arm/simd/vrev16u8_1.c (internal compiler error)
gcc.target/arm/simd/vrev32p16_1.c (internal compiler error)
gcc.target/arm/simd/vrev32p8_1.c (internal compiler error)
gcc.target/arm/simd/vrev32s16_1.c (internal compiler error)
gcc.target/arm/simd/vrev32s8_1.c (internal compiler error)
gcc.target/arm/simd/vrev32u16_1.c (internal compiler error)
gcc.target/arm/simd/vrev32u8_1.c (internal compiler error)
gcc.target/arm/simd/vrev64f32_1.c (internal compiler error)
gcc.target/arm/simd/vrev64p16_1.c (internal compiler error)
gcc.target/arm/simd/vrev64p8_1.c (internal compiler error)
gcc.target/arm/simd/vrev64s16_1.c (internal compiler error)
gcc.target/arm/simd/vrev64s32_1.c (internal compiler error)
gcc.target/arm/simd/vrev64s8_1.c (internal compiler error)
gcc.target/arm/simd/vrev64u16_1.c (internal compiler error)
gcc.target/arm/simd/vrev64u32_1.c (internal compiler error)
gcc.target/arm/simd/vrev64u8_1.c (internal compiler error)

arm-none-linux-gnueabihf shows only 1 ICE:
gcc.target/arm/pr51968.c (internal compiler error)

There are other regressions on the same targets, but not ICEs.
I can report them later.

Thanks,

Christophe


[PATCH, libstdc++] Uniform container erasure for c++20.

2018-11-24 Thread Ed Smith-Rowland

All,

I's very late but uniform container erasure is, I think, the last little 
tidbit to graduate from fundamentals/v2 to std at the last meeting.  I 
think it would be a shame not to nudge this into gcc-9.  The routines 
are very short so I just copied them. Ditto the testcases (with 
adjustments).  The node erasure tool was moved from experimental to 
std/bits and adjustments made to affected *set/*map headers.


The experimental code has been in our tree since 2015.

This builds and tests clean on x86_64-linux.

Ed


Index: include/Makefile.am
===
--- include/Makefile.am (revision 266430)
+++ include/Makefile.am (working copy)
@@ -106,6 +106,7 @@
${bits_srcdir}/cpp_type_traits.h \
${bits_srcdir}/deque.tcc \
${bits_srcdir}/enable_special_members.h \
+   ${bits_srcdir}/erase_if.h \
${bits_srcdir}/forward_list.h \
${bits_srcdir}/forward_list.tcc \
${bits_srcdir}/fs_dir.h \
@@ -710,7 +711,6 @@
 experimental_bits_srcdir = ${glibcxx_srcdir}/include/experimental/bits
 experimental_bits_builddir = ./experimental/bits
 experimental_bits_headers = \
-   ${experimental_bits_srcdir}/erase_if.h \
${experimental_bits_srcdir}/lfts_config.h \
${experimental_bits_srcdir}/net.h \
${experimental_bits_srcdir}/shared_ptr.h \
Index: include/Makefile.in
===
--- include/Makefile.in (revision 266430)
+++ include/Makefile.in (working copy)
@@ -449,6 +449,7 @@
${bits_srcdir}/cpp_type_traits.h \
${bits_srcdir}/deque.tcc \
${bits_srcdir}/enable_special_members.h \
+   ${bits_srcdir}/erase_if.h \
${bits_srcdir}/forward_list.h \
${bits_srcdir}/forward_list.tcc \
${bits_srcdir}/fs_dir.h \
@@ -1052,7 +1053,6 @@
 experimental_bits_srcdir = ${glibcxx_srcdir}/include/experimental/bits
 experimental_bits_builddir = ./experimental/bits
 experimental_bits_headers = \
-   ${experimental_bits_srcdir}/erase_if.h \
${experimental_bits_srcdir}/lfts_config.h \
${experimental_bits_srcdir}/net.h \
${experimental_bits_srcdir}/shared_ptr.h \
Index: include/bits/erase_if.h
===
--- include/bits/erase_if.h (revision 266430)
+++ include/bits/erase_if.h (working copy)
@@ -1,4 +1,4 @@
-//  -*- C++ -*-
+//  -*- C++ -*-
 
 // Copyright (C) 2015-2018 Free Software Foundation, Inc.
 //
@@ -22,27 +22,22 @@
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // .
 
-/** @file experimental/bits/erase_if.h
+/** @file bits/erase_if.h
  *  This is an internal header file, included by other library headers.
  *  Do not attempt to use it directly.
  */
 
-#ifndef _GLIBCXX_EXPERIMENTAL_ERASE_IF_H
-#define _GLIBCXX_EXPERIMENTAL_ERASE_IF_H 1
+#ifndef _GLIBCXX_ERASE_IF_H
+#define _GLIBCXX_ERASE_IF_H 1
 
 #pragma GCC system_header
 
 #if __cplusplus >= 201402L
-#include 
 
 namespace std
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-namespace experimental
-{
-inline namespace fundamentals_v2
-{
   namespace __detail
   {
 template
@@ -59,8 +54,6 @@
}
   }
   } // namespace __detail
-} // inline namespace fundamentals_v2
-} // namespace experimental
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
@@ -67,4 +60,4 @@
 
 #endif // C++14
 
-#endif // _GLIBCXX_EXPERIMENTAL_ERASE_IF_H
+#endif // _GLIBCXX_ERASE_IF_H
Index: include/experimental/bits/erase_if.h
===
--- include/experimental/bits/erase_if.h(revision 266430)
+++ include/experimental/bits/erase_if.h(nonexistent)
@@ -1,70 +0,0 @@
-//  -*- C++ -*-
-
-// Copyright (C) 2015-2018 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// .
-
-/** @file experimental/bits/erase_if.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt t

[patch, libgfortran] PR88052 - Format contravening f2008 constraint C1002 permitted

2018-11-24 Thread Jerry DeLisle

Hi all,

The attached patch adjusts the constraint of missing commas between
format specifiers by only allowing if std=legacy is given at compile time.

Several existing test cases are adjusted to be standard conforming.

Regression tested on x86-64-linux-gnu.

OK for trunk? (I will include the a change log for the testsuite.)

Jerry

2018-11-24  Jerry DeLisle  

PR libfortran/88052

* io/format.c (parse_format_list): Implement constraint which prohibits
  missing commas between format specifiers unless -std=legacy is given.
diff --git a/gcc/testsuite/gfortran.dg/comma_format_extension_4.f b/gcc/testsuite/gfortran.dg/comma_format_extension_4.f
index 30f07e803c5..1d018380f9c 100644
--- a/gcc/testsuite/gfortran.dg/comma_format_extension_4.f
+++ b/gcc/testsuite/gfortran.dg/comma_format_extension_4.f
@@ -1,7 +1,7 @@
 ! PR fortran/13257
-! Note the missing , before i1 in the format.
+! Note the missing , after i4 in the format.
 ! { dg-do run }
-! { dg-options "" }
+! { dg-options "-std=legacy" }
   character*6 c
   write (c,1001) 1
   if (c .ne. '1 ') STOP 1
diff --git a/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_2.f b/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_2.f
index 437f4dfd811..de583f374dc 100644
--- a/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_2.f
+++ b/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_2.f
@@ -1,5 +1,5 @@
 ! { dg-do run }
-! { dg-options "-w" }
+! { dg-options "-w -std=legacy" }
 ! PR25545 internal file and dollar edit descriptor.
   program main
   character*20 line
diff --git a/gcc/testsuite/gfortran.dg/fmt_error_9.f b/gcc/testsuite/gfortran.dg/fmt_error_9.f
index 1d677509e37..23aee89208d 100644
--- a/gcc/testsuite/gfortran.dg/fmt_error_9.f
+++ b/gcc/testsuite/gfortran.dg/fmt_error_9.f
@@ -4,7 +4,7 @@
 ! Test case prepared by Jerry DeLisle 
   character(len=25) :: str
   character(len=132) :: msg, line
-  str = '(1pd24.15e6)'
+  str = '(1pd24.15,e6)'
   line = "initial string"
   x = 555.25
   
@@ -19,11 +19,11 @@
   if (istat.ne.5006 .or. msg(1:15).ne."Positive width ") STOP 4
   if (x.ne.555.25) STOP 5
   
-  write (line,'(1pd24.15e11.3)') 1.0d0, 1.234
+  write (line,'(1pd24.15,e11.3)') 1.0d0, 1.234
   if (line.ne."   1.000D+00  1.234E+00") STOP 6
   
   str = '(1p2d24.15)'
   msg = "   1.000D+00   1.23367575073D+00That's it!"
-  write (line,'(1p2d24.15a)') 1.0d0, 1.234, "That's it!"
+  write (line,'(1p2d24.15,a)') 1.0d0, 1.234, "That's it!"
   if (line.ne.msg) print *, msg
   end
diff --git a/gcc/testsuite/gfortran.dg/fmt_g0_5.f08 b/gcc/testsuite/gfortran.dg/fmt_g0_5.f08
index d2a97b1ac80..cafd90b94b5 100644
--- a/gcc/testsuite/gfortran.dg/fmt_g0_5.f08
+++ b/gcc/testsuite/gfortran.dg/fmt_g0_5.f08
@@ -6,13 +6,13 @@ program test_g0_special
 
 call check_all("(g10.3)", "(f10.3)")
 call check_all("(g10.3e3)", "(f10.3)")
-call check_all("(spg10.3)", "(spf10.3)")
-call check_all("(spg10.3e3)", "(spf10.3)")
+call check_all("(sp,g10.3)", "(sp,f10.3)")
+call check_all("(sp,g10.3e3)", "(sp,f10.3)")
 !print *, "---"
 call check_all("(g0)", "(f0.0)")
 call check_all("(g0.15)", "(f0.0)")
-call check_all("(spg0)", "(spf0.0)")
-call check_all("(spg0.15)", "(spf0.0)")
+call check_all("(sp,g0)", "(sp,f0.0)")
+call check_all("(sp,g0.15)", "(sp,f0.0)")
 contains
 subroutine check_all(fmt1, fmt2)
 character(len=*), intent(in) :: fmt1, fmt2
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_2.f90 b/gcc/testsuite/gfortran.dg/fmt_t_2.f90
index 01647655de6..56414c54bfb 100644
--- a/gcc/testsuite/gfortran.dg/fmt_t_2.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_t_2.f90
@@ -12,7 +12,7 @@
   read (11, '(a040,t1,040a)', end = 999)  foost1 , foost2
   if (foost1.ne.foost2) STOP 1
 
-  read (11, '(a032,t2,a032t3,a032)', end = 999)  foost1 , foost2, foost3
+  read (11, '(a032,t2,a032,t3,a032)', end = 999)  foost1 , foost2, foost3
   if (foost1(1:32).ne."123456789 123456789 123456789   ") STOP 2
   if (foost2(1:32).ne."23456789 123456789 123456789") STOP 3
   if (foost3(1:32).ne."3456789 123456789 123456789 ") STOP 4
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index f5d3158d21d..5ad57bef316 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -46,7 +46,8 @@ static const char posint_required[] = "Positive width required in format",
   bad_string[] = "Unterminated character constant in format",
   bad_hollerith[] = "Hollerith constant extends past the end of the format",
   reversion_error[] = "Exhausted data descriptors in format",
-  zero_width[] = "Zero width in format descriptor";
+  zero_width[] = "Zero width in format descriptor",
+  comma_missing[] = "Missing comma between descriptors";
 
 /* The following routines support caching format data from parsed format strings
into a hash table.  This avoids rep

Re: Fix hashtable memory leak

2018-11-24 Thread François Dumont
Tests have shown a regression. I was building the _ReuseOrAllocNode 
instance too early, node ownership was transfered but was still owned by 
_Hashtable instance.


This new version pass all tests.

Ok to commit ?

François



On 11/19/18 10:23 PM, François Dumont wrote:
There a memory leak when move assigning between 2 instances with 
different bucket count and non-propagating and unequal allocator 
instances (see new test03).


I reduced code duplication to fix the issue as 1 of the 2 
implementations was fine.


    * include/bits/hashtable.h (_Hashtable<>::_M_replicate): New.
    (_Hashtable<>::operator=(const _Hashtable&)): Use latter.
    (_Hashtable<>::_M_move_assign(_Hashtable&&, false_type)): Likewise.
    * testsuite/23_containers/unordered_set/allocator/move_assign.cc
    (test03): New.

I still need to run all tests but new move_assign.cc works fine.

Ok to commit once fully tested ?

François



diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index efc4c4ab94f..caa4e8ad20c 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -398,6 +398,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   _M_begin() const
   { return static_cast<__node_type*>(_M_before_begin._M_nxt); }
 
+  template
+	void
+	_M_replicate(_Ht&&, const _NodeGenerator&);
+
   template
 	void
 	_M_assign(const _Hashtable&, const _NodeGenerator&);
@@ -1058,6 +1062,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
 
   // Reuse allocated buckets and nodes.
+  _M_replicate(__ht,
+	[](const __reuse_or_alloc_node_type& __roan, const __node_type* __n)
+	{ return __roan(__n->_M_v()); });
+  return *this;
+}
+
+  template
+template
+  void
+  _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,
+		 _H1, _H2, _Hash, _RehashPolicy, _Traits>::
+  _M_replicate(_Ht&& __ht, const _NodeGenerator& __node_gen)
+  {
 	__bucket_type* __former_buckets = nullptr;
 	std::size_t __former_bucket_count = _M_bucket_count;
 	const __rehash_state& __former_state = _M_rehash_policy._M_state();
@@ -1074,14 +1094,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 	__try
 	  {
-	  __hashtable_base::operator=(__ht);
+	__hashtable_base::operator=(std::forward<_Ht>(__ht));
 	_M_element_count = __ht._M_element_count;
 	_M_rehash_policy = __ht._M_rehash_policy;
 	__reuse_or_alloc_node_type __roan(_M_begin(), *this);
 	_M_before_begin._M_nxt = nullptr;
 	_M_assign(__ht,
-		[&__roan](const __node_type* __n)
-		{ return __roan(__n->_M_v()); });
+		  [&__node_gen, &__roan](__node_type* __n)
+		  { return __node_gen(__roan, __n); });
 	if (__former_buckets)
 	  _M_deallocate_buckets(__former_buckets, __former_bucket_count);
 	  }
@@ -1099,7 +1119,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 			 _M_bucket_count * sizeof(__bucket_type));
 	__throw_exception_again;
 	  }
-  return *this;
   }
 
   template_M_v())); });
 	  __ht.clear();
 	}
-	  __catch(...)
-	{
-	  if (__former_buckets)
-		{
-		  _M_deallocate_buckets();
-		  _M_rehash_policy._M_reset(__former_state);
-		  _M_buckets = __former_buckets;
-		  _M_bucket_count = __former_bucket_count;
-		}
-	  __builtin_memset(_M_buckets, 0,
-			   _M_bucket_count * sizeof(__bucket_type));
-	  __throw_exception_again;
-	}
-	}
 }
 
   template
+#include 
+
 #include 
 #include 
 #include 
@@ -27,7 +29,9 @@ using __gnu_test::counter_type;
 
 void test01()
 {
-  typedef propagating_allocator alloc_type;
+  {
+typedef propagating_allocator> alloc_type;
 typedef __gnu_test::counter_type_hasher hash;
 typedef std::unordered_set,
@@ -50,9 +54,15 @@ void test01()
 VERIFY( counter_type::destructor_count == 2 );
   }
 
+  // Check there's nothing left allocated or constructed.
+  __gnu_cxx::annotate_base::check();
+}
+
 void test02()
 {
-  typedef propagating_allocator alloc_type;
+  {
+typedef propagating_allocator> alloc_type;
 typedef __gnu_test::counter_type_hasher hash;
 typedef std::unordered_set,
@@ -80,9 +90,48 @@ void test02()
 VERIFY( it == v2.begin() );
   }
 
+  // Check there's nothing left allocated or constructed.
+  __gnu_cxx::annotate_base::check();
+}
+
+void test03()
+{
+  {
+typedef propagating_allocator> alloc_type;
+typedef __gnu_test::counter_type_hasher hash;
+typedef std::unordered_set,
+			   alloc_type> test_type;
+
+test_type v1(alloc_type(1));
+v1.emplace(0);
+
+test_type v2(alloc_type(2));
+int i = 0;
+v2.emplace(i++);
+for (; v2.bucket_count() == v1.bucket_count(); ++i)
+  v2.emplace(i);
+
+counter_type::reset();
+
+v2 = std::move(v1);
+
+VERIFY( 1 == v1.get_allocator().get_personality() );
+VERIFY( 2 == v2.get_allocator().get_personality() );
+
+VERIFY( counter_type::move_count == 1  );
+VERIFY( counter_type::destructor_count == i + 1 );
+  }
+
+  // Check there's nothing left allocated or constructed.
+  __gnu

Re: [patch, libgfortran] PR88052 - Format contravening f2008 constraint C1002 permitted

2018-11-24 Thread Dominique d'Humières
Hi Jerry,

> OK for trunk?

Could you give me some time to post some comments in bugzilla?

TIA

Dominique


Re: [patch, libgfortran] PR88052 - Format contravening f2008 constraint C1002 permitted

2018-11-24 Thread Jerry DeLisle

On 11/24/18 2:51 PM, Dominique d'Humières wrote:

Hi Jerry,


OK for trunk?


Could you give me some time to post some comments in bugzilla?


Sure, no rush.



TIA

Dominique





One more patch for PR88157

2018-11-24 Thread Vladimir Makarov
  Sorry,  my patch for pr88157 caused a lot of ICEs on different 
targets.  The problem that cost vector was not initialized on some 
targets for some modes (we use a lazy approach in cost calculations in 
RA).  Here is the patch which should fix the ICEs.


  Committed as rev. 266435.


Index: ChangeLog
===
--- ChangeLog	(revision 266434)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2018-11-25  Vladimir Makarov  
+
+	PR bootstrap/88157
+	* ira-costs.c (record_operand_costs): Initiate register move cost
+	for mode.
+
 2018-11-23  Jeff Law  
 
 	PR rtl-optimization/87468
Index: ira-costs.c
===
--- ira-costs.c	(revision 266422)
+++ ira-costs.c	(working copy)
@@ -1318,6 +1318,7 @@ record_operand_costs (rtx_insn *insn, en
 	  int cost, k;
 	  bool dead_p = find_regno_note (insn, REG_DEAD, REGNO (src));
 
+	  ira_init_register_move_cost_if_necessary (mode);
 	  hard_reg_class = REGNO_REG_CLASS (other_regno);
 	  /* Target code may return any cost for mode which does not
 	 fit the the hard reg class (e.g. DImode for AREG on


Re: patch to fix PR88157

2018-11-24 Thread Vladimir Makarov

On 11/24/2018 02:10 AM, Jeff Law wrote:

On 11/23/18 3:04 PM, Vladimir Makarov wrote:

   The following patch fixes

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88157

   The patch was successfully bootstrapped on x86 and x86-64 with GO and D.

   Committed as rev. 266422.


pr88157.patch

Index: ChangeLog
===
--- ChangeLog   (revision 266421)
+++ ChangeLog   (working copy)
@@ -1,3 +1,9 @@
+2018-11-23  Vladimir Makarov  
+
+   PR bootstrap/88157
+   * ira-costs.c (record_operand_costs): Use bigger hard reg class if
+   its mode does not fit to the original class.

We're still having problems in this code.  I've got about a half-dozen
targets failing.

Try an nds32be-elf cross compiler with the attached testcase.  -O2
-mcmodel=small

It should be failing just below when we try to access
ira_register_move_cost[mode][hard_reg_class][rclass]
Thanks for testing, Jeff.  I've just committed a patch which should fix 
the problems.