gcc-patches Library cleaner Book sterilizer for distributor looking for

2013-06-01 Thread library
Dear gcc-patches,

We just develop new device special for library book distributors.
If you don't know where to find new products and how to make profits,
Pls contact us for your interesting immediately.
visit site at 
http://www.emetal.tw/protect/MF001.htm  for library cleaner
and http://www.emetal.tw/protect/UV001.htm for book sterilizer

Sincerely, Eric Mayor
eMetal Technology Ltd.
179-2, Sec. 3, Jianguo Rd., Fongshan City, Kaohsiung County 830, Taiwan 
Tel: +886-989707190 Fax: +886-7-7458015
www.emetal.tw/protect  i...@emetal.tw 
46718













Re: [GOOGLE] Fix uninitialized memory in AutoFDO implementation

2013-06-01 Thread Xinliang David Li
ok.

David

On Sat, Jun 1, 2013 at 9:05 PM, Dehao Chen  wrote:
> This patch fixes an uninitialized memory error and a hashtable
> comparison bug in AutoFDO.
>
> Bootstrapped and passed regression test.
>
> OK for google branches?
>
> Thanks,
> Dehao
>
> Index: gcc/auto-profile.c
> ===
> --- gcc/auto-profile.c (revision 199461)
> +++ gcc/auto-profile.c (working copy)
> @@ -310,10 +310,11 @@ afdo_stack_eq (const void *p, const void *q)
>if (s2->callee_name != NULL)
>   return 0;
>  }
> -  else if (s2->callee_name != NULL
> -   && strcmp (afdo_get_bfd_name (s1->callee_name),
> -  afdo_get_bfd_name (s2->callee_name)))
> +  else if (s2->callee_name == NULL)
>  return 0;
> +  else if (strcmp (afdo_get_bfd_name (s1->callee_name),
> +   afdo_get_bfd_name (s2->callee_name)))
> +return 0;
>
>i = afdo_get_original_name_size (s1->func_name);
>if (i != afdo_get_original_name_size (s2->func_name))
> @@ -1214,6 +1215,8 @@ process_auto_profile (void)
>new_stack->num_inst = 0;
>new_stack->count = 0;
>new_stack->max_count = 0;
> +  new_stack->hist_size = 0;
> +  new_stack->hist = NULL;
>stack_slot = (struct gcov_stack **)
>htab_find_slot (stack_htab, new_stack, INSERT);
>if (!*stack_slot)


[GOOGLE] Fix uninitialized memory in AutoFDO implementation

2013-06-01 Thread Dehao Chen
This patch fixes an uninitialized memory error and a hashtable
comparison bug in AutoFDO.

Bootstrapped and passed regression test.

OK for google branches?

Thanks,
Dehao

Index: gcc/auto-profile.c
===
--- gcc/auto-profile.c (revision 199461)
+++ gcc/auto-profile.c (working copy)
@@ -310,10 +310,11 @@ afdo_stack_eq (const void *p, const void *q)
   if (s2->callee_name != NULL)
  return 0;
 }
-  else if (s2->callee_name != NULL
-   && strcmp (afdo_get_bfd_name (s1->callee_name),
-  afdo_get_bfd_name (s2->callee_name)))
+  else if (s2->callee_name == NULL)
 return 0;
+  else if (strcmp (afdo_get_bfd_name (s1->callee_name),
+   afdo_get_bfd_name (s2->callee_name)))
+return 0;

   i = afdo_get_original_name_size (s1->func_name);
   if (i != afdo_get_original_name_size (s2->func_name))
@@ -1214,6 +1215,8 @@ process_auto_profile (void)
   new_stack->num_inst = 0;
   new_stack->count = 0;
   new_stack->max_count = 0;
+  new_stack->hist_size = 0;
+  new_stack->hist = NULL;
   stack_slot = (struct gcov_stack **)
   htab_find_slot (stack_htab, new_stack, INSERT);
   if (!*stack_slot)


PING^2 [libitm,PATCH] Fix bootstrap due to __always_inline in libitm

2013-06-01 Thread Gerald Pfeifer
[ I could not identify who approved the original patch, but believe
  it was one of Richi, Jakub or RTH, so I hope one of you can approve
  this.  Andi acked the previous submission, but cannot approve. ]

The following patch broke bootstrap on all FreeBSD platforms, which took 
me a bit to realize since originally Andi did not update ChangeLog:

   2013-03-23  Andi Kleen  

* local_atomic (__always_inline): Add.
(__calculate_memory_order, atomic_thread_fence,
 atomic_signal_fence, test_and_set, clear, store, load,
 exchange, compare_exchange_weak, compare_exchange_strong,
 fetch_add, fetch_sub, fetch_and, fetch_or, fetch_xor):
Add __always_inline to force inlining.

The problem is the patch added

  #ifndef __always_inline
  #define __always_inline inline __attribute__((always_inline))
  #endif

whereas /usr/include/sys/cdefs.h on FreeBSD has the following

  #define__always_inline __attribute__((__always_inline__))

and hence misses the "inline".

I am fixing this by adding an explicit inline to those cases where
necessary.  I did not add it to struct members, which are considered
inline by default (and believe Andi's patch may have been a bit over-
eager from that perspective).

On top of this, for this revision of the patch, I am unconditionally
defining __always_inline to get the same behavior on all platforms.

Bootstrapped and regression tested on i386-unknown-freebsd10.0,
bootstrapped on amd64-unknown-freebsd8.4 and x86_64-suse-linux.

Okay?

Gerald


2013-05-31  Gerald Pfeifer  

PR bootstrap/56714
* local_atomic (__always_inline): Always define our version.
(__calculate_memory_order): Mark inline.
(atomic_thread_fence): Ditto.
(atomic_signal_fence): Ditto.
(atomic_bool::atomic_flag_test_and_set_explicit): Ditto.
(atomic_bool::atomic_flag_clear_explicit): Ditto.
(atomic_bool::atomic_flag_test_and_set): Ditto.
(atomic_bool::atomic_flag_clear): Ditto.

Index: libitm/local_atomic
===
--- libitm/local_atomic (revision 199585)
+++ libitm/local_atomic (working copy)
@@ -41,9 +41,8 @@
 #ifndef _GLIBCXX_ATOMIC
 #define _GLIBCXX_ATOMIC 1
 
-#ifndef __always_inline
-#define __always_inline inline __attribute__((always_inline))
-#endif
+#undef  __always_inline
+#define __always_inline __attribute__((always_inline))
 
 // #pragma GCC system_header
 
@@ -75,7 +74,7 @@
   memory_order_seq_cst
 } memory_order;
 
-  __always_inline memory_order
+  inline __always_inline memory_order
   __calculate_memory_order(memory_order __m) noexcept
   {
 const bool __cond1 = __m == memory_order_release;
@@ -85,13 +84,13 @@
 return __mo2;
   }
 
-  __always_inline void
+  inline __always_inline void
   atomic_thread_fence(memory_order __m) noexcept
   {
 __atomic_thread_fence (__m);
   }
 
-  __always_inline void
+  inline __always_inline void
   atomic_signal_fence(memory_order __m) noexcept
   {
 __atomic_thread_fence (__m);
@@ -1545,38 +1544,38 @@
 
 
   // Function definitions, atomic_flag operations.
-  __always_inline bool
+  inline __always_inline bool
   atomic_flag_test_and_set_explicit(atomic_flag* __a,
memory_order __m) noexcept
   { return __a->test_and_set(__m); }
 
-  __always_inline bool
+  inline __always_inline bool
   atomic_flag_test_and_set_explicit(volatile atomic_flag* __a,
memory_order __m) noexcept
   { return __a->test_and_set(__m); }
 
-  __always_inline void
+  inline __always_inline void
   atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m) noexcept
   { __a->clear(__m); }
 
-  __always_inline void
+  inline __always_inline void
   atomic_flag_clear_explicit(volatile atomic_flag* __a,
 memory_order __m) noexcept
   { __a->clear(__m); }
 
-  __always_inline bool
+  inline __always_inline bool
   atomic_flag_test_and_set(atomic_flag* __a) noexcept
   { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
 
-  __always_inline bool
+  inline __always_inline bool
   atomic_flag_test_and_set(volatile atomic_flag* __a) noexcept
   { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
 
-  __always_inline void
+  inline __always_inline void
   atomic_flag_clear(atomic_flag* __a) noexcept
   { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
 
-  __always_inline void
+  inline __always_inline void
   atomic_flag_clear(volatile atomic_flag* __a) noexcept
   { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
 


Re: [libstdc++-v3] Collapse redundant 'inline' from 'inline constexpr'.

2013-06-01 Thread Ed Smith-Rowland

On 06/01/2013 05:29 PM, Gabriel Dos Reis wrote:

please go ahead.

-- Gaby


Done.



Re: [libstdc++-v3] Collapse redundant 'inline' from 'inline constexpr'.

2013-06-01 Thread Gabriel Dos Reis
please go ahead.

-- Gaby


[libstdc++-v3] Collapse redundant 'inline' from 'inline constexpr'.

2013-06-01 Thread Ed Smith-Rowland

All,

Paolo Carlini pointed out that I introduced a number of 'inline 
constexpr' in my last std literals patch.
Section 7.1.5/2: "constexpr functions and constexpr constructors are 
implicitly inline (7.1.2).


I noticed that there are two other headers that have this.

Does anyone mind if i just clean this up?

Builds and tests clean on x86_64-linux.

Ed


2013-06-01  Ed Smith-Rowland  <3dw...@verizon.net>

include/std/chrono: Collapse redundant 'inline' from 'inline constexpr'.
include/std/tuple: Ditto.
include/bits/move.h: Ditto.
Index: include/std/chrono
===
--- include/std/chrono  (revision 199584)
+++ include/std/chrono  (working copy)
@@ -819,12 +819,12 @@
 
   } // __detail
 
-  inline constexpr chrono::duration>
+  constexpr chrono::duration>
   operator"" h(long double __hours)
   { return chrono::duration>{__hours}; }
 
   template 
-inline constexpr typename
+constexpr typename
 __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
   chrono::hours>::type
 operator"" h()
@@ -834,12 +834,12 @@
chrono::hours>::value;
 }
 
-  inline constexpr chrono::duration>
+  constexpr chrono::duration>
   operator"" min(long double __mins)
   { return chrono::duration>{__mins}; }
 
   template 
-inline constexpr typename
+constexpr typename
 __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
   chrono::minutes>::type
 operator"" min()
@@ -849,12 +849,12 @@
chrono::minutes>::value;
 }
 
-  inline constexpr chrono::duration
+  constexpr chrono::duration
   operator"" s(long double __secs)
   { return chrono::duration{__secs}; }
 
   template 
-inline constexpr typename
+constexpr typename
 __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
   chrono::seconds>::type
 operator"" s()
@@ -864,12 +864,12 @@
chrono::seconds>::value;
 }
 
-  inline constexpr chrono::duration
+  constexpr chrono::duration
   operator"" ms(long double __msecs)
   { return chrono::duration{__msecs}; }
 
   template 
-inline constexpr typename
+constexpr typename
 __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
   chrono::milliseconds>::type
 operator"" ms()
@@ -879,12 +879,12 @@
chrono::milliseconds>::value;
 }
 
-  inline constexpr chrono::duration
+  constexpr chrono::duration
   operator"" us(long double __usecs)
   { return chrono::duration{__usecs}; }
 
   template 
-inline constexpr typename
+constexpr typename
 __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
   chrono::microseconds>::type
 operator"" us()
@@ -894,12 +894,12 @@
chrono::microseconds>::value;
 }
 
-  inline constexpr chrono::duration
+  constexpr chrono::duration
   operator"" ns(long double __nsecs)
   { return chrono::duration{__nsecs}; }
 
   template 
-inline constexpr typename
+constexpr typename
 __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
   chrono::nanoseconds>::type
 operator"" ns()
Index: include/std/tuple
===
--- include/std/tuple   (revision 199583)
+++ include/std/tuple   (working copy)
@@ -856,25 +856,25 @@
 }
 
   template
-inline constexpr bool
+constexpr bool
 operator!=(const tuple<_TElements...>& __t,
   const tuple<_UElements...>& __u)
 { return !(__t == __u); }
 
   template
-inline constexpr bool
+constexpr bool
 operator>(const tuple<_TElements...>& __t,
  const tuple<_UElements...>& __u)
 { return __u < __t; }
 
   template
-inline constexpr bool
+constexpr bool
 operator<=(const tuple<_TElements...>& __t,
   const tuple<_UElements...>& __u)
 { return !(__u < __t); }
 
   template
-inline constexpr bool
+constexpr bool
 operator>=(const tuple<_TElements...>& __t,
   const tuple<_UElements...>& __u)
 { return !(__t < __u); }
Index: include/bits/move.h
===
--- include/bits/move.h (revision 199583)
+++ include/bits/move.h (working copy)
@@ -116,7 +116,7 @@
*  type is copyable, in which case an lvalue-reference is returned instead.
*/
   template
-inline constexpr typename
+constexpr typename
 conditional<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type
 move_if_noexcept(_Tp& __x) noexcept
 { return std::move(__x); }


Re: Symtab cleanups 2/17 - merge alias code

2013-06-01 Thread David Edelsohn
Honza,

This patch introduces 45 new libstdc++ testsuite failure for AIX.

Program received signal SIGSEGV, Segmentation fault.
_Z20ipa_record_referenceP15symtab_node_defS0_11ipa_ref_useP18gimple_statement_d
(referring_node=0x70d3ad58, referred_node=0x0, use_type=IPA_REF_ALIAS,
stmt=0x0) at /nasfarm/dje/src/src/gcc/ipa-ref.c:338
#1  0x10560b10 in _Z20symtab_resolve_aliasP15symtab_node_defS0_ (
node=0x70d3ad58, target=0x0) at /nasfarm/dje/src/src/gcc/symtab.c:928
#2  0x10592028 in _Z32cgraph_process_same_body_aliasesv ()
at /nasfarm/dje/src/src/gcc/cgraphunit.c:660
#3  0x106d2574 in _Z28cp_write_global_declarationsv ()
at /nasfarm/dje/src/src/gcc/cp/decl2.c:3999
#4  0x1b14 in _ZL12compile_filev ()
at /nasfarm/dje/src/src/gcc/toplev.c:558
#5  0x10003734 in _Z11toplev_mainiPPc (argc=9, argv=0x2ff228a8)
at /nasfarm/dje/src/src/gcc/toplev.c:1872
#6  0x1410 in main (argc=,
argv=) at  _start_ :36

Possibly this did not appear for powerpc64-linux because AIX does not
support ELF-style visibility.

- David


Re: [x86, PATCH 1/2] Enabling of the new Intel microarchitecture Silvermont

2013-06-01 Thread Jakub Jelinek
On Wed, May 29, 2013 at 11:35:29AM +0200, Uros Bizjak wrote:
> > 2013-05-27  Yuri Rumyantsev  
> > Igor Zamyatin  

Much more importantly,

> > (fold_builtin_cpu): Add slm.

the above:

> > * libgcc/config/i386/cpuinfo.c (INTEL_SLM): New enum value.

and the above changes look to me like ABI breaking.
You can't insert any values in the middle of the ranges, so M_SLM can't be
inserted in between M_INTEL_ATOM and M_INTEL_CORE2, but needs to go
right before M_CPU_SUBTYPE_START, similarly in cpuinfo.c needs to go right
before CPU_TYPE_MAX, otherwise if you use older compiled programs against
newer libgcc or vice versa, the CPU detection will not work properly.

It would be nice to either insert a comment saying that new items can be
only inserted at end, or add explicit = 2 etc. to the enums, or both
to make it clear that the values are part of ABI and must not be ever
changed.

Plus, the latter ChangeLog entry should have been just
* config/i386/cpuinfo.c (INTEL_SLM): New enum value.
and should have gone into libgcc/ChangeLog.

Jakub


Re: RS6000 PATCH for c++/57415 (ICE on altivec tests)

2013-06-01 Thread David Edelsohn
On Fri, May 31, 2013 at 10:45 PM, Jason Merrill  wrote:
> The issue here was that rs6000-c.c was creating COMPOUND_LITERAL_EXPR, which
> the C++ front end doesn't understand.  For C++ let's create TARGET_EXPRs
> instead.
>
> Tested powerpc64-unknown-linux-gnu.  OK for trunk?

The patch fixes the testsuite failure, but I now have a massive number
of new libstdc++ failures on AIX and I don't yet know the cause.

- David


Re: Implement N3642 - User-defined Literals for Standard Library Types

2013-06-01 Thread Paolo Carlini


Hi,

Ed Smith-Rowland <3dw...@verizon.net> ha scritto:

>Committed the following...

Looks like great work, thanks! I'm still in vacations, and barely reading email 
on a small screen, just wanted to point out that apparently the patch has a few 
redundant inline preceding constexpr. Could you please double check?

Thanks!
Paolo



Re: [Patch, Fortran] Detecting the terminal width

2013-06-01 Thread Janus Weil
>> Ok. Unfortunately I'm not much of a autoconf hero (better to say: not
>> at all).
> Any person using autoconf is some of a hero. ;-)

Totally ...


>> I can not test it on my system with --enable-maintainer-mode
>> because I get:
>>
>> configure.ac:2: error: Please use exactly Autoconf 2.64 instead of 2.69.
>>
>> Why on earth does GCC require an old autoconf version?
> There is an answer here:
> http://gcc.gnu.org/ml/gcc-help/2011-01/msg00248.html

Yes, I also found this in the meantime.


> The bottom line is:
> GCC versions the generated files, so require exactly one autoconf.
> And I suppose it just hasn't been updated to require the latest one.

Makes sense somehow, although it is pretty inconvenient.


>> New patch attached ...
> Tobias doesn't seem to argue (too much) against it, so OK.

Thanks. Committed as r199585:

http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=199585

Cheers,
Janus


Re: [Patch, Fortran] PR57496 use finiteq etc. for __float in write_float.def

2013-06-01 Thread Tobias Burnus
Regarding REAL(10): I tried to find out what goes wrong in that case, 
but I failed.


I would really appreciate some help. See PR57496. My feeling is that the 
error is related to x87 FPU vs. CPU handling, but I failed to understand 
why and when it happens.



Regarding REAL(16):

Tobias Burnus wrote:
Found when looking at the issue of the PR, but unrelated. For 
__float128, we have to use the libquadmath functions - not the "long 
double" ones.


Actually, the patch *does* solve the problem for REAL(16). I have now 
attached a slighly updated version, which converts another "isfinite" 
which I missed in the previous patch.


The patch is rather obvious, though I wonder whether it could clash 
with some #defines of the system headers on some systems.

Build and regtested on x86-64-gnu-linux.
OK for the trunk?


OK?

Tobias
2013-06-01  Tobias Burnus  

	PR fortran/57496
	* io/write_float.def (ISFINITE2Q, ISFINITE2, ISFINITE2L, ISFINITE,
	SIGNBIT2Q, SIGNBIT2, SIGNBIT2L, SIGNBIT, ISNAN2Q, ISNAN2, ISNAN2L,
	ISNAN): New macros.
	(output_float_FMT_G_,WRITE_FLOAT): Use them.

diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index a157f0b..4f0fa72 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -961,6 +961,34 @@ __qmath_(quadmath_snprintf) (buffer, size, "%+-#.*Qf", \
 #endif
 
 
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define ISFINITE2Q(val) finiteq(val)
+#endif
+#define ISFINITE2(val) isfinite(val)
+#define ISFINITE2L(val) isfinite(val)
+
+#define ISFINITE(suff,val) TOKENPASTE(ISFINITE2,suff)(val)
+
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define SIGNBIT2Q(val) signbitq(val)
+#endif
+#define SIGNBIT2(val) signbit(val)
+#define SIGNBIT2L(val) signbit(val)
+
+#define SIGNBIT(suff,val) TOKENPASTE(SIGNBIT2,suff)(val)
+
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define ISNAN2Q(val) isnanq(val)
+#endif
+#define ISNAN2(val) isnan(val)
+#define ISNAN2L(val) isnan(val)
+
+#define ISNAN(suff,val) TOKENPASTE(ISNAN2,suff)(val)
+
+
+
 /* Generate corresponding I/O format for FMT_G and output.
The rules to translate FMT_G to FMT_E or FMT_F from DEC fortran
LRM (table 11-2, Chapter 11, "I/O Formatting", P11-25) is:
@@ -1127,7 +1155,7 @@ OUTPUT_FLOAT_FMT_G(16,L)
 {\
 GFC_REAL_ ## x tmp;\
 tmp = * (GFC_REAL_ ## x *)source;\
-if (isfinite (tmp))		\
+if (ISFINITE (y,tmp))	\
   nprinted = DTOA(y,0,tmp);	\
 else\
   nprinted = -1;\
@@ -1194,10 +1222,10 @@ determine_en_precision (st_parameter_dt *dtp, const fnode *f,
 {\
 	GFC_REAL_ ## x tmp;\
 	tmp = * (GFC_REAL_ ## x *)source;\
-	sign_bit = signbit (tmp);\
-	if (!isfinite (tmp))\
+	sign_bit = SIGNBIT (y,tmp);\
+	if (!ISFINITE (y,tmp))\
 	  { \
-	write_infnan (dtp, f, isnan (tmp), sign_bit);\
+	write_infnan (dtp, f, ISNAN (y,tmp), sign_bit);\
 	return;\
 	  }\
 	tmp = sign_bit ? -tmp : tmp;\


Re: Implement N3642 - User-defined Literals for Standard Library Types

2013-06-01 Thread Ed Smith-Rowland

Committed the following...


2013-05-30  Ed Smith-Rowland  <3dw...@verizon.net>

Implement N3642 - User-defined Literals for Standard Library Types
* include/bits/parse_numbers.h: New.
* include/std/chrono: Add duration literal operators.
* include/bits/basic_string.h: Add string literal operators.
* include/Makefile.in: Add parse_numbers.h.
* include/Makefile.am: Ditto.
* testsuite/20_util/duration/literals/values.cc: New.
* testsuite/20_util/duration/literals/types.cc: New.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Adjust.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Adjust.
* testsuite/21_strings/basic_string/literals/values.cc: New.
* testsuite/21_strings/basic_string/literals/types.cc: New.

Index: include/bits/parse_numbers.h
===
--- include/bits/parse_numbers.h(revision 0)
+++ include/bits/parse_numbers.h(working copy)
@@ -0,0 +1,417 @@
+// Components for compile-time parsing of numbers -*- C++ -*-
+
+// Copyright (C) 2013 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 bits/parse_numbers.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{chrono}
+ */
+
+#ifndef _PARSE_NUMBERS_H
+#define _PARSE_NUMBERS_H 1
+
+#pragma GCC system_header
+
+// From n3642.pdf except I added binary literals and digit separator '`'.
+
+#if __cplusplus > 201103L
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+namespace __parse_int {
+
+  template
+struct _Digit;
+
+  template
+struct _Digit<_Base, '0'>
+{
+  static constexpr bool valid{true};
+  static constexpr unsigned value{0};
+};
+
+  template
+struct _Digit<_Base, '1'>
+{
+  static constexpr bool valid{true};
+  static constexpr unsigned value{1};
+};
+
+  template
+struct _Digit<_Base, '2'>
+{
+  static_assert(_Base > 2, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{2};
+};
+
+  template
+struct _Digit<_Base, '3'>
+{
+  static_assert(_Base > 3, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{3};
+};
+
+  template
+struct _Digit<_Base, '4'>
+{
+  static_assert(_Base > 4, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{4};
+};
+
+  template
+struct _Digit<_Base, '5'>
+{
+  static_assert(_Base > 5, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{5};
+};
+
+  template
+struct _Digit<_Base, '6'>
+{
+  static_assert(_Base > 6, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{6};
+};
+
+  template
+struct _Digit<_Base, '7'>
+{
+  static_assert(_Base > 7, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{7};
+};
+
+  template
+struct _Digit<_Base, '8'>
+{
+  static_assert(_Base > 8, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{8};
+};
+
+  template
+struct _Digit<_Base, '9'>
+{
+  static_assert(_Base > 9, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{9};
+};
+
+  template
+struct _Digit<_Base, 'a'>
+{
+  static_assert(_Base > 0xa, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned value{0xa};
+};
+
+  template
+struct _Digit<_Base, 'A'>
+{
+  static_assert(_Base > 0xa, "invalid digit");
+  static constexpr bool valid{true};
+  static constexpr unsigned va

[PATCH, alpha]: Fix ICE with conditional moves using DFmode compare with zero.

2013-06-01 Thread Uros Bizjak
Hello!

Attached patch fixes

FAIL: c-c++-common/cilk-plus/AN/builtin_fn_mutating.c  -O3

cilkplus failure on alpha [1]. The problem was triggered only with
-O3, due to direct expansion of conditional move. The attached patch
swaps all compares, modulo DImode compares with zero, in the same way
as expansions of conditional branch and setcc patterns.

2013-06-01  Uros Bizjak  

* config/alpha/alpha.c (alpha_emit_conditional_move): Swap all
GE, GT, GEU and GTU compares, modulo DImode compares with zero.

OK for mainline and release branches?

[1] http://gcc.gnu.org/ml/gcc-testresults/2013-05/msg02980.html

Uros.
Index: alpha.c
===
--- alpha.c (revision 199439)
+++ alpha.c (working copy)
@@ -2700,12 +2700,12 @@ alpha_emit_conditional_move (rtx cmp, enum machine
   break;
 
 case GE:  case GT:  case GEU:  case GTU:
-  /* These must be swapped.  */
-  if (op1 != CONST0_RTX (cmp_mode))
-   {
- code = swap_condition (code);
- tem = op0, op0 = op1, op1 = tem;
-   }
+  /* These normally need swapping, but for integer zero we have
+special patterns that recognize swapped operands.  */
+  if (cmp_mode == DImode && op1 == const0_rtx)
+   break;
+  code = swap_condition (code);
+  tem = op0, op0 = op1, op1 = tem;
   break;
 
 default:


PR middle-end/57366

2013-06-01 Thread Jan Hubicka
Hi,
this patch fixes problems with weakref and LTO on non-weakref configurations.  
Here
the weakrefs are transparently removed by GCC via somewhat weird machinery.
DECL_ASSEMLBLER name gets flag IDENTIFIER_TRANSPARENT_ALIAS and the TREE_CHAIN 
makes assembler output routies to output instead of specified assembler name
different assembler name (weakref target).

This completely breaks with LTO that does not preserve TREE_CHAIN of 
IDENTIFIER_NODE
and also it breaks with symbol renaming - when weakref is renamed, we lose the
link, when target is renamed we are screwed up.

This patch makes the links to be set up only before final assembler output. 
Hopefully
it will solve the problem.

Jakub, Alexandre. Is there some reason why we can't simply rewrite GIMPLE 
bodies to contains
the weakref target decls in this case? (and also in the case both weakref and 
its target
is used)

In any case this is quite self contained fix that is backportable to 4.8 if 
needed.

Honza

2013-06-01  Jan Hubicka  

PR middle-end/57366
* cgraphunit.c (compile): When weakref is not supported,
set up transparent aliases before final output pass.
* varasm.c (assemble_alias): Do not try to do it here.


Index: cgraphunit.c
===
--- cgraphunit.c(revision 199577)
+++ cgraphunit.c(working copy)
@@ -1996,6 +1996,32 @@ compile (void)
   bitmap_obstack_release (NULL);
   mark_functions_to_output ();
 
+  /* When weakref support is missing, we autmatically translate all
+ references to NODE to references to its ultimate alias target.
+ The renaming mechanizm uses flag IDENTIFIER_TRANSPARENT_ALIAS and
+ TREE_CHAIN.
+
+ Set up this mapping before we output any assembler but once we are sure
+ that all symbol renaming is done.
+
+ FIXME: All this uglyness can go away if we just do renaming at gimple
+ level by physically rewritting the IL.  At the moment we can only redirect
+ calls, so we need infrastructure for renaming references as well.  */
+#ifndef ASM_OUTPUT_WEAKREF
+  symtab_node node;
+
+  FOR_EACH_SYMBOL (node)
+if (node->symbol.alias
+   && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
+  {
+   IDENTIFIER_TRANSPARENT_ALIAS
+  (DECL_ASSEMBLER_NAME (node->symbol.decl)) = 1;
+   TREE_CHAIN (DECL_ASSEMBLER_NAME (node->symbol.decl))
+  = (node->symbol.alias_target ? node->symbol.alias_target
+ : DECL_ASSEMBLER_NAME (symtab_alias_target (node)->symbol.decl));
+  }
+#endif
+
   cgraph_state = CGRAPH_STATE_EXPANSION;
   if (!flag_toplevel_reorder)
 output_in_order ();
Index: varasm.c
===
--- varasm.c(revision 199576)
+++ varasm.c(working copy)
@@ -5560,13 +5560,6 @@ assemble_alias (tree decl, tree target)
 
   if (alias == target)
error ("weakref %q+D ultimately targets itself", decl);
-  else
-   {
-#ifndef ASM_OUTPUT_WEAKREF
- IDENTIFIER_TRANSPARENT_ALIAS (alias) = 1;
- TREE_CHAIN (alias) = target;
-#endif
-   }
   if (TREE_PUBLIC (decl))
error ("weakref %q+D must have static linkage", decl);
 }


[c++-concepts] constraints

2013-06-01 Thread Andrew Sutton
This patch adds constraint checking and overloading for function
templates, class templates, and alias templates. This patch isn't as
big as it seems, it just touches the compiler in a lot of different
places.


2013-06-01  Andrew Sutton  
* gcc/cp/call.c (rejection_reason_code): Add rr_constraint_failure.
(template_constraint_failure): New.
(template_constraint_failure): Check declaration constraints
before other viable function criteria.
(add_template_candidate_real): Diagnose constraint failures,
and attach constraints to instantiated candidates.
(print_z_candidate): Diagnose constraint failures.
(get_actual_template): New.
(joust): Allow temploids to also participate in most specialied
when they have constraints.
* gcc/cp/constraint.cc (join_requirements): New
(conjoin_requirements): Join expressions correctly.
(disjoin_requirements): Join expressions correctly.
(is_checkable): Rename from is_constraint, check vs. concept flag.
(resolve_constraint_check): Fix.
(get_type_constraints): New.
(get_decl_constraints): New.
(get_constraints): New.
(suppress_template_processing): New.
(check_requirements): New.
(check_dependent_requirements): New.
(check_constraints): New.
(check_type_constraints): New.
(check_decl_constraints): New.
(check_template_constraints): New.
(equivalent_constraints): New.
(equivalently_constrained): New.
(more_constraints): New.
(more_constrianed): New.
(diagnose_constraint_failure): New.
* gcc/cp/class.c (are_constrained_member_overloads): New.
(add_method): Allow overloading of constrained member functions.
* gcc/cp/ptree.c (cxx_print_xnode): Print constraint info.
* gcc/cp/pt.c (local_specialization_stack): New.
(build_template_info): Incorporate template requirements
(check_explicit_specialization): Instantiate requirements for
template info.
(push_template_decl_real): Include constraints in template info.
(redeclare_class_template): Diagnose redeclaration with different
constraints.
(is_compatible_template_arg): New.
(convert_template_argument): Check constraints on template template
arguments.
(lookup_template_class_1): Check constraints on alias templates.
Keep constraints with instantiated types.
(instantiate_class_template_1): Check constraints on class templates.
(tsubst_decl): Instantiate and keep constraints with template info.
Also, allow dependent pack arguments to produce neww parameter
packs when instantiated.
(tsubst_copy): Handle REAL_TYPE and BOOLEAN_TYPE.
(tsubst_copy_and_build): PARM_DECLs can be instantiated as pack
expansions (used with requires expression).
(fn_type_unification): Check constraints for function templates.
(more_specialized_fn): Determine which candidate is more constrained.
(tsubst_constraint): New.
(substitute_requirements): New.
* gcc/cp/parser.c (cp_unevaluated): New.
* gcc/cp/tree.h (cp_unevaluated): New.
(local_specialization_stack): New.
(get_constraints): New.
(check_constraints): New.
(check_constraints): New.
(check_template_constraints): New.
(subst_template_constraints): New.
(equivalent_constraints): New.
(equivalently_constrained): New.
(more_constraints): New.
(more_constrained): New.
(diagnose_constraint_failure): New.
* gcc/cp/decl.c: (are_constrained_overloads): New.
(duplicate_decls): Allow constrained function overloads, and diagnose
attempts to overload concepts.
(grokfndecl): Supply empty constraints to build_template_info.
(cp_tree_node_structure): Add entry for CONSTRAINT_INFO.
(semantics.c): Create template_info for template template parameters
as a place to house constraints.
* gcc/cp/tree.c (bind_template_template_parm): Provide empty
constraints for bound template template parameters.
* gcc/cp/cxx-pretty-print.c (pp_cxx_template_declaration): Print the
template requirements.


reqs-2.patch
Description: Binary data


PR middle-end/57467

2013-06-01 Thread Jan Hubicka
Hi,
local passes are allowed to create new functions. The main iterator should 
however only
deal with those that was already there before.  This broke with my part 1 
symtab cleanup
patch, since I changed FOR_EACH_DEFINED_FUNCTION to test node->definition 
instead of
node->analyzed. Hopefully there won't be much more places needing fix.

Bootstrapped/regtested ppx64-linux with TLS disabled, commited.

Index: ChangeLog
===
--- ChangeLog   (revision 199581)
+++ ChangeLog   (working copy)
@@ -1,5 +1,10 @@
 2013-06-01  Jan Hubicka  
 
+   PR middle-end/57467
+   * passes.c (for_per_function): Skip unanalyzed functoins.
+
+2013-06-01  Jan Hubicka  
+
* lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Rename to ...
(lto_symtab_merge_symbols_1): ... this one.
(lto_symtab_merge_cgraph_nodes): Rename to ...
Index: passes.c
===
--- passes.c(revision 199581)
+++ passes.c(working copy)
@@ -1709,7 +1709,7 @@
 {
   struct cgraph_node *node;
   FOR_EACH_DEFINED_FUNCTION (node)
-   if (gimple_has_body_p (node->symbol.decl)
+   if (node->symbol.analyzed && gimple_has_body_p (node->symbol.decl)
&& (!node->clone_of || node->symbol.decl != 
node->clone_of->symbol.decl))
  {
push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl));


Re: [Patch, Fortran] Detecting the terminal width

2013-06-01 Thread Mikael Morin
Le 01/06/2013 10:42, Janus Weil a écrit :
> Ok. Unfortunately I'm not much of a autoconf hero (better to say: not
> at all).
Any person using autoconf is some of a hero. ;-)

> I can not test it on my system with --enable-maintainer-mode
> because I get:
> 
> configure.ac:2: error: Please use exactly Autoconf 2.64 instead of 2.69.
> 
> Why on earth does GCC require an old autoconf version?
There is an answer here:
http://gcc.gnu.org/ml/gcc-help/2011-01/msg00248.html

The bottom line is:
GCC versions the generated files, so require exactly one autoconf.
And I suppose it just hasn't been updated to require the latest one.


> New patch attached ...
Tobias doesn't seem to argue (too much) against it, so OK.

Attached is what I get with autoconf-2.64/automake-1.11.1


Thanks
Mikael







Index: config.in
===
--- config.in   (révision 199575)
+++ config.in   (copie de travail)
@@ -199,6 +199,12 @@
 #endif
 
 
+/* Define to 1 if `TIOCGWINSZ' requires . */
+#ifndef USED_FOR_TARGET
+#undef GWINSZ_IN_SYS_IOCTL
+#endif
+
+
 /* mcontext_t fields start with __ */
 #ifndef USED_FOR_TARGET
 #undef HAS_MCONTEXT_T_UNDERSCORES
@@ -1247,7 +1253,7 @@
 #endif
 
 
-/* Define if your AIX linker supports a large TOC. */
+/* Define if your PowerPC64 linker supports a large TOC. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_LD_LARGE_TOC
 #endif
Index: configure
===
--- configure   (révision 199575)
+++ configure   (copie de travail)
@@ -8293,6 +8293,66 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether termios.h defines 
TIOCGWINSZ" >&5
+$as_echo_n "checking whether termios.h defines TIOCGWINSZ... " >&6; }
+if test "${ac_cv_sys_tiocgwinsz_in_termios_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+#include 
+#ifdef TIOCGWINSZ
+  yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then :
+  ac_cv_sys_tiocgwinsz_in_termios_h=yes
+else
+  ac_cv_sys_tiocgwinsz_in_termios_h=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_sys_tiocgwinsz_in_termios_h" >&5
+$as_echo "$ac_cv_sys_tiocgwinsz_in_termios_h" >&6; }
+
+if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/ioctl.h 
defines TIOCGWINSZ" >&5
+$as_echo_n "checking whether sys/ioctl.h defines TIOCGWINSZ... " >&6; }
+if test "${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+#include 
+#ifdef TIOCGWINSZ
+  yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then :
+  ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes
+else
+  ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5
+$as_echo "$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6; }
+
+  if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then
+
+$as_echo "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h
+
+  fi
+fi
+
 for ac_header in limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
 sys/resource.h sys/param.h sys/times.h sys/stat.h \
@@ -17834,7 +17894,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17837 "configure"
+#line 17897 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17940,7 +18000,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17943 "configure"
+#line 18003 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
Index: configure.ac
===
--- configure.ac(révision 199575)
+++ configure.ac(copie de travail)
@@ -939,6 +939,7 @@ AC_HEADER_STDC
 AC_HEADER_TIME
 ACX_HEADER_STRING
 AC_HEADER_SYS_WAIT
+AC_HEADER_TIOCGWINSZ
 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
 sys/resource.h sys/param.h sys/times.h sys/stat.h \
Index: fortran/error.c
===
--- fortran/error.c (révision 199575)
+++ fortran/error.c (copie de travail)
@@ -30,6 +30,15 @@ along with GCC; see the file COPYING3.  If not see
 #include "flags.h"
 #include "gfortran.h"
 
+#ifdef HAVE_TERMIOS_H
+# include 
+#endif
+
+#ifdef GWINSZ_IN_SYS_IOCTL
+# include 
+#endif
+
+
 static int suppress_errors = 0;
 
 static int warnings_not_error

Re: [c++-concepts]

2013-06-01 Thread Gabriel Dos Reis
On Sat, Jun 1, 2013 at 6:56 AM, Andrew Sutton  wrote:
>>   * Check against cxx11 dialect, not cxx0x.
>
> This check is actually all over parser.c, the reason it shows up in
> the patch is that I reverted a previous change that affected some code
> that included it.
>
> I'd feel better leaving it in, since its a change that could affect
> some other part of the compiler.

Well, we don't want to check cxx0x one place and cxx11 others.
Eventually, cxx0x will go away.  So, it is better if we don't
maintain vestiges in the code base.  And with cxx1y coming in,
I feel better if we don't have too many variables :-)

-- Gaby


[PATCH, libcpp] Do not decrease highest_location if the included file has be included twice.

2013-06-01 Thread Dehao Chen
This patch fixes the bug that when include a header file, if the
header file is already included (with #define _HEADER_H_), libcpp
should not decrease its highest_location, otherwise it'll cause
incorrect source location when source location numbers are large
enough to omit columns.

Passed regression test.

OK for trunk?

Thanks,
Dehao

libcpp/ChangeLog:

2013-05-31  Dehao Chen  

* files.c (_cpp_stack_include): Fix the highest_location when header
file is guarded by #ifndef and is included twice.


Index: libcpp/files.c
===
--- libcpp/files.c (revision 199416)
+++ libcpp/files.c (working copy)
@@ -1002,7 +1002,8 @@ _cpp_stack_include (cpp_reader *pfile, const char
  linemap_add is not called) or we were included from the
  command-line.  */
   if (file->pchname == NULL && file->err_no == 0
-  && type != IT_CMDLINE && type != IT_DEFAULT)
+  && type != IT_CMDLINE && type != IT_DEFAULT
+  && !(file->cmacro && file->cmacro->type == NT_MACRO))
 pfile->line_table->highest_location--;

   return _cpp_stack_file (pfile, file, type == IT_IMPORT);


Re: [Patch, Fortran] Show better error location

2013-06-01 Thread Tobias Burnus

Am 01.06.2013 16:06, schrieb Mikael Morin:

For the redirection to "less", one can use "less -S".


Still, that does not help if the output is excessively long. Try some C 
(or C++) long code (e.g. 30,000 lines long), do a minor mistake there 
and run it through

  topformflat 0 x < in.c > out.c
and then run
  export COLUMNS=100
  gcc out.c

You will be delighted to have first a warning message, then 100 kbytes 
of source code. Followed by 50 kbytes of spaces, followed by the ^ to 
show where the error is. and then it continues.


Thus, with less you either have pages over pages with the source code - 
or you have to scroll for ages to the right until you find the ^ and the 
problematic source location.


In the real world, such source code typically occurs for generated code 
- as no one is insane enough to write such kind of code manually. But 
also generated Fortran code looks rather ugly. Actually, generated code 
can have excessive line lengths: Nearly all compilers have flags to lift 
the line-length restriction (some even do so by default). But some 
compilers have a hard limit on the number of continuation lines.


As Fortran code usually has rather short lines, I admittedly still do 
not understand the problem which the patch wants to solve.


For "tee", it depends on what comes behind. For the file case, one 
doesn't know how wide the final display will be. It is easy to trim 
afterwards, but the converse is not true (obviously)


Well, you still have the source code file. The point of showing the 
source code is to make it easier to see the mistake - not to output the 
whole file every time - with the error line somewhere hidden.


The real information is in the ERROR or WARNING message together with 
the file name and line number. The excerpt from the source code comes 
only on top to make it easier to see where the problem is. And here, it 
helps to be able to directly spot the problem - instead scrolling around.


But as stated before, it's mostly bikeshadding: There are arguments for 
both and it does not matter for most of the source code. As stated 
before, I am in favour of the current version. But I also don't oppose 
if the settings are changed.


 * * *


Build and regtested on x86-64-gnu-linux.
OK for the trunk?

OK, thanks.


Thanks for the review!

Tobias,
who is still looking for someone to review his FINAL patch 
athttp://gcc.gnu.org/ml/fortran/2013-05/msg00134.html  (and possibly 
also the follow-up patch).


Re: [x86, PATCH 2/2] Enabling of the new Intel microarchitecture Silvermont

2013-06-01 Thread Jakub Jelinek
On Sat, Jun 01, 2013 at 03:52:55PM +0200, Jakub Jelinek wrote:
> On Fri, May 31, 2013 at 04:56:35PM +0400, Igor Zamyatin wrote:
> > Like this?
> 
> Sorry for nitpicking, but there are various formatting issues.

Also:
  if (clock1 == clock2)
  {
/* Determine winner - load must win. */
enum attr_memory memory1, memory2;
memory1 = get_attr_memory (top);
memory2 = get_attr_memory (next);
if (memory2 == MEMORY_LOAD && memory1 != MEMORY_LOAD)
  return true;
  }
should indent { by 2 columns (i.e. use tab) from if, the body
shouldbe moved 2 extra columns to the right and } as well.

And there is i>= 0 in the patch (missing space after i).

No idea why you do if (!reload_completed) return something;
in swap_top_of_ready_list and do_reoder_for_imul, when those
functions are only ever called from ix86_sched_reorder which bails
out early if !reload_completed.

Jakub


Re: [Patch, Fortran] Show better error location

2013-06-01 Thread Mikael Morin
On 01.06.2013 14:51, Tobias Burnus wrote:
> I am still not happy with changing the length of the displayed
> source-code in error messages to infinity if not terminal is available.
> One reason is that for long lines (e.g. generated code or long trailing
> comment lines) - the output is not very readable. And that the terminal
> is not available happens quite often, e.g. if one uses pipes to "less"
> or "tee" - or redirects to a file.
For the redirection to "less", one can use "less -S".
For "tee", it depends on what comes behind.
For the file case, one doesn't know how wide the final display will be.
It is easy to trim afterwards, but the converse is not true (obviously),
so my point is: keep everything if we don't know how much should be removed.

Would you be more pleased if the checks were reversed, that is first get
the terminal width, then if it fails check if we are outputting to a tty
and if not don't limit the output?


>   * * *
>
> I think that one reason for the wish to extend the displayed lines lies
> elsewhere: gfortran sometimes does a bad job with the column location in
> error messages. That's especially visible in the test suite which uses
> long dg-error/dg-warning comments after the actual code.
>
> Thus, I think we should fix the bad column location. (That's beneficial,
> independent whether one increased the trim length or not.) 
Certainly

>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?
>
OK, thanks.

Mikael


RE: [PATCH] fix for pr 57474

2013-06-01 Thread Iyer, Balaji V


> -Original Message-
> From: Dominique Dhumieres [mailto:domi...@lps.ens.fr]
> Sent: Saturday, June 01, 2013 2:35 AM
> To: gcc-patches@gcc.gnu.org; Iyer, Balaji V
> Cc: domi...@lps.ens.fr
> Subject: Re: [PATCH] fix for pr 57474
> 
> > ... This patch pasted below should fix that issue. ...
> 
> A quick test on darwin (no bootstrap, no full regtest) with make -k check-gcc
> RUNTESTFLAGS="cilk-plus.exp --target_board=unix'{-m32,-m64}'"
> gives
> 
>   === gcc Summary for unix/-m64 ===
> 
> # of expected passes  2904
> 
>   === gcc Summary ===
> 
> # of expected passes  5808
> 
> So the patch fixes the darwin issue.

Thanks for confirming this. Is this OK for trunk?

Balaji V. Iyer.

> 
> Thanks,
> 
> Dominique


Re: [x86, PATCH 2/2] Enabling of the new Intel microarchitecture Silvermont

2013-06-01 Thread Robert Dewar

On 6/1/2013 9:52 AM, Jakub Jelinek wrote:


Sorry for nitpicking, but there are various formatting issues.


A number of these formatting issues could be easily detected by
the compiler. It might be really useful to add a switch to do
such detection. For Ada, the GNAT compiler has -gnatyg which
enables standard style checking according to our coding
standards for Ada, and we find this saves a lot of time
as well as avoiding style errors getting into the code base
(this kind of nitpicking style error detection is more easily
done by a machine than a human). Of course not all stlye errors
can be easily handled, but a lot of them can!



Re: [x86, PATCH 2/2] Enabling of the new Intel microarchitecture Silvermont

2013-06-01 Thread Jakub Jelinek
On Fri, May 31, 2013 at 04:56:35PM +0400, Igor Zamyatin wrote:
> Like this?

Sorry for nitpicking, but there are various formatting issues.

+  if (ix86_tune == PROCESSOR_SLM)
+{
+  if (has_scale)
+return true;
+  if (split_cost < 1)
+return false;
+  if (regno0 == regno1 || regno0 == regno2)
+return false;
+  return true;

8 spaces instead of tab (several times)?

+  return !ix86_lea_outperforms (insn, regno0, regno1, regno2, split_cost,
+parts.scale > 1);
 }

Likewise.
 
+static bool
+exact_dependency_1 (rtx addr, rtx insn)
+{
+  enum rtx_code code;
+  const char *format_ptr;
+  int i, j;
+
+  code = GET_CODE (insn);
+  switch (code)
+{
+case MEM:
+  if (rtx_equal_p (addr, insn))
+return true;
+  break;
+case REG:
+CASE_CONST_ANY:
+case SYMBOL_REF:
+case CODE_LABEL:
+case PC:
+case CC0:
+case EXPR_LIST:
+  return false;
+default:
+  break;
+}

Likewise.
+
+  format_ptr = GET_RTX_FORMAT (code);
+  for (i = 0; i < GET_RTX_LENGTH (code); i++)
+{
+  switch (*format_ptr++)
+   {
+   case 'e':
+ if (exact_dependency_1 (addr, XEXP (insn, i)))
+   return true;
+ break;
+   case 'E':
+ for (j = 0; j < XVECLEN (insn, i); j++)
+   if (exact_dependency_1 (addr, XVECEXP (insn, i, j)))
+ return true;
+ break;
+   }

Likewise.

+case PROCESSOR_SLM:
+  if (!reload_completed)
+return cost;

Likewise.
+
+  /* Increase cost of integer loads.  */
+  memory = get_attr_memory (dep_insn);
+  if (memory == MEMORY_LOAD || memory == MEMORY_BOTH)
+{
+  enum attr_unit unit = get_attr_unit (dep_insn);
+  if (unit == UNIT_INTEGER && cost == 1)
+{
+  if (memory == MEMORY_LOAD)
+cost = 3;
+  else
+{
+  /* Increase cost of ld/st for short int types only
+ because of store forwarding issue.  */
+  rtx set = single_set (dep_insn);
+  if (set && (GET_MODE (SET_DEST (set)) == QImode
+  || GET_MODE (SET_DEST (set)) == HImode))
+{
+  /* Increase cost of store/load insn if exact
+ dependence exists and it is load insn.  */
+  enum attr_memory insn_memory = get_attr_memory (insn);
+  if (insn_memory == MEMORY_LOAD
+  && exact_store_load_dependency (dep_insn, insn))
+cost = 3;
+}
+}
+}
+}

Likewise lots of times (and several times more in the patch).

@@ -24565,47 +24685,32 @@ ia32_multipass_dfa_lookahead (void)
execution. It is applied if
(1) IMUL instruction is on the top of list;
(2) There exists the only producer of independent IMUL instruction in
-   ready list;
-   (3) Put found producer on the top of ready list.
-   Returns issue rate.  */
-
+   ready list.
+   Return index of IMUL producer if it was found and -1 otherwise.  */
 static int
-ix86_sched_reorder(FILE *dump, int sched_verbose, rtx *ready, int *pn_ready,
-   int clock_var ATTRIBUTE_UNUSED)
+do_reoder_for_imul(rtx *ready, int n_ready)

do_reorder_for_imul ?  Also, missing space between imul and (.

+/* Try to find the best candidate on the top of ready list if two insns
+   have the same priority - candidate is best if its dependees were
+   scheduled earlier. Applied for Silvermont only.
+   Return true if top 2 insns must be interchanged.  */
+static bool
+swap_top_of_ready_list(rtx *ready, int n_ready)

Missing space before (.

+/* Perform possible reodering of ready list for Atom/Silvermont only.
+   Return issue rate.  */
+static int
+ix86_sched_reorder(FILE *dump, int sched_verbose, rtx *ready, int *pn_ready,
+   int clock_var)

Likewise.
+{
+  int issue_rate = -1;
+  int n_ready = *pn_ready;
+  int i;
+  rtx insn;
+  int index = -1;
+
+  /* Set up issue rate.  */
+  issue_rate = ix86_issue_rate();

Likewise.

+fprintf(dump, ";;\tatom sched_reorder: put %d insn on top\n",
+INSN_UID (ready[index]));

Likewise.

+  /* Put IMUL producer (ready[index]) at the top of ready list.  */
+  insn= ready[index];

Missing space before =.

+  if (sched_verbose > 1)
+fprintf(dump, ";;\tslm sched_reorder: swap %d and %d insns\n",
+INSN_UID (ready[n_ready - 1]), INSN_UID (ready[n_ready - 2]));

Missing space before (.

Jakub


Re: Fix PR57268

2013-06-01 Thread Jakub Jelinek
On Sat, Jun 01, 2013 at 10:11:24AM +0200, Jakub Jelinek wrote:
> On Sat, Jun 01, 2013 at 08:39:58AM +0400, Dinar Temirbulatov wrote:
> > I am investigating the problem.
> 
> I'd guess you don't want to flush on DEBUG_INSN_Ps, because then you'd flush
> differently between -g and -g0.  So perhaps something like:

Now bootstrapped/regtested on x86_64-linux and i686-linux.  I see you've
already reverted in the mean time, so ok for trunk this way?

2013-06-01  Jakub Jelinek  

PR rtl-optimization/57268
* sched-deps.c (sched_analyze_2): Don't flush_pedning_lists
if DEBUG_INSN_P (insn).

Reapply
2013-05-31  Dinar Temirbulatov  

PR rtl-optimization/57268
* sched-deps.c (sched_analyze_2): Flush dependence lists if
the sum of the read and write lists exceeds MAX_PENDING_LIST_LENGTH.

--- gcc/sched-deps.c(revision 199576)
+++ gcc/sched-deps.c(revision 199575)
@@ -2690,8 +2690,15 @@
 
/* Always add these dependencies to pending_reads, since
   this insn may be followed by a write.  */
-if (!deps->readonly)
-  add_insn_mem_dependence (deps, true, insn, x);
+   if (!deps->readonly)
+ {
+   if ((deps->pending_read_list_length
++ deps->pending_write_list_length)
+   > MAX_PENDING_LIST_LENGTH
+   && !DEBUG_INSN_P (insn))
+ flush_pending_lists (deps, insn, true, true);
+   add_insn_mem_dependence (deps, true, insn, x);
+ }
 
sched_analyze_2 (deps, XEXP (x, 0), insn);
 

Jakub


[Patch, Fortran] Show better error location

2013-06-01 Thread Tobias Burnus
I am still not happy with changing the length of the displayed 
source-code in error messages to infinity if not terminal is available. 
One reason is that for long lines (e.g. generated code or long trailing 
comment lines) - the output is not very readable. And that the terminal 
is not available happens quite often, e.g. if one uses pipes to "less" 
or "tee" - or redirects to a file. Admittedly, in Fortran code, the line 
length is typically not extremely long; thus, the trimming usually does 
not cause - nor does increasing the limit.


 * * *

I think that one reason for the wish to extend the displayed lines lies 
elsewhere: gfortran sometimes does a bad job with the column location in 
error messages. That's especially visible in the test suite which uses 
long dg-error/dg-warning comments after the actual code.


Thus, I think we should fix the bad column location. (That's beneficial, 
independent whether one increased the trim length or not.) This patch 
fixes a bunch of those isses, but one can surely do more.


Comments?

One example is:

  END BLOCK ! { dg-error "Expected block name of 'myname2'" }
 1
Error: Expected block name of 'myname2' in END BLOCK statement at (1)


for which one gets with the patch:

  END ASSOCIATE ! { dg-error "Expected block name of 'myname'" }
   1
Error: Expected block name of 'myname' in END ASSOCIATE statement at (1)


Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
2013-06-01  Tobias Burnus  

	* decl.c (add_global_entry): Take locus.
	(gfc_match_entry): Update call.
	(gfc_match_end): Better error location.
	* parse.c (parse_block_data, parse_module, add_global_procedure,
	add_global_program): Use better locus data.

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 6ab9cc7..f1aa31e 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -5354,7 +5354,8 @@ cleanup:
to return false upon finding an existing global entry.  */
 
 static bool
-add_global_entry (const char *name, const char *binding_label, bool sub)
+add_global_entry (const char *name, const char *binding_label, bool sub,
+		  locus *where)
 {
   gfc_gsymbol *s;
   enum gfc_symbol_type type;
@@ -5369,14 +5370,14 @@ add_global_entry (const char *name, const char *binding_label, bool sub)
 
   if (s->defined || (s->type != GSYM_UNKNOWN && s->type != type))
 	{
-	  gfc_global_used(s, NULL);
+	  gfc_global_used (s, where);
 	  return false;
 	}
   else
 	{
 	  s->type = type;
 	  s->sym_name = name;
-	  s->where = gfc_current_locus;
+	  s->where = *where;
 	  s->defined = 1;
 	  s->ns = gfc_current_ns;
 	}
@@ -5391,7 +5392,7 @@ add_global_entry (const char *name, const char *binding_label, bool sub)
 
   if (s->defined || (s->type != GSYM_UNKNOWN && s->type != type))
 	{
-	  gfc_global_used(s, NULL);
+	  gfc_global_used (s, where);
 	  return false;
 	}
   else
@@ -5399,7 +5400,7 @@ add_global_entry (const char *name, const char *binding_label, bool sub)
 	  s->type = type;
 	  s->sym_name = name;
 	  s->binding_label = binding_label;
-	  s->where = gfc_current_locus;
+	  s->where = *where;
 	  s->defined = 1;
 	  s->ns = gfc_current_ns;
 	}
@@ -5528,6 +5529,7 @@ gfc_match_entry (void)
 
   /* Check what next non-whitespace character is so we can tell if there
  is the required parens if we have a BIND(C).  */
+  old_loc = gfc_current_locus;
   gfc_gobble_whitespace ();
   peek_char = gfc_peek_ascii_char ();
 
@@ -,7 +5557,8 @@ gfc_match_entry (void)
 	}
 
   if (!gfc_current_ns->parent
-	  && !add_global_entry (name, entry->binding_label, true))
+	  && !add_global_entry (name, entry->binding_label, true,
+&old_loc))
 	return MATCH_ERROR;
 
   /* An entry in a subroutine.  */
@@ -5574,7 +5577,6 @@ gfc_match_entry (void)
 	ENTRY f() RESULT (r)
 	 can't be written as
 	ENTRY f RESULT (r).  */
-  old_loc = gfc_current_locus;
   if (gfc_match_eos () == MATCH_YES)
 	{
 	  gfc_current_locus = old_loc;
@@ -5624,7 +5626,8 @@ gfc_match_entry (void)
 	}
 
   if (!gfc_current_ns->parent
-	  && !add_global_entry (name, entry->binding_label, false))
+	  && !add_global_entry (name, entry->binding_label, false,
+&old_loc))
 	return MATCH_ERROR;
 }
 
@@ -6108,6 +6111,7 @@ gfc_match_end (gfc_statement *st)
   goto cleanup;
 }
 
+  old_loc = gfc_current_locus;
   if (gfc_match_eos () == MATCH_YES)
 {
   if (!eos_ok && (*st == ST_END_SUBROUTINE || *st == ST_END_FUNCTION))
@@ -6131,10 +6135,12 @@ gfc_match_end (gfc_statement *st)
   /* Verify that we've got the sort of end-block that we're expecting.  */
   if (gfc_match (target) != MATCH_YES)
 {
-  gfc_error ("Expecting %s statement at %C", gfc_ascii_statement (*st));
+  gfc_error ("Expecting %s statement at %L", gfc_ascii_statement (*st),
+		 &old_loc);
   goto cleanup;
 }
 
+  old_loc = gfc_current_locus;
   /* If we're at the end, make sure a block name wasn't require

Re: [c++-concepts]

2013-06-01 Thread Andrew Sutton
>   * Check against cxx11 dialect, not cxx0x.

This check is actually all over parser.c, the reason it shows up in
the patch is that I reverted a previous change that affected some code
that included it.

I'd feel better leaving it in, since its a change that could affect
some other part of the compiler.

Andrew


[Patch, Fortran] PR57496 use finiteq etc. for __float in write_float.def

2013-06-01 Thread Tobias Burnus

Found when looking at the issue of the PR, but unrelated.

For __float128, we have to use the libquadmath functions - not the "long 
double" ones.


The patch is rather obvious, though I wonder whether it could clash with 
some #defines of the system headers on some systems.


Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
2013-06-01  Tobias Burnus  

	PR fortran/57496
	* io/write_float.def (ISFINITE2Q, ISFINITE2, ISFINITE2L, ISFINITE,
	SIGNBIT2Q, SIGNBIT2, SIGNBIT2L, SIGNBIT, ISNAN2Q, ISNAN2, ISNAN2L,
	ISNAN): New macros.
	(WRITE_FLOAT): Use them.

diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index a157f0b..4f0fa72 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -961,6 +961,34 @@ __qmath_(quadmath_snprintf) (buffer, size, "%+-#.*Qf", \
 #endif
 
 
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define ISFINITE2Q(val) finiteq(val)
+#endif
+#define ISFINITE2(val) isfinite(val)
+#define ISFINITE2L(val) isfinite(val)
+
+#define ISFINITE(suff,val) TOKENPASTE(ISFINITE2,suff)(val)
+
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define SIGNBIT2Q(val) signbitq(val)
+#endif
+#define SIGNBIT2(val) signbit(val)
+#define SIGNBIT2L(val) signbit(val)
+
+#define SIGNBIT(suff,val) TOKENPASTE(SIGNBIT2,suff)(val)
+
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
+#define ISNAN2Q(val) isnanq(val)
+#endif
+#define ISNAN2(val) isnan(val)
+#define ISNAN2L(val) isnan(val)
+
+#define ISNAN(suff,val) TOKENPASTE(ISNAN2,suff)(val)
+
+
+
 /* Generate corresponding I/O format for FMT_G and output.
The rules to translate FMT_G to FMT_E or FMT_F from DEC fortran
LRM (table 11-2, Chapter 11, "I/O Formatting", P11-25) is:
@@ -1194,10 +1222,10 @@ determine_en_precision (st_parameter_dt *dtp, const fnode *f,
 {\
 	GFC_REAL_ ## x tmp;\
 	tmp = * (GFC_REAL_ ## x *)source;\
-	sign_bit = signbit (tmp);\
-	if (!isfinite (tmp))\
+	sign_bit = SIGNBIT (y,tmp);\
+	if (!ISFINITE (y,tmp))\
 	  { \
-	write_infnan (dtp, f, isnan (tmp), sign_bit);\
+	write_infnan (dtp, f, ISNAN (y,tmp), sign_bit);\
 	return;\
 	  }\
 	tmp = sign_bit ? -tmp : tmp;\


[Patch, Fortran] Detecting the terminal width

2013-06-01 Thread Janus Weil
>> Index: gcc/fortran/error.c
>> ===
>> --- gcc/fortran/error.c   (revision 199530)
>> +++ gcc/fortran/error.c   (working copy)
>> @@ -30,6 +30,13 @@ along with GCC; see the file COPYING3.  If not see
>>  #include "flags.h"
>>  #include "gfortran.h"
>>
>> +#if !(defined (_WIN32) || defined (VMS) || defined (__vxworks) || \
>> +  defined (__Lynx__) || defined (__ANDROID__))
> We should better use autoconf rather than hard-coding platforms here.

Ok. Unfortunately I'm not much of a autoconf hero (better to say: not
at all). Is the new patch in the attachment sufficient (probably not
...)? I can not test it on my system with --enable-maintainer-mode
because I get:

configure.ac:2: error: Please use exactly Autoconf 2.64 instead of 2.69.

Why on earth does GCC require an old autoconf version?


>> +/* Determine terminal width (for trimming source lines in output).  */
>> +
>>  static int
>>  get_terminal_width (void)
>>  {
>> +  /* Only limit the width if we're outputting to a terminal.  */
>> +  if (!isatty (STDERR_FILENO))
>> +return INT_MAX;
> Guard it with HAVE_UNISTD_H or HAVE_ISATTY ?

Done.


>> +  /* Method #1: Use ioctl (not available on all systems).  */
>> +#ifdef TIOCGWINSZ
>> +  struct winsize w;
>> +  ioctl (0, TIOCGWINSZ, &w);
> You should check the ioctl result.  I bet it returns non-zero in
> Manfred's (pathological) case...

Also done.


> The rest looks good.

Thanks for the feedback, Mikael. New patch attached ...

Cheers,
Janus


terminal_width_v3.diff
Description: Binary data


Re: [Patch, Fortran] PR57456 - Handle ALLOCATE with typespec for CLASS

2013-06-01 Thread Tobias Burnus

Dominique Dhumieres wrote:

As written the test in gfortran.dg/class_array_17.f90 is a no-op


Well spotted! Thanks for the report. I have committed the attached patch 
as obvious, Rev. 199573.


Tobias

PS: I realized that I should have put your name in the ChangeLog as you 
found and patched the issue.
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog	(Revision 199560)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2013-06-01  Tobias Burnus  
+
+	PR fortran/57456
+	* gfortran.dg/class_array_17.f90: New.
+
 2013-05-31  Eric Botcazou  
 
 	* ada/acats/floatstore.lst: New.
Index: gcc/testsuite/gfortran.dg/class_array_17.f90
===
--- gcc/testsuite/gfortran.dg/class_array_17.f90	(Revision 199560)
+++ gcc/testsuite/gfortran.dg/class_array_17.f90	(Arbeitskopie)
@@ -30,5 +30,5 @@ program test
   deallocate(y)
 end
 
-! { dg-final { scan-tree-dump-times "__builtin_malloc (40);" 0 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_malloc \\(40\\);" 1 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }


Re: Fix PR57268

2013-06-01 Thread Jakub Jelinek
On Sat, Jun 01, 2013 at 08:39:58AM +0400, Dinar Temirbulatov wrote:
> oh, This is my mistake I should have bootstrap the compiler.

That is a requirement for most of commits, see
http://gcc.gnu.org/contribute.html for the exact rules.

I am investigating the problem.

I'd guess you don't want to flush on DEBUG_INSN_Ps, because then you'd flush
differently between -g and -g0.  So perhaps something like:
--- gcc/sched-deps.c2013-06-01 10:03:00.678514521 +0200
+++ gcc/sched-deps.c2013-06-01 10:05:03.119864726 +0200
@@ -2694,10 +2694,11 @@ sched_analyze_2 (struct deps_desc *deps,
  {
if ((deps->pending_read_list_length
 + deps->pending_write_list_length)
-   > MAX_PENDING_LIST_LENGTH)
+   > MAX_PENDING_LIST_LENGTH
+   && !DEBUG_INSN_P (insn))
  flush_pending_lists (deps, insn, true, true);
add_insn_mem_dependence (deps, true, insn, x);
-   }
+ }
 
sched_analyze_2 (deps, XEXP (x, 0), insn);

but I haven't tested it.  Note, in your patch the closing } was misplaced,
it is supposed to line up with the opening {.

Anyway, if you can't fix this really quickly, please revert your patch.
Bootstrap failure on the most commonly used GCC target by developers
should never be taken lightly.

Jakub