Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'

2014-12-20 Thread Chen Gang

After try the latest gcc again (execuse me, during these days, I have to
do another things), all things OK, the kernel can be started by QEMU,
all related issues are fixed by other members.

I shall start the make check with qemu again (it is about 12-13 days).
I guess, this thread is almost spam thread, but I still should try my
best to finish it (then I shall try to start 'make check' for tile).

By the way, if this thread really has negative effect with other members,
please warn me, I should not notify it to mailing list again, and try my
best to finish it within myself.

Thanks.

On 11/29/2014 06:25 PM, Chen Gang wrote:
 Hello Maintainers:
 
 After analysing, it is not kernel's issue, it is gcc issue, after let
 kernel related variable bypass this gcc issue, the kernel can start up
 successfully.
 
 The issue is after declaration, the __attribute_((__section__ ...))
 will be ignored. After simplification, the related shell commands are:
 
   [root@localhost ana]# cat test.i
   extern int a;
   int a __attribute__((__section__(.data..init_task))) = 0;
   [root@localhost ana]# /upstream/release/bin/microblaze-gchen-linux-gcc -c 
 -o test.o test.i -save-temps
   [root@localhost ana]# cat test.s
   .globl  a
   .bss
   .lcomm  a,4,4
   .type   a, @object
   [root@localhost ana]# microblaze-linux-gnu-gcc -c -o test.o test.i 
 -save-temps
   [root@localhost ana]# cat test.s
   .globl  a
   .section.data..init_task,aw,@progbits
   .align  2
   .type   a,@object
   .size   a,4
   a:
   .space  4
   [root@localhost ana]# /upstream/release/bin/microblaze-gchen-linux-gcc -v
   Using built-in specs.
   COLLECT_GCC=/upstream/release/bin/microblaze-gchen-linux-gcc
   
 COLLECT_LTO_WRAPPER=/upstream/release/libexec/gcc/microblaze-gchen-linux/5.0.0/lto-wrapper
   Target: microblaze-gchen-linux
   Configured with: ../gcc-new/configure --target=microblaze-gchen-linux 
 --disable-nls --enable-languages=c --disable-threads --disable-shared 
 --with-headers=/upstream/release/kernel --disable-libssp 
 --disable-libquadmath --disable-libgomp --disable-libatomic 
 --with-sysroot=/upstream/release --prefix=/upstream/release : (reconfigured) 
 ../gcc-new/configure --target=microblaze-gchen-linux --disable-nls 
 --disable-threads --disable-shared --with-headers=/upstream/release/kernel 
 --disable-libssp --disable-libquadmath --disable-libgomp --disable-libatomic 
 --with-sysroot=/upstream/release --prefix=/upstream/release 
 target_alias=microblaze-gchen-linux --enable-languages=c,lto --no-create 
 --no-recursion
   Thread model: single
   gcc version 5.0.0 20140925 (experimental) (GCC) 
 
 
 And it is fixed in the latest microblaze gcc version, but the latest gcc
 will cause another issue for compiling kernel. I shall try to analyse it
 within next month (2014-12-31), the related issue is:
 
   net/core/dev.c: In function 'register_netdevice':
   net/core/dev.c:7285:1: internal compiler error: in verify_ssa, at 
 tree-ssa.c:939
subsys_initcall(net_dev_init);
^
   0xbf77ab verify_ssa(bool, bool)
   ../../gcc-microblaze/gcc/tree-ssa.c:939
   0x956e6b execute_function_todo
   ../../gcc-microblaze/gcc/passes.c:1947
   0x95756d do_per_function
   ../../gcc-microblaze/gcc/passes.c:1639
   0x957683 execute_todo
   ../../gcc-microblaze/gcc/passes.c:1997
   Please submit a full bug report,
   with preprocessed source if appropriate.
   Please include the complete backtrace with any bug report.
   See http://gcc.gnu.org/bugs.html for instructions.
   make[2]: *** [net/core/dev.o] Error 1
   [root@localhost ana]# 
 /upstream/release-microblaze/bin/microblaze-gchen-linux-gcc -v
   Using built-in specs.
   COLLECT_GCC=/upstream/release-microblaze/bin/microblaze-gchen-linux-gcc
   
 COLLECT_LTO_WRAPPER=/upstream/release-microblaze/libexec/gcc/microblaze-gchen-linux/5.0.0/lto-wrapper
   Target: microblaze-gchen-linux
   Configured with: ../gcc-microblaze/configure 
 --target=microblaze-gchen-linux --disable-nls --enable-languages=c 
 --disable-threads --disable-shared 
 --with-headers=/upstream/release-microblaze/kernel --disable-libssp 
 --disable-libquadmath --disable-libgomp --disable-libatomic 
 --with-sysroot=/upstream/release-microblaze 
 --prefix=/upstream/release-microblaze
   Thread model: single
   gcc version 5.0.0 20141129 (experimental) (GCC) 
 
 
 After finish analysing, I shall start make check under microblaze qemu
 (may need about 12-13 days for testing).
 
 Welcome any ideas, suggestions, and completions.
 
 Thanks.
 
 On 11/20/2014 11:33 PM, Chen Gang wrote:

 Oh, sorry, after ran more than 10 days, the qemu crashed :-(

 After checked the output log, and compare with the original log, we know
 we have finished more than 90% test, and it is OK (no any new issues).
 I guess the reason is I started too many other things on this machine.

 Next, I shall try to analyze the cross compiled Linux kernel will run
 in dead lock issue. After 

Re: [PATCH PR62151]Fix REG_DEAD note distribution issue by using right ELIM_I0/ELIM_I1

2014-12-20 Thread Eric Botcazou
 As described both in the PR and patch comments, this patch fixes PR62151 by
 setting right value to ELIM_I0/ELIM_I1 when distributing REG_DEAD notes from
 i0/i1.  It is said that distribute_notes had caused many bugs in the past.
 I think it still has bug in it, as noted in the PR.  This patch doesn't
 touch distribute_notes because we are in stage3 and I want to have more
 discussion on it.
 Bootstrap and test on x86_64.  aarch64 is ongoing.  So is it ok?
 
 2014-12-11  Bin Cheng  bin.ch...@arm.com
 
   PR rtl-optimization/62151
   * combine.c (try_combine): Reset elim_i0 and elim_i1 when
   distributing notes from i0notes or i1notes, this time don't
   check whether newi2pat sets i1dest or i0dest.

The reasoning looks correct to me and the patch is certainly safe so it's OK 
on principle, but I think that we should avoid the duplication of predicates.

Can you move the computation of the alternative elim_i1  elim_i0 up to where 
the original ones are computed along with the explanation of why we care about 
newi2pat only for notes that were on I3 and I2?  Something like:

   /* Compute which registers we expect to eliminate.  newi2pat may be setting
  either i3dest or i2dest, so we must check it.  */
rtx elim_i2 = ((newi2pat  reg_set_p (i2dest, newi2pat))
   || i2dest_in_i2src || i2dest_in_i1src || i2dest_in_i0src
   || !i2dest_killed
   ? 0 : i2dest);
   /* For I1 we need to compute both local elimination and global elimination
  because i1dest may be the same as i3dest, in which case newi2pat may be
  setting i1dest.  big explanation of why this is needed  */
rtx local_elim_i1 = (i1 == 0 || i1dest_in_i1src || i1dest_in_i0src
   || !i1dest_killed
   ? 0 : i1dest);
rtx elim_i1 = (local_elim_i1 == 0
   || (newi2pat  reg_set_p (i1dest, newi2pat))
   ? 0 : i1dest);
/* Likewise for I0.  */
rtx local_elim_i0 = (i0 == 0 || i0dest_in_i0src
   || !i0dest_killed
   ? 0 : i0dest);
rtx elim_i0 = (local_elim_i0 == 0
   || (newi2pat  reg_set_p (i0dest, newi2pat))
   ? 0 : i0dest);

-- 
Eric Botcazou


Re: [PATCH 1/3] libstdc++: Add time_get::get support.

2014-12-20 Thread Jonathan Wakely

On 15/04/14 23:19 +0200, Rüdiger Sonderfeld wrote:

This patch adds support for std::time_get::get and std::time_get::do_get
[locale.time.get].  Currently do_get is not virtual because this caused
segfault errors for me.


Hi Rüdiger, I'm trying to apply this patch and the tests don't work.

There also seem to be some problems in the new functions.


* libstdc++-v3/include/bits/locale_facets_nonio.h (time_get::get):
 (time_get::do_get):  New method (C++11).
* libstdc++-v3/include/bits/locale_facets_nonio.tcc (time_get::get):
 (time_get::do_get):  New method (C++11).
* libstdc++-v3/testsuite/22_locale/time_get/get/char/1.cc: New file.
* libstdc++-v3/testsuite/22_locale/time_get/get/char/2.cc: New file.
---
libstdc++-v3/include/bits/locale_facets_nonio.h|  73 
libstdc++-v3/include/bits/locale_facets_nonio.tcc  | 102 
.../testsuite/22_locale/time_get/get/char/1.cc | 129 
.../testsuite/22_locale/time_get/get/char/2.cc | 103 
.../testsuite/22_locale/time_get/get/wchar_t/1.cc  | 130 +
.../testsuite/22_locale/time_get/get/wchar_t/2.cc  | 104 +
6 files changed, 641 insertions(+)
create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/char/1.cc
create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/char/2.cc
create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/wchar_t/1.cc
create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/wchar_t/2.cc

diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc 
b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index 41d944d..93466b6 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -1137,6 +1137,108 @@ _GLIBCXX_END_NAMESPACE_LDBL
  return __beg;
}

+#if __cplusplus = 201103L
+  templatetypename _CharT, typename _InIter
+inline
+_InIter
+time_get_CharT, _InIter::
+get(iter_type __s, iter_type __end, ios_base __io,
+ios_base::iostate __err, tm* __tm, const char_type *__fmt,
+const char_type *__fmtend) const
+{
+  const locale __loc = __io._M_getloc();
+  ctype_CharT const __ctype = use_facetctype_CharT (__loc);
+  __err = ios_base::goodbit;
+  while (__fmt != __fmtend 
+ __err == ios_base::goodbit)
+{
+  if (__s == __end)
+{
+  __err = ios_base::eofbit | ios_base::failbit;
+  break;
+}
+  else if (__ctype.narrow(*__fmt, 0) == '%')
+{
+  char __format;
+  char __mod = 0;
+  if (++__fmt == __fmtend)
+{
+  __err = ios_base::failbit;
+  break;
+}
+  const char __c = __ctype.narrow(*__fmt, 0);
+  if (__c != 'E'  __c != 'O')
+__format = __c;
+  else if (++__fmt != __fmtend)
+{
+  __mod = __c;
+  __format = __ctype.narrow(*__fmt, 0);
+}
+  else
+{
+  __err = ios_base::failbit;
+  break;
+}
+  __s = this-do_get(__s, __end, __io, __err, __tm, __format, 
__mod);
+  ++__fmt;
+}
+  else if (__ctype.is(ctype_base::space, *__fmt))
+{
+  ++__fmt;
+  while (__fmt != __fmtend 
+ __ctype.is(ctype_base::space, *__fmt))
+++__fmt;
+
+  while (__s != __end 
+ __ctype.is(ctype_base::space, *__s))
+++__s;
+}
+  // TODO real case-insensitive comparison
+  else if (__ctype.tolower(*__s) == __ctype.tolower(*__fmt) ||
+   __ctype.toupper(*__s) == __ctype.toupper(*__fmt))
+{
+  ++__s;
+  ++__fmt;
+}
+  else
+{
+  __err = ios_base::failbit;
+  break;
+}
+}
+  return __s;
+}
+
+  templatetypename _CharT, typename _InIter
+inline
+_InIter
+time_get_CharT, _InIter::
+do_get(iter_type __beg, iter_type __end, ios_base __io,
+   ios_base::iostate __err, tm* __tm,
+   char __format, char __mod) const
+{
+  const locale __loc = __io._M_getloc();
+  ctype_CharT const __ctype = use_facetctype_CharT (__loc);


Shouldn't this set err = goodbit before doing anything?

 Effects: The function starts by evaluating err = ios_base::goodbit.


+  char_type __fmt[4];
+  __fmt[0] = __ctype.widen('%');
+  if (!__mod)
+{
+  __fmt[1] = __format;
+  __fmt[2] = char_type();
+}
+  else
+{
+  __fmt[1] = __mod;
+  __fmt[2] = __format;
+  __fmt[3] = char_type();
+}
+
+  return _M_extract_via_format(__beg, __end, 

Re: [PATCH 1/3] libstdc++: Add time_get::get support.

2014-12-20 Thread Jonathan Wakely

On 20/12/14 13:07 +, Jonathan Wakely wrote:

On 15/04/14 23:19 +0200, Rüdiger Sonderfeld wrote:

This patch adds support for std::time_get::get and std::time_get::do_get
[locale.time.get].  Currently do_get is not virtual because this caused
segfault errors for me.


Hi Rüdiger, I'm trying to apply this patch and the tests don't work.

There also seem to be some problems in the new functions.


* libstdc++-v3/include/bits/locale_facets_nonio.h (time_get::get):
(time_get::do_get):  New method (C++11).
* libstdc++-v3/include/bits/locale_facets_nonio.tcc (time_get::get):
(time_get::do_get):  New method (C++11).
* libstdc++-v3/testsuite/22_locale/time_get/get/char/1.cc: New file.
* libstdc++-v3/testsuite/22_locale/time_get/get/char/2.cc: New file.
---
libstdc++-v3/include/bits/locale_facets_nonio.h|  73 
libstdc++-v3/include/bits/locale_facets_nonio.tcc  | 102 
.../testsuite/22_locale/time_get/get/char/1.cc | 129 
.../testsuite/22_locale/time_get/get/char/2.cc | 103 
.../testsuite/22_locale/time_get/get/wchar_t/1.cc  | 130 +
.../testsuite/22_locale/time_get/get/wchar_t/2.cc  | 104 +
6 files changed, 641 insertions(+)
create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/char/1.cc
create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/char/2.cc
create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/wchar_t/1.cc
create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/wchar_t/2.cc

diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc 
b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index 41d944d..93466b6 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -1137,6 +1137,108 @@ _GLIBCXX_END_NAMESPACE_LDBL
 return __beg;
   }

+#if __cplusplus = 201103L
+  templatetypename _CharT, typename _InIter
+inline
+_InIter
+time_get_CharT, _InIter::
+get(iter_type __s, iter_type __end, ios_base __io,
+ios_base::iostate __err, tm* __tm, const char_type *__fmt,
+const char_type *__fmtend) const
+{
+  const locale __loc = __io._M_getloc();
+  ctype_CharT const __ctype = use_facetctype_CharT (__loc);
+  __err = ios_base::goodbit;
+  while (__fmt != __fmtend 
+ __err == ios_base::goodbit)
+{
+  if (__s == __end)
+{
+  __err = ios_base::eofbit | ios_base::failbit;
+  break;
+}
+  else if (__ctype.narrow(*__fmt, 0) == '%')
+{
+  char __format;
+  char __mod = 0;
+  if (++__fmt == __fmtend)
+{
+  __err = ios_base::failbit;
+  break;
+}
+  const char __c = __ctype.narrow(*__fmt, 0);
+  if (__c != 'E'  __c != 'O')
+__format = __c;
+  else if (++__fmt != __fmtend)
+{
+  __mod = __c;
+  __format = __ctype.narrow(*__fmt, 0);
+}
+  else
+{
+  __err = ios_base::failbit;
+  break;
+}
+  __s = this-do_get(__s, __end, __io, __err, __tm, __format, 
__mod);
+  ++__fmt;
+}
+  else if (__ctype.is(ctype_base::space, *__fmt))
+{
+  ++__fmt;
+  while (__fmt != __fmtend 
+ __ctype.is(ctype_base::space, *__fmt))
+++__fmt;
+
+  while (__s != __end 
+ __ctype.is(ctype_base::space, *__s))
+++__s;
+}
+  // TODO real case-insensitive comparison
+  else if (__ctype.tolower(*__s) == __ctype.tolower(*__fmt) ||
+   __ctype.toupper(*__s) == __ctype.toupper(*__fmt))
+{
+  ++__s;
+  ++__fmt;
+}
+  else
+{
+  __err = ios_base::failbit;
+  break;
+}
+}
+  return __s;
+}
+
+  templatetypename _CharT, typename _InIter
+inline
+_InIter
+time_get_CharT, _InIter::
+do_get(iter_type __beg, iter_type __end, ios_base __io,
+   ios_base::iostate __err, tm* __tm,
+   char __format, char __mod) const
+{
+  const locale __loc = __io._M_getloc();
+  ctype_CharT const __ctype = use_facetctype_CharT (__loc);


Shouldn't this set err = goodbit before doing anything?

Effects: The function starts by evaluating err = ios_base::goodbit.


+  char_type __fmt[4];
+  __fmt[0] = __ctype.widen('%');
+  if (!__mod)
+{
+  __fmt[1] = __format;
+  __fmt[2] = char_type();
+}
+  else
+{
+  __fmt[1] = __mod;
+  __fmt[2] = __format;
+  __fmt[3] = char_type();
+}
+
+  

[PATCH] rs6000: Make rs6000_split_logical handle inverted 2nd operand (PR64358)

2014-12-20 Thread Segher Boessenkool
If rs6000_split_logical is asked to invert the second operand (but not
the first), it emits RTL that is just that; but canonical RTL has the
first arm inverted if only one, not the second.  This patch fixes that.

With that in place, the bug in PR target/64358 is easily fixed.  Do
that.  Also change the other 128-bit boolc splitter to have the same
operand order as everything else.  And use BOOL_REGS_OP1 and _OP2 for
operands 1 resp. 2 (not the other way around); this doesn't actually
matter, but it was a bit confusing.

This fixes builtin-arith-overflow-{10,11}.c as well.

Bootstrapped (no fortran this time, it doesn't build right now) and
tested on powerpc64-linux, -m32,-m32/-mpowerpc64,-m64,-m64/-mlra; no
regressions (and the mentioned cases fixed).

Okay for mainline?  Does this need backporting as well?


Segher


2014-12-20  Segher Boessenkool  seg...@kernel.crashing.org

gcc/
PR target/64358
* config/rs6000/rs6000.c (rs6000_split_logical_inner): Swap the
input operands if only the second is inverted.
* config/rs6000/rs6000.md (*boolcmode3_internal1 for BOOL_128):
Swap BOOL_REGS_OP1 and BOOL_REGS_OP2.  Correct arguments to
rs6000_split_logical.
(*boolcmode3_internal2 for TI2): Swap operands[1] and operands[2].

---
 gcc/config/rs6000/rs6000.c  |  4 
 gcc/config/rs6000/rs6000.md | 12 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 73152ce..bbed888 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -33167,6 +33167,10 @@ rs6000_split_logical_inner (rtx dest,
   if (complement_op2_p)
 op2 = gen_rtx_NOT (mode, op2);
 
+  /* For canonical RTL, if only one arm is inverted it is the first.  */
+  if (!complement_op1_p  complement_op2_p)
+std::swap (op1, op2);
+
   bool_rtx = ((code == NOT)
  ? gen_rtx_NOT (mode, op1)
  : gen_rtx_fmt_ee (code, mode, op1, op2));
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 36e6182..2d3a5d3 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -7570,8 +7570,8 @@ (define_insn_and_split *boolcmode3_internal1
   [(set (match_operand:BOOL_128 0 vlogical_operand =BOOL_REGS_OUTPUT)
(match_operator:BOOL_128 3 boolean_operator
 [(not:BOOL_128
-  (match_operand:BOOL_128 2 vlogical_operand BOOL_REGS_OP1))
- (match_operand:BOOL_128 1 vlogical_operand BOOL_REGS_OP2)]))]
+  (match_operand:BOOL_128 2 vlogical_operand BOOL_REGS_OP2))
+ (match_operand:BOOL_128 1 vlogical_operand BOOL_REGS_OP1)]))]
   TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)
 {
   if (TARGET_VSX  vsx_register_operand (operands[0], MODEmode))
@@ -7586,7 +7586,7 @@ (define_insn_and_split *boolcmode3_internal1
 reload_completed  int_reg_operand (operands[0], MODEmode)
   [(const_int 0)]
 {
-  rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false);
+  rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, true);
   DONE;
 }
   [(set (attr type)
@@ -7607,14 +7607,14 @@ (define_insn_and_split *boolcmode3_internal2
   [(set (match_operand:TI2 0 int_reg_operand =r,r,r)
(match_operator:TI2 3 boolean_operator
 [(not:TI2
-  (match_operand:TI2 1 int_reg_operand r,0,r))
- (match_operand:TI2 2 int_reg_operand r,r,0)]))]
+  (match_operand:TI2 2 int_reg_operand r,0,r))
+ (match_operand:TI2 1 int_reg_operand r,r,0)]))]
   !TARGET_P8_VECTOR  (GET_CODE (operands[3]) != AND)
   #
   reload_completed  !TARGET_P8_VECTOR  (GET_CODE (operands[3]) != AND)
   [(const_int 0)]
 {
-  rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false);
+  rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, true);
   DONE;
 }
   [(set_attr type integer)
-- 
1.8.1.4



Re: [PATCH] rs6000: Make rs6000_split_logical handle inverted 2nd operand (PR64358)

2014-12-20 Thread David Edelsohn
On Sat, Dec 20, 2014 at 10:18 AM, Segher Boessenkool
seg...@kernel.crashing.org wrote:
 If rs6000_split_logical is asked to invert the second operand (but not
 the first), it emits RTL that is just that; but canonical RTL has the
 first arm inverted if only one, not the second.  This patch fixes that.

 With that in place, the bug in PR target/64358 is easily fixed.  Do
 that.  Also change the other 128-bit boolc splitter to have the same
 operand order as everything else.  And use BOOL_REGS_OP1 and _OP2 for
 operands 1 resp. 2 (not the other way around); this doesn't actually
 matter, but it was a bit confusing.

 This fixes builtin-arith-overflow-{10,11}.c as well.

 Bootstrapped (no fortran this time, it doesn't build right now) and
 tested on powerpc64-linux, -m32,-m32/-mpowerpc64,-m64,-m64/-mlra; no
 regressions (and the mentioned cases fixed).

 Okay for mainline?  Does this need backporting as well?


 Segher


 2014-12-20  Segher Boessenkool  seg...@kernel.crashing.org

 gcc/
 PR target/64358
 * config/rs6000/rs6000.c (rs6000_split_logical_inner): Swap the
 input operands if only the second is inverted.
 * config/rs6000/rs6000.md (*boolcmode3_internal1 for BOOL_128):
 Swap BOOL_REGS_OP1 and BOOL_REGS_OP2.  Correct arguments to
 rs6000_split_logical.
 (*boolcmode3_internal2 for TI2): Swap operands[1] and operands[2].

Okay.

Thanks, David


Re: [RFC, PATCH, Fortran] PR fortran/60289 Fixing character array allocation for class(*) type variable

2014-12-20 Thread Andre Vehreschild
Dear all,

please find attached a patch fixing the PR60289 with my recent patch on
PR60255. Please understand, that for this patch to work correctly you need to
have my previous patch from

https://gcc.gnu.org/ml/fortran/2014-12/msg00092.html

applied already to your gfortran sources.

I am still collecting comments on the 60255 patch and applying them. Therefore
both patches are on request for comment now. So feel free to comment.

Bootstrapping and regtesting is running currently.

- Andre

On Mon, 18 Aug 2014 10:36:44 +0200
Paul Richard Thomas paul.richard.tho...@gmail.com wrote:

 Dear All,
 
 There are known issues with unlimited polymorphic variables
 representing characters : see
 https://groups.google.com/forum/#!topic/comp.lang.fortran/aRz3HMpblTs
 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55901
 
 One way or another, the variable itself needs to carry the string
 length and the kind.  With fixed length and kind=1, the vtable 'size'
 does the job.
 
 Tobias has suggested more than once that we use the new array
 descriptor as the class container as well. We either do this or add
 fields to the class container.
 
 Cheers
 
 Paul
 
 On 17 August 2014 18:39, Dominique Dhumieres domi...@lps.ens.fr wrote:
  Here is a failing testcase.
 
  I was about to post the same test. The test fails with two counts:
  (1) len(P) == 80,
  (2) deallocate(P) fails with
 
  a.out(882,0x7fff75e1d310) malloc: *** error for object 0x7fc801c04978:
  incorrect checksum for freed object - object was probably modified after
  being freed. ...
 
  Dominique
 
 
 


-- 
Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen
Tel.: +49 241 9291018 * Email: ve...@gmx.de 
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 9d7d3c2..214b64d 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -6877,7 +6877,9 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
   goto failure;
 }
 
-  if (code-ext.alloc.ts.type == BT_CHARACTER  !e-ts.deferred)
+  /* Check F08:C632.  */
+  if (code-ext.alloc.ts.type == BT_CHARACTER  !e-ts.deferred
+   !UNLIMITED_POLY (e))
 {
   int cmp = gfc_dep_compare_expr (e-ts.u.cl-length,
   code-ext.alloc.ts.u.cl-length);
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 0db668d..1c2599c 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -5126,8 +5126,10 @@ gfc_trans_allocate (gfc_code * code)
 	  gfc_add_block_to_block (se.pre, se_sz.pre);
 	  se_sz.expr = gfc_evaluate_now (se_sz.expr, se.pre);
 	  gfc_add_block_to_block (se.pre, se_sz.post);
-	  /* Store the string length.  */
-	  tmp = al-expr-ts.u.cl-backend_decl;
+	  /* Store the string length.  Get the backend_decl of the _len
+		 component for that.  */
+	  tmp = gfc_class_len_get (gfc_get_symbol_decl (
+	 expr-symtree-n.sym));
 	  gfc_add_modify (se.pre, tmp, fold_convert (TREE_TYPE (tmp),
 			  se_sz.expr));
   tmp = TREE_TYPE (gfc_typenode_for_spec (code-ext.alloc.ts));
diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_21.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_21.f90
new file mode 100644
index 000..18a66b0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_21.f90
@@ -0,0 +1,57 @@
+! { dg-do run }
+! Testing fix for PR fortran/60289
+! Contributed by: Andre Vehreschild ve...@gmx.de
+!
+program test
+implicit none
+
+class(*), pointer :: P
+integer :: string_len = 10 *2
+
+allocate(character(string_len)::P)
+
+select type(P)
+type is (character(*))
+P =some test string
+if (P .ne. some test string) then
+call abort ()
+end if
+if (len(P) .ne. 20) then
+call abort ()
+end if
+if (len(P) .eq. len(some test string)) then
+call abort ()
+end if
+class default
+call abort ()
+end select
+
+deallocate(P)
+
+! Now for kind=4 chars.
+
+allocate(character(len=20,kind=4)::P)
+
+select type(P)
+type is (character(len=*,kind=4))
+P =some test string
+if (P .ne. 4_some test string) then
+call abort ()
+end if
+if (len(P) .ne. 20) then
+call abort ()
+end if
+if (len(P) .eq. len(some test string)) then
+call abort ()
+end if
+type is (character(len=*,kind=1))
+call abort ()
+class default
+call abort ()
+end select
+
+deallocate(P)
+
+
+end program test
+


Tests fixes and debug vector pendantic capacity management change

2014-12-20 Thread François Dumont

Hi

Following a discussion on Reflector that has been reported to me, 
people are complaining about management of the vector capacity in the 
pedantic debug mode. Even if it is not crystal clear in the Standard 
there seems to be a consensus that clear shouldn't impact it. So here is 
a simple patch to stop resetting _M_guaranteed_capacity in this method.


As I run all tests in debug mode I also fix another problem. In 
testsuite/23_containers/vector/bool/allocator/swap.cc == and != 
propagating_allocator operators must be within __gnu_test namespace in 
order to be considered thanks to ADL when in debug mode.


There are also 2 tests that XPASS:
XPASS: experimental/string_view/element_access/char/2.cc execution test
XPASS: experimental/string_view/element_access/wchar_t/2.cc execution test

Debug assertions has been commented about because not compatible 
with constexpr. Do we keep them this way ?


2014-12-20  François Dumont  fdum...@gcc.gnu.org

* include/debug/vector (std::__debug::vector::clear()): Do not reset
guaranteed capacity.
* testsuite/23_containers/vector/bool/allocator/swap.cc: Move
propagating_allocator equality and inequality operators to __gnu_test
namespace.

François

Index: include/debug/vector
===
--- include/debug/vector	(revision 218987)
+++ include/debug/vector	(working copy)
@@ -669,7 +669,6 @@
   {
 	_Base::clear();
 	this-_M_invalidate_all();
-	this-_M_guaranteed_capacity = 0;
   }
 
   _Base
Index: testsuite/23_containers/vector/bool/allocator/swap.cc
===
--- testsuite/23_containers/vector/bool/allocator/swap.cc	(revision 218987)
+++ testsuite/23_containers/vector/bool/allocator/swap.cc	(working copy)
@@ -23,9 +23,9 @@
 
 using T = bool;
 
-using __gnu_test::propagating_allocator;
-
-// It is undefined behaviour to swap() containers wth unequal allocators
+namespace __gnu_test
+{
+  // It is undefined behaviour to swap() containers with unequal allocators
 // if the allocator doesn't propagate, so ensure the allocators compare
 // equal, while still being able to test propagation via get_personality().
 bool
@@ -41,7 +41,10 @@
 {
   return false;
 }
+}
 
+using __gnu_test::propagating_allocator;
+
 void test01()
 {
   bool test __attribute__((unused)) = true;


Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'

2014-12-20 Thread Michael Eager

On 12/20/14 02:09, Chen Gang wrote:

By the way, if this thread really has negative effect with other members,
please warn me, I should not notify it to mailing list again, and try my
best to finish it within myself.


I appreciate your enthusiasm and perseverance in pursuing this bug.

If the problem you are working on has changed from the mb-gcc issue,
change the subject.  Otherwise, keep up the good work.

--
Michael Eagerea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


[patch, testsuite] Fix ubsan for testing when libstdc++ isn't installed

2014-12-20 Thread FX
This patch below allows ubsan to run when libstdc++ is built but not installed 
(something which happens on darwin, in particular). This fixes all 658 ubsan 
failures when run in this particular configuration.

OK to commit?
FX



2014-12-20  Francois-Xavier Coudert  fxcoud...@gcc.gnu.org

* lib/ubsan-dg.exp: Add library path for libstdc++.


Index: gcc/testsuite/lib/ubsan-dg.exp
===
--- gcc/testsuite/lib/ubsan-dg.exp  (revision 218989)
+++ gcc/testsuite/lib/ubsan-dg.exp  (working copy)
@@ -47,6 +47,7 @@ proc ubsan_link_flags { paths } {
  append flags  -B${gccpath}/libsanitizer/ubsan/ 
  append flags  -L${gccpath}/libsanitizer/ubsan/.libs
  append ld_library_path :${gccpath}/libsanitizer/ubsan/.libs
+ append ld_library_path :${gccpath}/libstdc++-v3/src/.libs
   }
 } else {
   global tool_root_dir



Re: Tests fixes and debug vector pendantic capacity management change

2014-12-20 Thread Jonathan Wakely

On 20/12/14 17:29 +0100, François Dumont wrote:

Hi

   Following a discussion on Reflector that has been reported to me, 
people are complaining about management of the vector capacity in the 
pedantic debug mode. Even if it is not crystal clear in the Standard 
there seems to be a consensus that clear shouldn't impact it. So here 
is a simple patch to stop resetting _M_guaranteed_capacity in this 
method.


   As I run all tests in debug mode I also fix another problem. In 
testsuite/23_containers/vector/bool/allocator/swap.cc == and != 
propagating_allocator operators must be within __gnu_test namespace in 
order to be considered thanks to ADL when in debug mode.


Thanks for fixing that.


   There are also 2 tests that XPASS:
XPASS: experimental/string_view/element_access/char/2.cc execution test
XPASS: experimental/string_view/element_access/wchar_t/2.cc execution test

   Debug assertions has been commented about because not compatible 
with constexpr. Do we keep them this way ?


Yes, otherwise they stop being constexpr.


Enhance print type in debug mode

2014-12-20 Thread François Dumont

Hi

I plan to work on new debug diagnostics for which I would like to 
display the type having a problem so this is a patch to add this kind of 
parameter.


Moreover I dealt with demangling to move from this kind of diagnostic:

/home/fdt/dev/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/debug/unordered_map:191:
error: attempt to access container with out-of-bounds bucket index 1,
container only holds 1 buckets.

Objects involved in the operation:
sequence this @ 0x0x7fff24fe33c0 {
  type = 
NSt7__debug13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKii;

}

to:

/home/fdt/dev/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/debug/unordered_map:191:
error: attempt to access container with out-of-bounds bucket index 1,
container only holds 1 buckets.

Objects involved in the operation:
sequence this @ 0x0x7fff1ee0ef00 {
  type = std::__debug::unordered_mapint, int, std::hashint, 
std::equal_toint, std::allocatorstd::pairint const, int  ;

}

I just want to make sure it is safe and especially portable to use 
__cxa_demangle and that it is ok to do this now.


2014-12-20  François Dumont  fdum...@gcc.gnu.org

* include/debug/formatter.h
(_Error_formatter::_Parameter::_M_kind): Add __type enum entry.
(_Error_formatter::_Parameter::_M_variant._M_type): New.
(_Error_formatter::_Parameter::_M_type()): New.
(_Error_formatter::_Parameter::_M_print_type): New.
* src/c++11/debug.cc
(_Error_formatter::_Parameter::_M_print_field): Use latter.
Use __cxaabiv1::__cxa_demangle to print demangled type name.

François



Re: Tests fixes and debug vector pendantic capacity management change

2014-12-20 Thread François Dumont

On 20/12/2014 19:09, Jonathan Wakely wrote:

   There are also 2 tests that XPASS:
XPASS: experimental/string_view/element_access/char/2.cc execution test
XPASS: experimental/string_view/element_access/wchar_t/2.cc execution 
test


   Debug assertions has been commented about because not compatible 
with constexpr. Do we keep them this way ?


Yes, otherwise they stop being constexpr.



I was more wondering if it fine to keep tests reporting a XPASS status 
cause they are displayed as the FAIL ones. But I think that XPASS is 
indeed a good status for a temporary issue.


Patch committed.

François



Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'

2014-12-20 Thread Chen Gang
On 12/21/2014 12:31 AM, Michael Eager wrote:
 On 12/20/14 02:09, Chen Gang wrote:
 By the way, if this thread really has negative effect with other members,
 please warn me, I should not notify it to mailing list again, and try my
 best to finish it within myself.
 
 I appreciate your enthusiasm and perseverance in pursuing this bug.
 
 If the problem you are working on has changed from the mb-gcc issue,
 change the subject.  Otherwise, keep up the good work.
 

Thank you for your encouragement, and I should continue. At present, I
guess my own main issues are:

 - Have no enough time resources on open source:

 sometimes need work overtime.

 need 4 hours per work day on subway between home and work office
 (come 2 hours, go 2 hours, so total is 4 hours).

 need spend time for my child: check his homework, play with him.
 (especially in weekend).

 - Really not familiar with gcc:

 Sometimes can find real world issues, but can not fix them in time.

 Sometimes can find coding issues, but do not know whether it can
 cause real world issues or not (may also waste other members time
 resources, but get no positive result).

 - Not familiar with related environments for each architectures.

So next, I should change myself for solving the issues above, firstly:

 - I shall try to spend 1-1.5 hours for reading gcc related documents (
   e.g. gcc info) in work day when I on subway (another time on subway
   is for listening Holy Bible, reading news, or sleeping for a while).

 - I shall mainly forcus on finding real world issues and try to fix in
   time. And stop finding coding issues (which may get negative effect
   with others -- at least may waste other members time resources).

 - Still contiue for constructing all related enviroments (it is always
   necessary) for architectures.

Welcome any ideas, suggestions or completions by any members.

Thanks.
-- 
Chen Gang

Open share and attitude like air water and life which God blessed


Re: [PATCH 3/4] Add Visium support to gcc

2014-12-20 Thread Eric Botcazou
 First, bootstrap a native compiler from current trunk.  Then, use that
 native compiler to build the cross compiler configured with
 --enable-werror-always.  (--enable-werror-always is only expected to work
 when GCC is being built with the same version of GCC, as the compiler may
 not be -Werror-clean when built with other versions.)  Do this for both
 32-bit and 64-bit hosts.

Done, no changes required.

-- 
Eric Botcazou


Re: [PATCH v3] Use strtoll instead of atoll in gcov-tool.c

2014-12-20 Thread John David Anglin

Ping.

On 24-Nov-14, at 7:38 PM, John David Anglin wrote:


On 15-Sep-14, at 5:40 AM, Richard Biener wrote:


Let's wait for other opinions.


We now have implementations of strtol and strtoll in libiberty.  So,  
it's better to use
these than atoll.  As suggested by Jakub, the patch now falls back  
to int64_t if the

host doesn't have long long.

Tested on hppa2.0w-hpux11.11 and hppa64-hp-hpux11.11.

Okay for trunk?

Dave
--
John David Anglin   dave.ang...@bell.net


gcov-tool.c.d.3



Dave
--
John David Anglin   dave.ang...@bell.net





checksum test for fixincluding

2014-12-20 Thread Bruce Korb

Someone suggested this and it seemed like a reasonable thing to verify
(pretty much) that only a specific version of a file should be fixed.
I used the BSD check sum, so there is a 1/65000 chance of a false positive.
Incorporating md5sum seemed over the top.
Index: fixincludes/ChangeLog
===
--- fixincludes/ChangeLog	(revision 218991)
+++ fixincludes/ChangeLog	(working copy)
@@ -1,9 +1,20 @@
+2013-12-07  Bruce Korb  bk...@gnu.org
+
+	* fixincludes/fixincl.tpl: add handling for sum selection
+	criteria and clean up layout
+	* fixincludes/fixlib.h: enumerate TT_CKSUM test type
+	* fixincludes/fixincl.c (fix_applies): add code to handle
+	the new test type
+	(cksum_test): function to handle it
+	* fixincludes/README: doc it and remove explanations from
+	more than a decade ago.
+
 2014-12-15  Uros Bizjak  ubiz...@gmail.com
 
 	* server.c (server_setup): Check return value of
 	getcwd and in case of error set buff[0] to 0.
 
 2014-10-21  Uros Bizjak  ubiz...@gmail.com
 
 	* inclhack.def (glibc_c99_inline_4): Add pthread.h to files.
 	* fixincl.x: Regenerate.
Index: fixincludes/README
===
--- fixincludes/README	(revision 218991)
+++ fixincludes/README	(working copy)
@@ -1,30 +1,10 @@
 
-FIXINCLUDES OPERATION
-=
-
-See also:  http://autogen.SourceForge.net/fixinc.html
-
-The set of fixes required was distilled down to just the data required
-to specify what needed to happen for each fix.  Those data were edited
-into a file named fixincludes/inclhack.def.  A program called AutoGen
-(http://autogen.SourceForge.net) uses these definitions to instantiate
-several different templates that then produces code for a fixinclude
-program (fixincl.x) and a shell script to test its functioning.  On
-certain platforms (viz. those that do not have functional bidirectional
-pipes), the fixincl program is split into two.  This should only concern
-you on DOS and BeOS.
-
-Regards,
-	Bruce bk...@gnu.org
-
-
-
 GCC MAINTAINER INFORMATION
 ==
 
 If you are having some problem with a system header that is either
 broken by the manufacturer, or is broken by the fixinclude process,
 then you will need to alter or add information to the include fix
 definitions file, ``inclhack.def''.  Please also send relevant
 information to gcc-b...@gcc.gnu.org, gcc-patches@gcc.gnu.org and,
 please, to me:  bk...@gnu.org.
@@ -76,27 +56,33 @@
 identify the files with files =  entries.  If you use fnmatch(3C)
 wild card characters in a files entry, be certain that the first
 files entry has no such character.  Otherwise, the make check
 machinery will attempt to create files with those characters in the
 name.  That is inconvenient.
 
 3.  It is relatively expensive to fire off a process to fix a source
 file, therefore write apply tests to avoid unnecessary fix
 processes.  The preferred apply tests are select, bypass, mach
-and c-test because they are performed internally:
+sum, and c-test because they are performed internally:
 
 * select - Run a regex on the contents of the file being considered.
All such regex-es must match.  Matching is done with
extended regular expressions.
 
 * bypass - Run a regex on the contents of the file being considered.
No such regex may match.
 
+* sum- Select a specific version of a file that has a matching
+   check sum.  The BSD version of checksum [sum(1BSD)]
+   is used.  Each sum entry should contain exactly three
+   space separated tokens:  the sum, some number and the
+   basename of the file.  The some number is ignored.
+
 * c_test - call a function in fixtests.c.  See that file.
 
 * files  - the fnmatch pattern of the file(s) to examine for
the issue.  There may be several copies of this attribute.
If the header lives in a /usr/include subdirectory, be
sure to include that subdirectory in the name. e.g. net/if.h
 
 * mach   - Match the output of config.guess against a series of fnmatch
patterns.  It must match at least one of the patterns, unless
Index: fixincludes/fixincl.c
===
--- fixincludes/fixincl.c	(revision 218991)
+++ fixincludes/fixincl.c	(working copy)
@@ -591,18 +591,71 @@
   if (p_test-p_test_regex == 0)
 fprintf (stderr, fixincl ERROR RE not compiled:  `%s'\n,
  p_test-pz_test_text);
 #endif
   if (xregexec (p_test-p_test_regex, pz_data, 0, 0, 0) == 0)
 return APPLY_FIX;
   return SKIP_FIX;
 }
 
+/* * * * * * * * * * * * *
+
+  cksum_test   check the sum of the candidate file
+  Input:  the original file contents and the file name
+  Result: APPLY_FIX if the check sum matches, SKIP_FIX otherwise
+
+  The caller may 

C++ PATCH for c++/64359 (alias_template_specialization_p high in profile)

2014-12-20 Thread Jason Merrill
Markus pointed out that my patch for DR 1558 slowed down the compiler 
significantly for building Chrome: comparing entries in the template 
specialization hash table had to spend a lot of time figuring out if 
types were specializations of alias templates with dependent template 
arguments in order to avoid comparing them by TYPE_CANONICAL.


This patch addresses this in multiple ways:

1) Instead of looking deep into the type to see if it's a dependent 
alias, we just check for it being any kind of alias; strip_typedefs 
strips any aliases in non-dependent template argument lists, so we're 
safe just treating any aliases that make it to template_args_equal as 
different.


2) I optimized alias_template_specialization_p a bit to check for the 
alias bit before looking up the template info.  This is less interesting 
given #1, but I did it first and figured we might as well keep it.


3) I adjusted iterative_hash_template_arg to hash aliases differently to 
reduce the number of collisions that result in calls to template_args_equal.


And while I was in the area, I also fixed dependent_alias_spec_p to only 
look at the innermost template arguments.


alias_template_specialization_p is now down to 0.34% of perf time on the 
testcase.  template_args_equal is still at the top, but with a much 
smaller lead than before.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 99d81c4c903fb91fd017edbedfc4b4998934fc54
Author: Jason Merrill ja...@redhat.com
Date:   Fri Dec 19 12:11:01 2014 -0500

	PR c++/64359
	* pt.c (iterative_hash_template_arg): Hash alias specializations
	differently from their TYPE_CANONICAL.
	(alias_template_specialization_p): Optimize.
	(template_args_equal): Optimize alias handling.
	(dependent_alias_template_spec_p): Only check innermost args.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 15d304a..f5bd842 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1674,6 +1674,18 @@ iterative_hash_template_arg (tree arg, hashval_t val)
   switch (tclass)
 {
 case tcc_type:
+  if (alias_template_specialization_p (arg))
+	{
+	  // We want an alias specialization that survived strip_typedefs
+	  // to hash differently from its TYPE_CANONICAL, to avoid hash
+	  // collisions that compare as different in template_args_equal.
+	  // These could be dependent specializations that strip_typedefs
+	  // left alone, or untouched specializations because
+	  // coerce_template_parms returns the unconverted template
+	  // arguments if it sees incomplete argument packs.
+	  tree ti = TYPE_TEMPLATE_INFO (arg);
+	  return hash_tmpl_and_args (TI_TEMPLATE (ti), TI_ARGS (ti));
+	}
   if (TYPE_CANONICAL (arg))
 	return iterative_hash_object (TYPE_HASH (TYPE_CANONICAL (arg)),
   val);
@@ -5314,13 +5326,19 @@ alias_type_or_template_p (tree t)
 bool
 alias_template_specialization_p (const_tree t)
 {
-  if (t == NULL_TREE)
-return false;
-  
-  return (TYPE_P (t)
-	   TYPE_TEMPLATE_INFO (t)
-	   PRIMARY_TEMPLATE_P (TYPE_TI_TEMPLATE (t))
-	   DECL_ALIAS_TEMPLATE_P (TYPE_TI_TEMPLATE (t)));
+  /* It's an alias template specialization if it's an alias and its
+ TYPE_NAME is a specialization of a primary template.  */
+  if (TYPE_ALIAS_P (t))
+{
+  tree name = TYPE_NAME (t);
+  if (DECL_LANG_SPECIFIC (name))
+	if (tree ti = DECL_TEMPLATE_INFO (name))
+	  {
+	tree tmpl = TI_TEMPLATE (ti);
+	return PRIMARY_TEMPLATE_P (tmpl);
+	  }
+}
+  return false;
 }
 
 /* Return TRUE iff T is a specialization of an alias template with
@@ -5330,7 +5348,8 @@ bool
 dependent_alias_template_spec_p (const_tree t)
 {
   return (alias_template_specialization_p (t)
-	   any_dependent_template_arguments_p (TYPE_TI_ARGS (t)));
+	   (any_dependent_template_arguments_p
+	  (INNERMOST_TEMPLATE_ARGS (TYPE_TI_ARGS (t);
 }
 
 /* Return the number of innermost template parameters in TMPL.  */
@@ -7283,16 +7302,12 @@ template_args_equal (tree ot, tree nt)
 	return false;
   /* Don't treat an alias template specialization with dependent
 	 arguments as equivalent to its underlying type when used as a
-	 template argument; we need them to hash differently.  */
-  bool ndep = dependent_alias_template_spec_p (nt);
-  ++processing_template_decl;
-  bool odep = dependent_alias_template_spec_p (ot);
-  --processing_template_decl;
-  if (ndep != odep)
+	 template argument; we need them to be distinct so that we
+	 substitute into the specialization arguments at instantiation
+	 time.  And aliases can't be equivalent without being ==, so
+	 we don't need to look any deeper.  */
+  if (TYPE_ALIAS_P (nt) || TYPE_ALIAS_P (ot))
 	return false;
-  else if (ndep)
-	return (TYPE_TI_TEMPLATE (nt) == TYPE_TI_TEMPLATE (ot)
-		 template_args_equal (TYPE_TI_ARGS (nt), TYPE_TI_ARGS (ot)));
   else
 	return same_type_p (ot, nt);
 }