[PATCH, AArch64] Add support for "wsp" register

2013-07-04 Thread Yufeng Zhang

Hi,

This patch adds support for the register "wsp"; in ILP32, this is 
necessary in order to support the global register variable associated 
the stack pointer with the syntax asm ("wsp"); it is used in libgloss to 
get the stack pointer.


OK for the trunk?

Thanks,
Yufeng


gcc/

* config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Also 
return

true for SP_REGNUM if mode == ptr_mode.
* config/aarch64/aarch64.h (ADDITIONAL_REGISTER_NAMES): Add "wsp"
with value R0_REGNUM + 31.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 7049651..46c11bc 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -358,8 +358,13 @@ aarch64_hard_regno_mode_ok (unsigned regno, enum machine_mode mode)
   if (GET_MODE_CLASS (mode) == MODE_CC)
 return regno == CC_REGNUM;
 
-  if (regno == SP_REGNUM || regno == FRAME_POINTER_REGNUM
-  || regno == ARG_POINTER_REGNUM)
+  if (regno == SP_REGNUM)
+/* The purpose of comparing with ptr_mode is to support the
+   global register variable associated with the stack pointer
+   register via the syntax of asm ("wsp") in ILP32.  */
+return mode == Pmode || mode == ptr_mode;
+
+  if (regno == FRAME_POINTER_REGNUM || regno == ARG_POINTER_REGNUM)
 return mode == Pmode;
 
   if (GP_REGNUM_P (regno) && ! aarch64_vect_struct_mode_p (mode))
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index e1fa413..0924269 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -278,7 +278,7 @@ extern unsigned long aarch64_tune_flags;
 R_ALIASES(16), R_ALIASES(17), R_ALIASES(18), R_ALIASES(19), \
 R_ALIASES(20), R_ALIASES(21), R_ALIASES(22), R_ALIASES(23), \
 R_ALIASES(24), R_ALIASES(25), R_ALIASES(26), R_ALIASES(27), \
-R_ALIASES(28), R_ALIASES(29), R_ALIASES(30), /* 31 omitted  */ \
+R_ALIASES(28), R_ALIASES(29), R_ALIASES(30), {"wsp", R0_REGNUM + 31}, \
 V_ALIASES(0),  V_ALIASES(1),  V_ALIASES(2),  V_ALIASES(3),  \
 V_ALIASES(4),  V_ALIASES(5),  V_ALIASES(6),  V_ALIASES(7),  \
 V_ALIASES(8),  V_ALIASES(9),  V_ALIASES(10), V_ALIASES(11), \

RE: [AArch64] Convert ld1, st1 arm_neon.h intrinsics to RTL builtins.

2013-07-04 Thread James Greenhalgh

> > 2013-07-02  James Greenhalgh  
> >
> > * config/aarch64/aarch64-builtins.c
> > (aarch64_simd_expand_builtin): Handle AARCH64_SIMD_STORE1.
> > * config/aarch64/aarch64-simd-builtins.def (ld1): New.
> > (st1): Likewise.
> > * config/aarch64/aarch64-simd.md
> > (aarch64_ld1): New.
> > (aarch64_st1): Likewise.
> > * config/aarch64/arm_neon.h
> > (vld1_<8, 16, 32, 64>): Convert to RTL builtins.
> >
>
> OK
> /Marcus

Thanks Marcus,

I've committed this as r200634.

As this is a bug-fix I'd like to backport it to the 4.8 branch.
I've attached a copy of the patch that applies to 4.8
and run it through testing on aarch64-none-elf with no issues.

Is this OK to commit to gcc-4_8-branch?

Thanks,
James

---
gcc/

2013-07-04  James Greenhalgh  

Backport From mainline:
2013-07-03  James Greenhalgh  

* config/aarch64/aarch64-builtins.c
(aarch64_simd_expand_builtin): Handle AARCH64_SIMD_STORE1.
* config/aarch64/aarch64-simd-builtins.def (ld1): New.
(st1): Likewise.
* config/aarch64/aarch64-simd.md
(aarch64_ld1): New.
(aarch64_st1): Likewise.
* config/aarch64/arm_neon.h
(vld1_<8, 16, 32, 64>): Convert to RTL builtins.
diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index 1ea55a8..b2901db 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -1154,6 +1154,7 @@ aarch64_simd_expand_builtin (int fcode, tree exp, rtx target)
   return aarch64_simd_expand_args (target, icode, 1, exp,
    SIMD_ARG_COPY_TO_REG, SIMD_ARG_STOP);
 
+case AARCH64_SIMD_STORE1:
 case AARCH64_SIMD_STORESTRUCT:
   return aarch64_simd_expand_args (target, icode, 0, exp,
    SIMD_ARG_COPY_TO_REG,
diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def
index a6a5e12..955da26 100644
--- a/gcc/config/aarch64/aarch64-simd-builtins.def
+++ b/gcc/config/aarch64/aarch64-simd-builtins.def
@@ -256,3 +256,10 @@
   BUILTIN_VALL (BINOP, uzp2)
   BUILTIN_VALL (BINOP, trn1)
   BUILTIN_VALL (BINOP, trn2)
+
+  /* Implemented by aarch64_ld1.  */
+  BUILTIN_VALL (LOAD1, ld1)
+
+  /* Implemented by aarch64_st1.  */
+  BUILTIN_VALL (STORE1, st1)
+
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 79c3093..00f3c31 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -3457,6 +3457,17 @@
   DONE;
 })
 
+(define_expand "aarch64_ld1"
+ [(match_operand:VALL 0 "register_operand")
+  (match_operand:DI 1 "register_operand")]
+  "TARGET_SIMD"
+{
+  enum machine_mode mode = mode;
+  rtx mem = gen_rtx_MEM (mode, operands[1]);
+  emit_move_insn (operands[0], mem);
+  DONE;
+})
+
 (define_expand "aarch64_ld"
  [(match_operand:VSTRUCT 0 "register_operand" "=w")
   (match_operand:DI 1 "register_operand" "r")
@@ -3673,6 +3684,17 @@
   DONE;
 })
 
+(define_expand "aarch64_st1"
+ [(match_operand:DI 0 "register_operand")
+  (match_operand:VALL 1 "register_operand")]
+  "TARGET_SIMD"
+{
+  enum machine_mode mode = mode;
+  rtx mem = gen_rtx_MEM (mode, operands[0]);
+  emit_move_insn (mem, operands[1]);
+  DONE;
+})
+
 ;; Expander for builtins to insert vector registers into large
 ;; opaque integer modes.
 
diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
index 669217e..60e1f7d 100644
--- a/gcc/config/aarch64/arm_neon.h
+++ b/gcc/config/aarch64/arm_neon.h
@@ -8518,28 +8518,6 @@ vld1_dup_u64 (const uint64_t * a)
   return result;
 }
 
-__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
-vld1_f32 (const float32_t * a)
-{
-  float32x2_t result;
-  __asm__ ("ld1 {%0.2s}, %1"
-	   : "=w"(result)
-	   : "Utv"(({const float32x2_t *_a = (float32x2_t *) a; *_a;}))
-	   : /* No clobbers */);
-  return result;
-}
-
-__extension__ static __inline float64x1_t __attribute__ ((__always_inline__))
-vld1_f64 (const float64_t * a)
-{
-  float64x1_t result;
-  __asm__ ("ld1 {%0.1d}, %1"
-	   : "=w"(result)
-	   : "Utv"(*a)
-	   : /* No clobbers */);
-  return result;
-}
-
 #define vld1_lane_f32(a, b, c)  \
   __extension__ \
 ({  \
@@ -8696,116 +8674,6 @@ vld1_f64 (const float64_t * a)
result;  \
  })
 
-__extension__ static __inline poly8x8_t __attribute__ ((__always_inline__))
-vld1_p8 (const poly8_t * a)
-{
-  poly8x8_t result;
-  __asm__ ("ld1 {%0.8b}, %1"
-	   : "=w"(result)
-	   : "Utv"(({const poly8x8_t *_a = (poly8x8_t *) a; *_a;}))
-	   : /* No clobbers */);
-  return result;
-}
-
-__extension__ static __inline poly16x4_t __attribute__ ((__always_inline__))
-vld1_p16 (const poly16_t * a)
-{
-  poly16x4_t result;
-  __asm__ ("ld1 {%0.4h}, %1"
-	   : "=w"(r

[v3] libstdc++/57808

2013-07-04 Thread Paolo Carlini

Hi,

committed to mainline.

Thanks,
Paolo.

/
2013-07-04  Ray Chason  
Paolo Carlini  

PR libstdc++/57808
* include/bits/regex.h (regex_token_iterator<>::operator==,
regex_token_iterator<>::operator!=, regex_token_iterator<>::operator*,
regex_token_iterator<>::operator->): Declare const.
Index: include/bits/regex.h
===
--- include/bits/regex.h(revision 200643)
+++ include/bits/regex.h(working copy)
@@ -2404,7 +2404,7 @@
* @todo Implement this function.
*/
   regex_token_iterator(const regex_token_iterator& __rhs);
-  
+
   /**
* @brief Assigns a %regex_token_iterator to another.
* @param __rhs [IN] A %regex_token_iterator to copy.
@@ -2412,49 +2412,49 @@
*/
   regex_token_iterator&
   operator=(const regex_token_iterator& __rhs);
-  
+
   /**
* @brief Compares a %regex_token_iterator to another for equality.
* @todo Implement this function.
*/
   bool
-  operator==(const regex_token_iterator& __rhs);
-  
+  operator==(const regex_token_iterator& __rhs) const;
+
   /**
* @brief Compares a %regex_token_iterator to another for inequality.
* @todo Implement this function.
*/
   bool
-  operator!=(const regex_token_iterator& __rhs);
-  
+  operator!=(const regex_token_iterator& __rhs) const;
+
   /**
* @brief Dereferences a %regex_token_iterator.
* @todo Implement this function.
*/
   const value_type&
-  operator*();
-  
+  operator*() const;
+
   /**
* @brief Selects a %regex_token_iterator member.
* @todo Implement this function.
*/
   const value_type*
-  operator->();
-  
+  operator->() const;
+
   /**
* @brief Increments a %regex_token_iterator.
* @todo Implement this function.
*/
   regex_token_iterator&
   operator++();
-  
+
   /**
* @brief Postincrements a %regex_token_iterator.
* @todo Implement this function.
*/
   regex_token_iterator
   operator++(int);
-  
+
 private: // data members for exposition only:
   typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator;
 


Re: [PING] Re: C++ 2014 status page for libstdc++

2013-07-04 Thread Jonathan Wakely
On 3 July 2013 22:42, Ed Smith-Rowland wrote:
> On 06/27/2013 11:24 PM, Ed Smith-Rowland wrote:
>>
>> Finally, should we put a line for thins in the 4.9 changes page?
>>
>>
> PING!  Is adding links to the C++2014 library page OK?

>From http://gcc.gnu.org/gcc-4.9/changes.html? Yes, that's OK, the
source for that page is in the CVS repo, send the patch to gcc-patches
and commit it as pre-approved by me assuming you validate the HTML.  I
usually put [wwwdocs] in the subject line of the mail to gcc-patches.

Thanks.


Ping: [PATCH] Set $ac_aux_dir before use in libdecnumber/configure

2013-07-04 Thread Simon Baldwin
Ping.


On 20 June 2013 20:19, Simon Baldwin  wrote:
> Set $ac_aux_dir before use in libdecnumber/configure.
>
> libdecnumber/configure uses $ac_aux_dir before it is set, causing incorrect
> MISSING value.  Fix with explicit AC_CONFIG_AUX_DIR.
>
> Bootstrapped for c/c++.  Okay for trunk?
>
>
> libdecnumber/ChangeLog
> 2013-06-20  Simon Baldwin  
>
> * configure.ac: Add AC_CONFIG_AUX_DIR.
> * configure: Regenerated.
>
>
> Index: libdecnumber/configure.ac
> ===
> --- libdecnumber/configure.ac   (revision 200246)
> +++ libdecnumber/configure.ac   (working copy)
> @@ -23,6 +23,7 @@ AC_PREREQ(2.64)
>  AC_INIT(libdecnumber, [ ], gcc-b...@gcc.gnu.org, libdecnumber)
>  AC_CONFIG_SRCDIR(decNumber.h)
>  AC_CONFIG_MACRO_DIR(../config)
> +AC_CONFIG_AUX_DIR(..)
>
>  # Checks for programs.
>  AC_PROG_MAKE_SET
> Index: libdecnumber/configure
> ===
> --- libdecnumber/configure  (revision 200246)
> +++ libdecnumber/configure  (working copy)
> @@ -2220,6 +2220,29 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
>
>
>
> +ac_aux_dir=
> +for ac_dir in .. "$srcdir"/..; do
> +  for ac_t in install-sh install.sh shtool; do
> +if test -f "$ac_dir/$ac_t"; then
> +  ac_aux_dir=$ac_dir
> +  ac_install_sh="$ac_aux_dir/$ac_t -c"
> +  break 2
> +fi
> +  done
> +done
> +if test -z "$ac_aux_dir"; then
> +  as_fn_error "cannot find install-sh, install.sh, or shtool in .. 
> \"$srcdir\"/.." "$LINENO" 5
> +fi
> +
> +# These three variables are undocumented and unsupported,
> +# and are intended to be withdrawn in a future Autoconf release.
> +# They can cause serious problems if a builder's source tree is in a 
> directory
> +# whose full name contains unusual characters.
> +ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this 
> var.
> +ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
> +ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
> +
> +
>
>  # Checks for programs.
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets 
> \$(MAKE)" >&5
> @@ -4458,29 +4481,6 @@ else
>  fi
>
>
> -ac_aux_dir=
> -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
> -  for ac_t in install-sh install.sh shtool; do
> -if test -f "$ac_dir/$ac_t"; then
> -  ac_aux_dir=$ac_dir
> -  ac_install_sh="$ac_aux_dir/$ac_t -c"
> -  break 2
> -fi
> -  done
> -done
> -if test -z "$ac_aux_dir"; then
> -  as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" 
> \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
> -fi
> -
> -# These three variables are undocumented and unsupported,
> -# and are intended to be withdrawn in a future Autoconf release.
> -# They can cause serious problems if a builder's source tree is in a 
> directory
> -# whose full name contains unusual characters.
> -ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this 
> var.
> -ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
> -ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
> -
> -
>  # Make sure we can run config.sub.
>  $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
>as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5



--
Google UK Limited | Registered Office: Belgrave House, 76 Buckingham
Palace Road, London SW1W 9TQ | Registered in England Number: 3977902


Re: MIPS elimate trap-if-zero instruction if possible for divisions

2013-07-04 Thread Graham Stott
Hi Jeff, Richard

We could possibly also use VRP to change signed division to unsigned division 
when dividing a
non-negative signed operand by a power of 2 because then the sign bit will be 0 
and we could do
the division using logical shift right.
 
Graham


Re: [patch i386]: RFC enable inlining for function with machine-attributes

2013-07-04 Thread Kai Tietz
Hi,

here is the adjusted patch for this PR.

2013-07-04  Kai Tietz  

PR target/56892
* config/i386/i386.c (TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P): Define as
hook_bool_const_tree_true.


Tested for x86_64-w64-mingw32, i686-pc-cygwin, and
x86_64-unknown-linux-gnu.  Ok for apply?

Regards,
Kai

Index: i386.c
===
--- i386.c  (Revision 200643)
+++ i386.c  (Arbeitskopie)
@@ -42701,6 +42701,8 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val)

 #undef TARGET_ATTRIBUTE_TABLE
 #define TARGET_ATTRIBUTE_TABLE ix86_attribute_table
+#undef TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P
+#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_const_tree_true
 #if TARGET_DLLIMPORT_DECL_ATTRIBUTES
 #  undef TARGET_MERGE_DECL_ATTRIBUTES
 #  define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes


[C++ testcase, committed] PR 54998

2013-07-04 Thread Paolo Carlini

Hi,

tested x86_64-linux, committed to mainline.

Thanks,
Paolo.

/
2013-07-04  Paolo Carlini  

PR c++/54998
* g++.dg/cpp0x/nsdmi-list3.C: New.
Index: g++.dg/cpp0x/nsdmi-list3.C
===
--- g++.dg/cpp0x/nsdmi-list3.C  (revision 0)
+++ g++.dg/cpp0x/nsdmi-list3.C  (working copy)
@@ -0,0 +1,21 @@
+// PR c++/54998
+// { dg-do compile { target c++11 } }
+
+class Foo {
+public:
+private:
+static const int kRows = 4;
+static const int kCols = 4;
+
+union {
+float m_n[kRows][kCols];
+float m_m[kRows * kCols] = {
+1.0f, 0.0f, 0.0f, 0.0f,
+0.0f, 1.0f, 0.0f, 0.0f,
+0.0f, 0.0f, 1.0f, 0.0f,
+0.0f, 0.0f, 0.0f, 1.0f
+};
+};
+};
+
+Foo myFoo;


RE: [PATCH,i386] Default alignment for AMD BD and BT

2013-07-04 Thread Gopalasubramanian, Ganesh
Hi Uros,

Can this be backported now!

Regards
Ganesh

-Original Message-
From: Uros Bizjak [mailto:ubiz...@gmail.com] 
Sent: Thursday, May 30, 2013 1:40 PM
To: Gopalasubramanian, Ganesh
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH,i386] Default alignment for AMD BD and BT

On Wed, May 29, 2013 at 1:28 PM, Gopalasubramanian, Ganesh 
 wrote:

> We want this to be backported to GCC48 branch.
> Please approve.
>
> -Original Message-
> From: Uros Bizjak [mailto:ubiz...@gmail.com]
> Sent: Tuesday, May 07, 2013 6:22 PM
> To: Gopalasubramanian, Ganesh
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH,i386] Default alignment for AMD BD and BT
>
> On Tue, May 7, 2013 at 9:16 AM, Gopalasubramanian, Ganesh 
>  wrote:
>
>> The patch updates the alignment values for AMD BD and BT architectures.
>>
>> "make -k check" passes.
>>
>> Is it OK for upstream?
>>
>> 2013-05-07  Ganesh Gopalasubramanian
>> 
>>
>> * config/i386/i386.c (processor_target_table): Modified default
>> alignment values for AMD BD and BT architectures.

This is OK, but please wait until 4.8 branch is open again.

Thanks,
Uros.




Re: [PATCH,i386] Default alignment for AMD BD and BT

2013-07-04 Thread Jakub Jelinek
On Thu, Jul 04, 2013 at 11:14:24AM +, Gopalasubramanian, Ganesh wrote:
> Can this be backported now!

Yes.

Jakub


Re: [PATCH, rs6000] PR target/57150, do not use VSX instructions for long double caller saves

2013-07-04 Thread Joseph S. Myers
On Wed, 3 Jul 2013, Joseph S. Myers wrote:

> That change has the effect that reload thinks TFmode (and no doubt
> TDmode) only takes two registers even when in general registers,
> causing a segfault in glibc's test-ldouble built for soft float.
> 
> I'm testing this patch (this diff is against 4.8 branch) to fix this;
> at least, it fixes the glibc testing issue.  Since the original patch
> went on 4.7 and 4.8 branches as well as trunk, I propose this patch
> for the branches as well as trunk.  You may wish to test it in your
> original VSX configuration.

And here is the patch diffed against trunk sources and tested with no
regressions for cross to powerpc-linux-gnu (soft-float).  This fixes
testsuite failures of the tests
c-c++-common/torture/complex-sign-mixed-add.c,
c-c++-common/torture/complex-sign-mixed-div.c,
c-c++-common/torture/complex-sign-mixed-mul.c,
c-c++-common/torture/complex-sign-mixed-sub.c,
c-c++-common/torture/complex-sign-mul-minus-one.c,
g++.dg/torture/type-generic-1.C, gcc.c-torture/execute/pr44942.c,
gcc.c-torture/execute/regstack-1.c,
gcc.c-torture/execute/ieee/fp-cmp-8l.c, gcc.dg/pr28796-2.c and
gcc.dg/torture/type-generic-1.c.  OK to commit?

2013-07-04  Joseph Myers  

* config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Only
adjust register size for TDmode and TFmode for VSX registers.

Index: config/rs6000/rs6000.c
===
--- config/rs6000/rs6000.c  (revision 200643)
+++ config/rs6000/rs6000.c  (working copy)
@@ -2518,7 +2518,8 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p
  int reg_size2 = reg_size;
 
  /* TFmode/TDmode always takes 2 registers, even in VSX.  */
- if (m == TDmode || m == TFmode)
+ if (TARGET_VSX && VSX_REG_CLASS_P (c)
+ && (m == TDmode || m == TFmode))
reg_size2 = UNITS_PER_FP_WORD;
 
  rs6000_class_max_nregs[m][c]

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [c++-concepts] requires expression semantics

2013-07-04 Thread Andrew Sutton
>> Unfortunately, the behavior differs from the test suite for
>> std::is_convertible. In particular, this fails:
>>
>>  static_assert(__is_convertible_to(int(int), int(&)(int)), "");
>>
>> whereas this succeeds )
>>
>>  static_assert(is_convertible::value, "");
>
>
> Hmm, that probably has to do with reference decay; we don't handle
> conversion from reference type everywhere because there are no expressions
> of reference type.  So perhaps in the case of REFERENCE_TYPE can_convert
> should build a dummy expression and call convert_from_reference; did your
> CAST_EXPR work for this test?

No, not for this case. And for some reason, when I revisited the
problems this morning, user-defined conversions weren't being handled
for conversions between class types. It turns out that you do need an
extra expression to force those lookups.

I ran through every test in the is_convertible unit test with
__is_convertible. There are 2 cases it doesn't address. The conversion
of a function type (int()) to its reference type (int(&)()), and
conversions between classes with implicit constructors or conversion
functions.

Looking at the other uses of can_convert, it seems like they mostly
don't deal with those cases. So, can_convert *might* be extended to
address these cases, but I'd rather be on the safe side and keep this
as a separate function. Which I'm calling can_convert_implicitly,
although may it should be called it is_convertible_to since it defines
the semantics of __is_convertible_to.

Andrew


call.patch
Description: Binary data


Re: [C++ Patch] PR 38634 (Take 2)

2013-07-04 Thread Jason Merrill

On 07/03/2013 03:17 PM, Paolo Carlini wrote:

In the first try, bailing out early in case of error without undoing the
committed changes to decl1 made me a little nervous. The below variant
works at first on newdecl and only if push_template_decl goes well,
copies it back to decl1. Still passes testing on x86_64-linux.


Since newdecl points to the same tree node as decl1, I don't see what 
difference this would make.  And I'm not too worried about making 
changes to a decl that's erroneous anyway.


Your earlier patch, plus removing the FIXME, is OK.

Jason



Re: [PATCH, rs6000, libitm] Enable Hardware Transactional Memory (HTM) support on Power

2013-07-04 Thread David Edelsohn
On Mon, Jul 1, 2013 at 11:12 PM, Peter Bergner  wrote:
> On May 10th, the Power Architecture Advisory Council announced the public
> availability of Power ISA 2.07.
>
>   https://www.power.org/documentation/power-isa-version-2-07/
>
> This patch adds support for Hardware Transactional Memory (HTM) builtins
> as well as a header file that implements a set of builtin like functions
> that provides compatibility with the IBM XL compiler on both Power and
> S390.
>
> The GCC builtins are used to implement the HTM fast path support within 
> libitm.
> All libitm test cases succeed with this patch applied.
>
> This patch bootstraps and regtests with no regressions on powerpc64-linux
> (running the testsuite in both 32-bit and 64-bit modes).
>
> Is this ok for trunk?
>
> Peter
>
>
> libitm/
> * acinclude.m4 (LIBITM_CHECK_AS_HTM): New.
> * configure.ac: Use it.
> (AC_CHECK_HEADERS): Check for sys/auxv.h.
> (AC_CHECK_FUNCS): Check for getauxval.
> * config.h.in, configure: Rebuild.
> * configure.tgt (target_cpu): Add -mhtm to XCFLAGS.
> * config/powerpc/target.h: Include sys/auxv.h and htmintrin.h.
> (USE_HTM_FASTPATH): Define.
> (_TBEGIN_STARTED, _TBEGIN_INDETERMINATE, _TBEGIN_PERSISTENT,
> _HTM_RETRIES) New macros.
> (htm_abort, htm_abort_should_retry, htm_available, htm_begin, 
> htm_init,
> htm_begin_success, htm_commit, htm_transaction_active): New functions.
>
> gcc/
> * config.gcc (powerpc*-*-*): Install htmintrin.h and htmxlintrin.h.
> * config/rs6000/t-rs6000 (MD_INCLUDES): Add htm.md.
> * config/rs6000/rs6000.opt: Add -mhtm option.
> * config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add OPTION_MASK_HTM.
> (ISA_2_7_MASKS_SERVER): Add OPTION_MASK_HTM.
> * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define
> __HTM__ if the HTM instructions are available.
> * config/rs6000/predicates.md (u3bit_cint_operand, 
> u10bit_cint_operand,
> htm_spr_reg_operand): New define_predicates.
> * config/rs6000/rs6000.md (define_attr "type"): Add htm.
> (TFHAR_REGNO, TFIAR_REGNO, TEXASR_REGNO): New define_constants.
> Include htm.md.
> * config/rs6000/rs6000-builtin.def (BU_HTM_0, BU_HTM_1, BU_HTM_2,
> BU_HTM_3, BU_HTM_SPR0, BU_HTM_SPR1): Add support macros for defining
> HTM builtin functions.
> * config/rs6000/rs6000.c (RS6000_BUILTIN_H): New macro.
> (rs6000_reg_names, alt_reg_names): Add HTM SPR register names.
> (rs6000_init_hard_regno_mode_ok): Add support for HTM instructions.
> (rs6000_builtin_mask_calculate): Likewise.
> (rs6000_option_override_internal): Likewise.
> (bdesc_htm): Add new HTM builtin support.
> (htm_spr_num): New function.
> (htm_spr_regno): Likewise.
> (rs6000_htm_spr_icode): Likewise.
> (htm_expand_builtin): Likewise.
> (htm_init_builtins): Likewise.
> (rs6000_expand_builtin): Add support for HTM builtin functions.
> (rs6000_init_builtins): Likewise.
> (rs6000_invalid_builtin, rs6000_opt_mask): Add support for -mhtm 
> option.
> * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for -mhtm.
> (TARGET_HTM, MASK_HTM): Define macros.
> (FIRST_PSEUDO_REGISTER): Adjust for new HTM SPR registers.
> (FIXED_REGISTERS): Likewise.
> (CALL_USED_REGISTERS): Likewise.
> (CALL_REALLY_USED_REGISTERS): Likewise.
> (REG_ALLOC_ORDER): Likewise.
> (enum reg_class): Likewise.
> (REG_CLASS_NAMES): Likewise.
> (REG_CLASS_CONTENTS): Likewise.
> (REGISTER_NAMES): Likewise.
> (ADDITIONAL_REGISTER_NAMES): Likewise.
> (RS6000_BTC_SPR, RS6000_BTC_VOID, RS6000_BTC_32BIT, RS6000_BTC_64BIT,
> RS6000_BTC_MISC_MASK, RS6000_BTM_HTM): New macros.
> (RS6000_BTM_COMMON): Add RS6000_BTM_HTM.
> * config/rs6000/htm.md: New file.
> * config/rs6000/htmintrin.h: New file.
> * config/rs6000/htmxlintrin.h: New file.
>
> gcc/testsuite/
> * lib/target-supports.exp (check_effective_target_powerpc_htm_ok): New
> function to test if HTM is available.
> * gcc.target/powerpc/htm-xl-intrin-1.c: New test.
> * gcc.target/powerpc/htm-builtin-1.c: New test.

The rs6000 parts generally are okay.

The expanders in htm.md should not include constraint letters.

htm_mfpr / htm_mtspr seem half generalized, but I guess the
specialized interaction with the HTM SPR regnos requires that it be
specialized.

Thanks, David

P.S. For large patches, it is better to include the ChangeLog in the
body and attach the patch itself.


[PATCH] Fix pr571518.c test case.

2013-07-04 Thread Marcus Shawcroft

Hello,

This:

http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00767.html

recently introduced test case uses the pattern:

/* { dg-final { scan-rtl-dump-not "REG_EQUIV.*mem.*\"ip\"" "ira" } } */ 




I believe the intention is to look for the three tokens, in order within 
a single instruction, the actual effect is to look for the three tokens, 
in order, anywhere in the dump file.  The test fails for at least arm-* 
and aarch64-* where we happen to have the appropriate three tokens 
spread through the dump file.


/Marcus


2013-07-04  Marcus Shawcroft  

* gcc.dg/pr57518.c: Adjust scan-rtl-dump-not pattern.diff --git a/gcc/testsuite/gcc.dg/pr57518.c b/gcc/testsuite/gcc.dg/pr57518.c
index 4c84a85..47e819c 100644
--- a/gcc/testsuite/gcc.dg/pr57518.c
+++ b/gcc/testsuite/gcc.dg/pr57518.c
@@ -2,7 +2,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-rtl-ira" } */
-/* { dg-final { scan-rtl-dump-not "REG_EQUIV.*mem.*\"ip\"" "ira" } } */
+/* { dg-final { scan-rtl-dump-not "REG_EQUIV\[^\n\]*mem\[^\n\]*\"ip\"" "ira" } } */
 
 char ip[10];
 int total;

[PING] [PATCH 4/4] Fix leading spaces.

2013-07-04 Thread Ondřej Bílka
Ping
On Tue, Jun 18, 2013 at 02:56:52PM +0800, Chung-Ju Wu wrote:
> 2013/6/16 Ondřej Bílka :
> > On Sat, Jun 15, 2013 at 05:13:31PM +0800, Chung-Ju Wu wrote:
> >> 2013/6/14 Joseph S. Myers :
> >> > On Thu, 13 Jun 2013, Richard Biener wrote:
> >> >
> >> >> Btw, rather than these kind of patches I'd appreciate if someone would 
> >> >> look
> >> >> at a simple pre(post?)-commit hook that enforces those whitespace rules.
> >> >
> >> > In the cpp testsuite we definitely want tests with bad whitespace (e.g.
> >> > gcc.dg/cpp/backslash*.c) and generally I think it's wrong to be changing
> >> > whitespace in the testsuite without an understanding of what the test is
> >> > testing and how the whitespace is irrelevant to that (more generally,
> >> > cleanups of compiler tests are suspect without such an understanding of
> >> > what is or is not significant in a particular test).  And so you need to
> >> > allow addition of otherwise bad whitespace there.
> >> >
> >> > It's not obvious whether there might be other cases needing such
> >> > whitespace as well.
> >> >
> >> >> Either by adjusting the committed content or by rejecting the commit(?)
> >> >
> >> > I don't think hooks adjusting committed content are likely to work at 
> >> > all.
> >> >
> >> > --
> >> > Joseph S. Myers
> >> > jos...@codesourcery.com
> >>
> >> By having a look at Ondřej's patch, it is nice to fix existing
> >> codes with proper whitespace/tab rules.
> >>
> >> But it covers too much under whole gcc source tree.
> >> Like Joseph said, we may accidentally change the cases
> >> that need bad whitespace.
> >>
> >> Perhaps we should gradually fix them?  i.e. We can only fix
> >> leading spaces for some obvious cases (gcc/*.c gcc/c-family/*.c ...),
> >> leaving other source (gcc/testsuite/* gcc/config/* ...) untouched.
> >>
> > I uploaded new version that touches only gcc/*.[ch] gcc/c-family/*.[ch]
> > to http://kam.mff.cuni.cz/~ondra/stylepp.tar.bz2
> > patches are also updated.
> >
> 
> IMHO, the preliminary whitelist could be:
>   gcc/*.[ch]
>   gcc/c/*.[ch]
>   gcc/c-family/*.[ch]
>   gcc/common/*.[ch]
>   gcc/cp/*.[ch]
> 
> > Anyway what in gcc/config/*.c depends on leading/trailing spaces?
> >
> 
> In general, I agree with you that all stuff under gcc/config/ and
> gcc/common/config/ are supposed to follow whitespace rules.
> But I think it would be better to have corresponding port maintainers
> make the decision.
> 
> Your tool and patches look great to me.  It helps fixup the existing
> codes with strong whitespace convention.
> But I am sorry that I don't have right to approve it.
> You will need some reviewers to review the patch and give the OK.
> 
> If you do not receive any response to the patches within two weeks or so,
> you can 'ping' it with a follow-up mail to remind reviewers. :)
> 
> 
> Best regards,
> jasonwucj

-- 

boss forgot system password


Re: RFA: fix vrp66.c spurious failure for 16 bit int

2013-07-04 Thread Jakub Jelinek
On Tue, Jul 02, 2013 at 01:14:35PM -0400, Joern Rennecke wrote:
> 2013-07-02  Joern Rennecke 
> 
>   * testsuite/gcc.dg/tree-ssa/vrp66.c: Make conditional on

No testsuite/ in the ChangeLog entry.

>   { target { ! int16 } } .
>   * gcc.dg/tree-ssa/vrp66-int16-sw.c: New test.

Ok with that change.

Jakub


Re: [PATCH] Fix pr571518.c test case.

2013-07-04 Thread Dominique Dhumieres
Hi Marcus,

I also see pr57518.c failing on x86_64-apple-darwin10 (with -m64)
and powerpc-apple-darwin9 (both -m32 and -m64). Your patch
fixes them.

Thanks,

Dominique


Re: MIPS elimate trap-if-zero instruction if possible for divisions

2013-07-04 Thread Jeff Law

On 07/04/2013 04:04 AM, Graham Stott wrote:

Hi Jeff, Richard

We could possibly also use VRP to change signed division to unsigned division 
when dividing a
non-negative signed operand by a power of 2 because then the sign bit will be 0 
and we could do
the division using logical shift right.

See simplify_div_or_mod_using_ranges.

jeff


Re: [C++ Patch] PR 38634 (Take 2)

2013-07-04 Thread Paolo Carlini


Hi

Jason Merrill  ha scritto:

>Since newdecl points to the same tree node as decl1, I don't see what
>difference this would make.

Yeah ;) I think it would if instead of tree newdecl = decl1 I had copy_node 
(decl1), right? But I understand it's normally not needed...

 And I'm not too worried about making
>changes to a decl that's erroneous anyway.

I see.

>
>Your earlier patch, plus removing the FIXME, is OK.

Will do, thanks!

Paolo



RFA: Fix c/57821

2013-07-04 Thread Joern Rennecke

For this fix I've assumed that it is now the job of the various places that
do calculations with sizetypes to flag overflows where this is desired.

bootstrapped/regtested on i686-pc-linux-gnu .
2013-07-04  Joern Rennecke 
gcc:
PR c/57821
* c/c-typeck.c (set_init_index): When folding, check for index overflow.
* c-family/c-common.c (complete_array_type): Delay folding first index
like other indices.  When folding, check for index overflow.
gcc/testsuite:
PR c/57821
* gcc.dg/large-size-array-6.c: New test.

Index: c/c-typeck.c
===
--- c/c-typeck.c(revision 200606)
+++ c/c-typeck.c(working copy)
@@ -7217,6 +7217,8 @@ set_init_index (tree first, tree last,
   if (last)
constant_expression_warning (last);
   constructor_index = convert (bitsizetype, first);
+  if (tree_int_cst_lt (constructor_index, first))
+   TREE_OVERFLOW (constructor_index) = 1;
 
   if (last)
{
Index: c-family/c-common.c
===
--- c-family/c-common.c (revision 200606)
+++ c-family/c-common.c (working copy)
@@ -9809,8 +9809,8 @@ complete_array_type (tree *ptype, tree i
  bool fold_p = false;
 
  if ((*v)[0].index)
-   maxindex = fold_convert_loc (input_location, sizetype,
-(*v)[0].index);
+   maxindex = (*v)[0].index, fold_p = true;
+
  curindex = maxindex;
 
  for (cnt = 1; vec_safe_iterate (v, cnt, &ce); cnt++)
@@ -9821,15 +9821,28 @@ complete_array_type (tree *ptype, tree i
  else
{
  if (fold_p)
-   curindex = fold_convert (sizetype, curindex);
+   {
+ /* Since we treat size types now as ordinary
+unsigned types, we need an explicit overflow
+check.  */
+ tree orig = curindex;
+ curindex = fold_convert (sizetype, curindex);
+ if (tree_int_cst_lt (curindex, orig))
+   TREE_OVERFLOW (curindex) = 1;
+   }
  curindex = size_binop (PLUS_EXPR, curindex,
 size_one_node);
}
  if (tree_int_cst_lt (maxindex, curindex))
maxindex = curindex, fold_p = curfold_p;
}
-  if (fold_p)
-maxindex = fold_convert (sizetype, maxindex);
+ if (fold_p)
+   {
+ tree orig = maxindex;
+ maxindex = fold_convert (sizetype, maxindex);
+ if (tree_int_cst_lt (maxindex, orig))
+   TREE_OVERFLOW (maxindex) = 1;
+   }
}
}
   else
Index: testsuite/gcc.dg/large-size-array-6.c
===
--- testsuite/gcc.dg/large-size-array-6.c   (revision 0)
+++ testsuite/gcc.dg/large-size-array-6.c   (working copy)
@@ -0,0 +1,6 @@
+/* PR c/57821 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+static char * name[] = {
+[0x8000]  = "bar"
+  }; /* { dg-error "too large" } */


Re: RFA: Fix c/57821

2013-07-04 Thread Joseph S. Myers
On Thu, 4 Jul 2013, Joern Rennecke wrote:

> For this fix I've assumed that it is now the job of the various places that
> do calculations with sizetypes to flag overflows where this is desired.

Integer constants may be shared, I don't think setting TREE_OVERFLOW on 
existing constants like you do is necessarily safe.

Also note c/ and c-family/ have their own ChangeLog files.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: RFA: Fix c/57821

2013-07-04 Thread Joern Rennecke

Quoting "Joseph S. Myers" :


On Thu, 4 Jul 2013, Joern Rennecke wrote:


For this fix I've assumed that it is now the job of the various places that
do calculations with sizetypes to flag overflows where this is desired.


Integer constants may be shared, I don't think setting TREE_OVERFLOW on
existing constants like you do is necessarily safe.


Hmm, indeed.  I now added a copy_node call in set_init_index to avoid this
problem.  For complete_array_type, we need this information just a bit
further thon in the function, so I just made it a boolean flag.


Also note c/ and c-family/ have their own ChangeLog files.


Oops. I though I checked that.  Foiled by ls localisation.

I'm currently testing the attached updated patch.
2013-07-04  Joern Rennecke 
gcc/c:
PR c/57821
* c-typeck.c (set_init_index): When folding, check for index overflow.
gcc/c-family:
PR c/57821
* c-common.c (complete_array_type): Delay folding first index
like other indices.  When folding, check for index overflow.
gcc/testsuite:
PR c/57821
* gcc.dg/large-size-array-6.c: New test.

Index: c/c-typeck.c
===
--- c/c-typeck.c(revision 200606)
+++ c/c-typeck.c(working copy)
@@ -7217,6 +7217,11 @@ set_init_index (tree first, tree last,
   if (last)
constant_expression_warning (last);
   constructor_index = convert (bitsizetype, first);
+  if (tree_int_cst_lt (constructor_index, first))
+   {
+ constructor_index = copy_node (constructor_index);
+ TREE_OVERFLOW (constructor_index) = 1;
+   }
 
   if (last)
{
Index: c-family/c-common.c
===
--- c-family/c-common.c (revision 200606)
+++ c-family/c-common.c (working copy)
@@ -9781,6 +9781,7 @@ complete_array_type (tree *ptype, tree i
   tree maxindex, type, main_type, elt, unqual_elt;
   int failure = 0, quals;
   hashval_t hashcode = 0;
+  bool overflow_p = false;
 
   maxindex = size_zero_node;
   if (initial_value)
@@ -9809,8 +9810,8 @@ complete_array_type (tree *ptype, tree i
  bool fold_p = false;
 
  if ((*v)[0].index)
-   maxindex = fold_convert_loc (input_location, sizetype,
-(*v)[0].index);
+   maxindex = (*v)[0].index, fold_p = true;
+
  curindex = maxindex;
 
  for (cnt = 1; vec_safe_iterate (v, cnt, &ce); cnt++)
@@ -9821,15 +9822,26 @@ complete_array_type (tree *ptype, tree i
  else
{
  if (fold_p)
-   curindex = fold_convert (sizetype, curindex);
+   {
+ /* Since we treat size types now as ordinary
+unsigned types, we need an explicit overflow
+check.  */
+ tree orig = curindex;
+ curindex = fold_convert (sizetype, curindex);
+ overflow_p |= tree_int_cst_lt (curindex, orig);
+   }
  curindex = size_binop (PLUS_EXPR, curindex,
 size_one_node);
}
  if (tree_int_cst_lt (maxindex, curindex))
maxindex = curindex, fold_p = curfold_p;
}
-  if (fold_p)
-maxindex = fold_convert (sizetype, maxindex);
+ if (fold_p)
+   {
+ tree orig = maxindex;
+ maxindex = fold_convert (sizetype, maxindex);
+ overflow_p |= tree_int_cst_lt (maxindex, orig);
+   }
}
}
   else
@@ -9890,7 +9902,7 @@ complete_array_type (tree *ptype, tree i
 
   if (COMPLETE_TYPE_P (type)
   && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
-  && TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
+  && (overflow_p || TREE_OVERFLOW (TYPE_SIZE_UNIT (type
 {
   error ("size of array is too large");
   /* If we proceed with the array type as it is, we'll eventually
Index: testsuite/gcc.dg/large-size-array-6.c
===
--- testsuite/gcc.dg/large-size-array-6.c   (revision 0)
+++ testsuite/gcc.dg/large-size-array-6.c   (working copy)
@@ -0,0 +1,6 @@
+/* PR c/57821 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+static char * name[] = {
+[0x8000]  = "bar"
+  }; /* { dg-error "too large" } */


Re: RFA: Fix c/57821

2013-07-04 Thread Joseph S. Myers
On Thu, 4 Jul 2013, Joern Rennecke wrote:

> Quoting "Joseph S. Myers" :
> 
> > On Thu, 4 Jul 2013, Joern Rennecke wrote:
> > 
> > > For this fix I've assumed that it is now the job of the various places
> > > that
> > > do calculations with sizetypes to flag overflows where this is desired.
> > 
> > Integer constants may be shared, I don't think setting TREE_OVERFLOW on
> > existing constants like you do is necessarily safe.
> 
> Hmm, indeed.  I now added a copy_node call in set_init_index to avoid this
> problem.  For complete_array_type, we need this information just a bit
> further thon in the function, so I just made it a boolean flag.
> 
> > Also note c/ and c-family/ have their own ChangeLog files.
> 
> Oops. I though I checked that.  Foiled by ls localisation.
> 
> I'm currently testing the attached updated patch.

This is OK if it passes testing.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: unordered containers: reuse nodes on assignment

2013-07-04 Thread François Dumont

On 07/01/2013 11:35 PM, Paolo Carlini wrote:

On 07/01/2013 09:35 PM, François Dumont wrote:
This is it indeed, I am surprised this problem is so old, a Standard 
issue perhaps ? If not I might add it to my todo list.
Yesterday I had a look and I think it's just a bug, I found in 
Bugzilla a duplicate too, and another resolved Jon some time ago.


Paolo.


It doesn't seem to be resolved.

And about the patch itself, is it ok ? I only noticed that some lambdas 
I was using didn't need to capture 'this' so I clean it and here is the 
updated version of the patch.


Tested under linux x86_64.

François
Index: include/bits/hashtable_policy.h
===
--- include/bits/hashtable_policy.h	(revision 200571)
+++ include/bits/hashtable_policy.h	(working copy)
@@ -102,6 +102,90 @@
   { return std::get<0>(std::forward<_Tp>(__x)); }
   };
 
+  // Functor recycling a pool of nodes and using allocation once the pool is
+  // empty.
+  template
+struct _ReuseOrAllocNode
+{
+private:
+  using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey,
+ _Equal, _H1, _H2, _Hash,
+ _RehashPolicy, _Traits>;
+  using __val_alloc_type = typename __hashtable::_Value_alloc_type;
+  using __val_alloc_traits = typename __hashtable::_Value_alloc_traits;
+  using __node_alloc_traits = typename __hashtable::_Node_alloc_traits;
+  using __node_type = typename __hashtable::__node_type;
+
+public:
+  _ReuseOrAllocNode(__node_type* __nodes, __hashtable& __h)
+	: _M_nodes(__nodes), _M_h(__h) { }
+  _ReuseOrAllocNode(const _ReuseOrAllocNode&) = delete;
+
+  ~_ReuseOrAllocNode()
+  { _M_h._M_deallocate_nodes(_M_nodes); }
+
+  template
+	__node_type*
+	operator()(_Arg&& __arg) const
+	{
+	  if (_M_nodes)
+	{
+	  __node_type* __node = _M_nodes;
+	  _M_nodes = _M_nodes->_M_next();
+	  __node->_M_nxt = nullptr;
+	  __val_alloc_type __a(_M_h._M_node_allocator());
+	  __val_alloc_traits::destroy(__a, __node->_M_valptr());
+	  __try
+		{
+		  __val_alloc_traits::construct(__a, __node->_M_valptr(),
+		std::forward<_Arg>(__arg));
+		}
+	  __catch(...)
+		{
+		  __node->~__node_type();
+		  __node_alloc_traits::deallocate(_M_h._M_node_allocator(),
+		  __node, 1);
+		  __throw_exception_again;
+		}
+	  return __node;
+	}
+	  return _M_h._M_allocate_node(std::forward<_Arg>(__arg));
+	}
+
+private:
+  mutable __node_type* _M_nodes;
+  __hashtable& _M_h;
+};
+
+  // Functor similar to the previous one but without any pool of node to recycle.
+  template
+struct _AllocNode
+{
+private:
+  using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey,
+ _Equal, _H1, _H2, _Hash,
+ _RehashPolicy, _Traits>;
+  using __node_type = typename __hashtable::__node_type;
+
+public:
+  _AllocNode(__hashtable& __h)
+	: _M_h(__h) { }
+
+  template
+	__node_type*
+	operator()(_Arg&& __arg) const
+	{ return _M_h._M_allocate_node(std::forward<_Arg>(__arg)); }
+
+private:
+  __hashtable& _M_h;
+};
+
   // Auxiliary types used for all instantiations of _Hashtable nodes
   // and iterators.
 
@@ -597,6 +681,7 @@
 	   typename _RehashPolicy, typename _Traits>
 struct _Insert_base
 {
+protected:
   using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey,
  _Equal, _H1, _H2, _Hash,
  _RehashPolicy, _Traits>;
@@ -612,23 +697,34 @@
 
   using __unique_keys = typename __hashtable_base::__unique_keys;
   using __ireturn_type = typename __hashtable_base::__ireturn_type;
+  using __node_gen_type = _AllocNode<_Key, _Value, _Alloc, _ExtractKey,
+	 _Equal, _H1, _H2, _Hash,
+	 _RehashPolicy, _Traits>;
 
   __hashtable&
   _M_conjure_hashtable()
   { return *(static_cast<__hashtable*>(this)); }
 
+  template
+	void
+	_M_insert_range(_InputIterator __first, _InputIterator __last,
+			const _NodeGetter&);
+
+public:
   __ireturn_type
   insert(const value_type& __v)
   {
 	__hashtable& __h = _M_conjure_hashtable();
-	return __h._M_insert(__v, __unique_keys());
+	__node_gen_type __node_gen(__h);
+	return __h._M_insert(__v, __node_gen, __unique_keys());
   }
 
   iterator
   insert(const_iterator __hint, const value_type& __v)
   {
 	__hashtable& __h = _M_conjure_hashtable();
-	return __h._M_insert(__hint, __v, __unique_keys());
+	__node_gen_type __node_gen(__h);	
+	return __h._M_insert(__hint, __v, __node_gen, __unique_keys());
   }
 
   void
@@ -637,18 +733,24 @@
 
   template
 	void
-	insert(_InputIterator __first, _InputIterator __last);
+	insert(_InputIterator __first, _InputIterator __last)
+	{
+	  __hashtable& __h = _M_conjure_hashtable();
+	  __node_gen_type __node_gen(__h);
+	  return _M_insert_range(__first, __last, __node_gen);
+	}
 };
 
   template
-template
+template
   void
   _Inse

[patch] Fix typos in libstdc++ comments and docs

2013-07-04 Thread Jonathan Wakely
This patch fixes the libstdc++ parts of the patch at
http://gcc.gnu.org/ml/gcc/2013-07/msg00039.html

2013-07-04  Veres Lajos  
Jonathan Wakely  

* config/locale/generic/codecvt_members.cc: Fix typo.
* configure.host: Likewise.
* doc/html/manual/policy_data_structures_design.html: Likewise.
* doc/xml/manual/policy_data_structures.xml: Likewise.
* include/bits/hashtable.h: Likewise.
* include/bits/random.h: Likewise.
* include/profile/impl/profiler_trace.h: Likewise.
* testsuite/23_containers/deque/cons/2.cc: Likewise.
* testsuite/23_containers/deque/debug/shrink_to_fit.cc: Likewise.
* testsuite/ext/pb_ds/example/basic_multimap.cc: Likewise.
* testsuite/performance/23_containers/insert_erase/41975.cc: Likewise.

Tested x86_64-linux, committed to trunk.
commit 8a275d211264c536d48f95e4d59f8972b31d32a1
Author: Jonathan Wakely 
Date:   Thu Jul 4 10:58:25 2013 +0100

2013-07-04  Veres Lajos  
Jonathan Wakely  

* config/locale/generic/codecvt_members.cc: Fix typo.
* configure.host: Likewise.
* doc/html/manual/policy_data_structures_design.html: Likewise.
* doc/xml/manual/policy_data_structures.xml: Likewise.
* include/bits/hashtable.h: Likewise.
* include/bits/random.h: Likewise.
* include/profile/impl/profiler_trace.h: Likewise.
* testsuite/23_containers/deque/cons/2.cc: Likewise.
* testsuite/23_containers/deque/debug/shrink_to_fit.cc: Likewise.
* testsuite/ext/pb_ds/example/basic_multimap.cc: Likewise.
* testsuite/performance/23_containers/insert_erase/41975.cc: Likewise.

diff --git a/libstdc++-v3/config/locale/generic/codecvt_members.cc 
b/libstdc++-v3/config/locale/generic/codecvt_members.cc
index d94cb1d..75929a8 100644
--- a/libstdc++-v3/config/locale/generic/codecvt_members.cc
+++ b/libstdc++-v3/config/locale/generic/codecvt_members.cc
@@ -112,7 +112,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
intern_type*& __to_next) const
   {
 result __ret = ok;
-// This temporary state object is neccessary so __state won't be modified
+// This temporary state object is necessary so __state won't be modified
 // if [__from, __from_end) is a partial multibyte character.
 state_type __tmp_state(__state);
 
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index 23b3f52..c168454 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -66,7 +66,7 @@
 #  (defaults to empty in acinclude.m4)
 #
 #   port_specific_symbol_files
-#  whitespace-seperated list of files containing
+#  whitespace-separated list of files containing
 #  additional symbols to export from the shared
 #  library, when symbol versioning is in use
 #
diff --git a/libstdc++-v3/doc/html/manual/policy_data_structures_design.html 
b/libstdc++-v3/doc/html/manual/policy_data_structures_design.html
index e31086b..0699838 100644
--- a/libstdc++-v3/doc/html/manual/policy_data_structures_design.html
+++ b/libstdc++-v3/doc/html/manual/policy_data_structures_design.html
@@ -862,7 +862,7 @@
reverse_iterator and rbegin), and different
exception and invalidation guarantees.DetailsNode InvariantsConsider 
the two trees in the graphic below, labels A and B. The first
  is a tree of floats; the second is a tree of pairs, each
- signifying a geometric line interval. Each element in a tree is 
refered to as a node of the tree. Of course, each of
+ signifying a geometric line interval. Each element in a tree is 
referred to as a node of the tree. Of course, each of
  these trees can support the usual queries: the first can easily
  search for 0.4; the second can easily 
search for
  std::make_pair(10, 41).Each of 
these trees can efficiently support other queries.
diff --git a/libstdc++-v3/doc/xml/manual/policy_data_structures.xml 
b/libstdc++-v3/doc/xml/manual/policy_data_structures.xml
index 09a1db0..4de8236 100644
--- a/libstdc++-v3/doc/xml/manual/policy_data_structures.xml
+++ b/libstdc++-v3/doc/xml/manual/policy_data_structures.xml
@@ -3883,7 +3883,7 @@
 
  Consider the two trees in the graphic below, labels A and B. 
The first
  is a tree of floats; the second is a tree of pairs, each
- signifying a geometric line interval. Each element in a tree is 
refered to as a node of the tree. Of course, each of
+ signifying a geometric line interval. Each element in a tree is 
referred to as a node of the tree. Of course, each of
  these trees can support the usual queries: the first can easily
  search for 0.4; the second can easily search 
for
  std::make_pair(10, 41).
diff --git a/libstdc++-v3/include/bits/hashtable.h 
b/libstdc++-v3/include/bits/hashtable.h
index 9b586b0

Re: unordered containers: reuse nodes on assignment

2013-07-04 Thread Jonathan Wakely
On 4 July 2013 21:54, François Dumont wrote:
>
> And about the patch itself, is it ok ?

Yes, that latest patch is OK, thanks.

It's made me think about the design a bit more though ...

I've been a little uncomfortable for some time with the number of
template parameters that are needed everywhere in hashtable_policy.h.
In most cases they seem necessary, but does the _ReuseOrAllocNode
template really need 10 template parameters?  Couldn't it just be
passed the relevant _Hashtable type? Unfortunately with the current
design it does seem necessary to know the full _Hashtable type, even
though the functionality only really depends on the allocator type
(and node and value types, but they can be obtained from the
allocator.)  That means if I instantiate unordered_set and
unordered_set the compiler has to instantiate two
different specializations of _ReuseOrAllocNode (and other code in
_Hashtable) even though it doesn't care about the two function
objects, and the executable is larger.

Would it be possible to separate _M_node_allocator, _M_allocate_node,
_M_deallocate_nodes and _M_deallocate_node into a separate base class
of _Hashtable, and have _ReuseOrAllocNode only depend on that?  That
would allow unordered_set and unordered_set
to share more code.


[PATCH] PR57792: Bootstrap darwin13 or later with --with-sysroot to find SDK

2013-07-04 Thread Jack Howarth
  The attached patch eliminates the problem of the SDK being removed from / in 
darwin13
and later by appending --with-sysroot=\"`xcrun --show-sdk-path`\" to 
host_configargs
in the top-level configure for those cases . Bootstrap tested on 
x86_64-apple-darwin13. 
Okay for gcc trunk and gcc-4_8-branch?
Jack
2013-07-05  Jack Howarth  

PR target/57792
* configure.ac: Use --with-sysroot=\"`xcrun --show-sdk-path`\" on 
darwin13 and later.
* configure: Regenerated.

Index: configure.ac
===
--- configure.ac(revision 200683)
+++ configure.ac(working copy)
@@ -2850,6 +2850,13 @@ if test x${is_cross_compiler} = xyes ; t
   target_configargs="--with-cross-host=${host_noncanonical} 
${target_configargs}"
 fi
 
+# Pass --with-sysroot on darwin without SDK in /
+case "${target}" in
+  x86_64-*-darwin1[[3-9]]*)
+host_configargs="--with-sysroot=\"`xcrun --show-sdk-path`\"  
${host_configargs}"
+;;
+esac
+
 # Default to --enable-multilib.
 if test x${enable_multilib} = x ; then
   target_configargs="--enable-multilib ${target_configargs}"


Re: [PATCH] various typo fix patches

2013-07-04 Thread Arnaud Charlet
The Ada changes are OK.

Arno

On 5 juil. 2013, at 01:31, Veres Lajos  wrote:

> Hello,
> 
> Referencing to topic:
> http://gcc.gnu.org/ml/gcc/2013-07/msg00017.html
> Patches containing "-cl" are touching only changelogs.
> The attached files contain the patches generated by
> https://github.com/vlajos/misspell_fixer
> to files/dirs from c to gcc in the
> svn://gcc.gnu.org/svn/gcc/trunk
> repository. (Mostly separated by gcc/* subdirectories.)
> Manually revised one time and reverted some false corrections.
> Though only touches living code a few times, a review by a more competent
> (than me) developer is desirable.
> 
> -- 
> Veres Lajos
> vla...@gmail.com
> +36 20 438 5909
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>