[gcc-6] 214/401: * Update to SVN 20160922 (r240342, 6.2.1) from the gcc-6-branch.

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:49:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch pu/reproducible_builds
in repository gcc-6.

commit 722ee8a7e14f6d2972cbe06d3cedba04feab1fa5
Author: doko <doko at 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>
Date:   Thu Sep 22 08:41:49 2016 +0000

      * Update to SVN 20160922 (r240342, 6.2.1) from the gcc-6-branch.
    
    
    git-svn-id: svn://anonscm.debian.org/gcccvs/branches/sid/gcc-6@8983 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
---
 debian/changelog                |   12 +-
 debian/patches/svn-updates.diff | 1264 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 1259 insertions(+), 17 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a971ce9..a139c5a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+gcc-6 (6.2.0-5) UNRELEASED; urgency=medium
+
+  * Update to SVN 20160922 (r240342, 6.2.1) from the gcc-6-branch.
+    - Fix PR sanitizer/77396, PR libstdc++/77645, PR libstdc++/77645,
+      PR target/77326 (AVR), PR target/77349 (PPC), PR middle-end/77594,
+      PR sanitizer/68260, PR fortran/77516, PR target/69255 (x86),
+      PR c++/77553, PR c++/77539, PR fortran/77500.
+
+ -- Matthias Klose <doko at debian.org>  Thu, 22 Sep 2016 10:21:49 +0200
+
 gcc-6 (6.2.0-4) unstable; urgency=medium
 
   * Update to SVN 20160914 (r240133, 6.2.1) from the gcc-6-branch.
@@ -9,7 +19,7 @@ gcc-6 (6.2.0-4) unstable; urgency=medium
     - Always check for PaX MPROTECT on linux, make EMUTRAMP experimental.
     - dlmmap_locked always needs locking as it always modifies execsize.
 
- -- Matthias Klose <doko at debian.org>  Thu, 15 Sep 2016 11:52:35 +0200
+ -- Matthias Klose <doko at debian.org>  Thu, 15 Sep 2016 19:22:35 +0200
 
 gcc-6 (6.2.0-3) unstable; urgency=medium
 
diff --git a/debian/patches/svn-updates.diff b/debian/patches/svn-updates.diff
index 623fbae..32ba079 100644
--- a/debian/patches/svn-updates.diff
+++ b/debian/patches/svn-updates.diff
@@ -1,10 +1,10 @@
-# DP: updates from the 6 branch upto 20160914 (r240133).
+# DP: updates from the 6 branch upto 20160922 (r240342).
 
 last_update()
 {
 	cat > ${dir}LAST_UPDATED <EOF
-Wed Sep 14 12:57:51 CEST 2016
-Wed Sep 14 10:57:51 UTC 2016 (revision 240133)
+Thu Sep 22 10:23:00 CEST 2016
+Thu Sep 22 08:23:00 UTC 2016 (revision 240342)
 EOF
 }
 
@@ -53,6 +53,119 @@ Index: libgomp/testsuite/libgomp.fortran/pr71014.f90
 +  end do
 +  if (any(s /= t)) call abort
 +end program pr71014
+Index: libsanitizer/asan/asan_globals.cc
+===================================================================
+--- a/src/libsanitizer/asan/asan_globals.cc	(.../tags/gcc_6_2_0_release)
++++ b/src/libsanitizer/asan/asan_globals.cc	(.../branches/gcc-6-branch)
+@@ -248,10 +248,10 @@
+ // initializer can only touch global variables in the same TU.
+ void __asan_before_dynamic_init(const char *module_name) {
+   if (!flags()->check_initialization_order ||
+-      !CanPoisonMemory())
++      !CanPoisonMemory() ||
++      !dynamic_init_globals)
+     return;
+   bool strict_init_order = flags()->strict_init_order;
+-  CHECK(dynamic_init_globals);
+   CHECK(module_name);
+   CHECK(asan_inited);
+   BlockingMutexLock lock(&mu_for_globals);
+@@ -274,7 +274,8 @@
+ // TU are poisoned.  It simply unpoisons all dynamically initialized globals.
+ void __asan_after_dynamic_init() {
+   if (!flags()->check_initialization_order ||
+-      !CanPoisonMemory())
++      !CanPoisonMemory() ||
++      !dynamic_init_globals)
+     return;
+   CHECK(asan_inited);
+   BlockingMutexLock lock(&mu_for_globals);
+Index: libsanitizer/ChangeLog
+===================================================================
+--- a/src/libsanitizer/ChangeLog	(.../tags/gcc_6_2_0_release)
++++ b/src/libsanitizer/ChangeLog	(.../branches/gcc-6-branch)
+@@ -1,3 +1,11 @@
++2016-09-16  Jakub Jelinek  <jakub at redhat.com>
++
++	Backported from mainline
++	2016-09-05  Jakub Jelinek  <jakub at redhat.com>
++
++	PR sanitizer/77396
++	* asan/asan_globals.cc: Cherry-pick upstream r280657.
++
+ 2016-08-22  Release Manager
+ 
+ 	* GCC 6.2.0 released.
+Index: libstdc++-v3/python/libstdcxx/v6/xmethods.py
+===================================================================
+--- a/src/libstdc++-v3/python/libstdcxx/v6/xmethods.py	(.../tags/gcc_6_2_0_release)
++++ b/src/libstdc++-v3/python/libstdcxx/v6/xmethods.py	(.../branches/gcc-6-branch)
+@@ -165,7 +165,7 @@
+ class DequeWorkerBase(gdb.xmethod.XMethodWorker):
+     def __init__(self, val_type):
+         self._val_type = val_type
+-        self._bufsize = (512 / val_type.sizeof) or 1
++        self._bufsize = 512 // val_type.sizeof or 1
+ 
+     def size(self, obj):
+         first_node = obj['_M_impl']['_M_start']['_M_node']
+@@ -174,10 +174,10 @@
+         first = obj['_M_impl']['_M_finish']['_M_first']
+         return (last_node - first_node) * self._bufsize + (cur - first)
+ 
+-    def index(self, obj, index):
++    def index(self, obj, idx):
+         first_node = obj['_M_impl']['_M_start']['_M_node']
+-        index_node = first_node + index / self._bufsize
+-        return index_node[0][index % self._bufsize]
++        index_node = first_node + int(idx) // self._bufsize
++        return index_node[0][idx % self._bufsize]
+ 
+ class DequeEmptyWorker(DequeWorkerBase):
+     def get_arg_types(self):
+@@ -328,6 +328,15 @@
+     def get_arg_types(self):
+         return None
+ 
++    def get_value_from_node(self, node):
++        node = node.dereference()
++        if node.type.fields()[1].name == '_M_data':
++            # C++03 implementation, node contains the value as a member
++            return node['_M_data']
++        # C++11 implementation, node stores value in __aligned_membuf
++        addr = node['_M_storage'].address
++        return addr.cast(self._val_type.pointer()).dereference()
++
+ class ListEmptyWorker(ListWorkerBase):
+     def get_result_type(self, obj):
+         return get_bool_type()
+@@ -358,7 +367,7 @@
+ 
+     def __call__(self, obj):
+         node = obj['_M_impl']['_M_node']['_M_next'].cast(self._node_type)
+-        return node['_M_data']
++        return self.get_value_from_node(node)
+ 
+ class ListBackWorker(ListWorkerBase):
+     def get_result_type(self, obj):
+@@ -366,7 +375,7 @@
+ 
+     def __call__(self, obj):
+         prev_node = obj['_M_impl']['_M_node']['_M_prev'].cast(self._node_type)
+-        return prev_node['_M_data']
++        return self.get_value_from_node(prev_node)
+ 
+ class ListMethodsMatcher(gdb.xmethod.XMethodMatcher):
+     def __init__(self):
+@@ -410,7 +419,7 @@
+         if self._val_type.code == gdb.TYPE_CODE_BOOL:
+             start = obj['_M_impl']['_M_start']['_M_p']
+             bit_size = start.dereference().type.sizeof * 8
+-            valp = start + index / bit_size
++            valp = start + index // bit_size
+             offset = index % bit_size
+             return (valp.dereference() & (1 << offset)) > 0
+         else:
 Index: libstdc++-v3/scripts/testsuite_flags.in
 ===================================================================
 --- a/src/libstdc++-v3/scripts/testsuite_flags.in	(.../tags/gcc_6_2_0_release)
@@ -346,7 +459,25 @@ Index: libstdc++-v3/ChangeLog
 ===================================================================
 --- a/src/libstdc++-v3/ChangeLog	(.../tags/gcc_6_2_0_release)
 +++ b/src/libstdc++-v3/ChangeLog	(.../branches/gcc-6-branch)
-@@ -1,3 +1,47 @@
+@@ -1,3 +1,65 @@
++2016-09-20  Jonathan Wakely  <jwakely at redhat.com>
++
++	* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__)
++	(DequeWorkerBase.index, VectorWorkerBase.get): Use // for division.
++
++2016-09-19  Jonathan Wakely  <jwakely at redhat.com>
++
++	PR libstdc++/77645
++	* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__)
++	(DequeWorkerBase.index, VectorWorkerBase.get): Cast results of
++	division to int to work with Python 3.
++
++	PR libstdc++/77645
++	* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index): Rename
++	argument.
++	(ListWorkerBase.get_value_from_node): Define new method.
++	(ListFrontWorker.__call__, ListBackWorker.__call__): Use it.
++
 +2016-08-31  Ville Voutilainen  <ville.voutilainen at gmail.com>
 +
 +	PR libstdc++/77395
@@ -796,7 +927,23 @@ Index: gcc/DATESTAMP
 +++ b/src/gcc/DATESTAMP	(.../branches/gcc-6-branch)
 @@ -1 +1 @@
 -20160822
-+20160914
++20160922
+Index: gcc/internal-fn.c
+===================================================================
+--- a/src/gcc/internal-fn.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/internal-fn.c	(.../branches/gcc-6-branch)
+@@ -1789,7 +1789,10 @@
+ 	    {
+ 	    case MINUS_EXPR:
+ 	      if (integer_zerop (arg0) && !unsr_p)
+-		expand_neg_overflow (loc, lhs, arg1, false);
++		{
++		  expand_neg_overflow (loc, lhs, arg1, false);
++		  return;
++		}
+ 	      /* FALLTHRU */
+ 	    case PLUS_EXPR:
+ 	      expand_addsub_overflow (loc, code, lhs, arg0, arg1,
 Index: gcc/fold-const.c
 ===================================================================
 --- a/src/gcc/fold-const.c	(.../tags/gcc_6_2_0_release)
@@ -826,11 +973,93 @@ Index: gcc/fold-const.c
  	}
        unsigned count = VECTOR_CST_NELTS (op0);
        tree *elts =  XALLOCAVEC (tree, count);
+Index: gcc/omp-low.c
+===================================================================
+--- a/src/gcc/omp-low.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/omp-low.c	(.../branches/gcc-6-branch)
+@@ -4300,7 +4300,9 @@
+ 	{
+ 	  tree c = find_omp_clause (gimple_omp_for_clauses (ctx->stmt),
+ 				    OMP_CLAUSE_SAFELEN);
+-	  if (c && TREE_CODE (OMP_CLAUSE_SAFELEN_EXPR (c)) != INTEGER_CST)
++	  if (c
++	      && (TREE_CODE (OMP_CLAUSE_SAFELEN_EXPR (c)) != INTEGER_CST
++		  || tree_int_cst_sgn (OMP_CLAUSE_SAFELEN_EXPR (c)) != 1))
+ 	    max_vf = 1;
+ 	  else if (c && compare_tree_int (OMP_CLAUSE_SAFELEN_EXPR (c),
+ 					  max_vf) == -1)
 Index: gcc/ChangeLog
 ===================================================================
 --- a/src/gcc/ChangeLog	(.../tags/gcc_6_2_0_release)
 +++ b/src/gcc/ChangeLog	(.../branches/gcc-6-branch)
-@@ -1,3 +1,235 @@
+@@ -1,3 +1,303 @@
++2016-09-21  Segher Boessenkool  <segher at kernel.crashing.org>
++
++	* doc/rtl.texi (JUMP_LABEL): Document RETURN and SIMPLE_RETURN values.
++
++2016-09-21  Georg-Johann Lay  <avr at gjlay.de>
++
++	Backport from 2016-09-21 trunk r240306.
++
++	PR target/77326
++	* config/avr/avr.c (avr_notice_update_cc) [CC_NONE]: If insn
++	touches some regs mentioned in cc_status, do CC_STATUS_INIT.
++
++2016-09-20  Thomas Preud'homme  <thomas.preudhomme at arm.com>
++
++	Backport from mainline
++	2016-07-14  Thomas Preud'homme  <thomas.preudhomme at arm.com>
++
++	* lra-constraints.c (match_reload): Pass information about other
++	output operands.  Create new unique register value if matching input
++	operand shares same register value as output operand being considered.
++	(curr_insn_transform): Record output operands already processed.
++
++2016-09-16  Jonathan Wakely  <jwakely at redhat.com>
++
++	* doc/extend.texi (Integer Overflow Builtins): Fix type of out
++	parameters for functions taking long long arguments.
++
++2016-09-16  David Edelsohn  <dje.gcc at gmail.com>
++
++	Backported from mainline
++	2016-08-26  David Edelsohn  <dje.gcc at gmail.com>
++
++	PR target/77349
++	* config/rs6000/xcoff.h (DWARF_OFFSET_SIZE): Define as PTR_SIZE.
++
++2016-09-16  Jakub Jelinek  <jakub at redhat.com>
++	    Eric Botcazou  <ebotcazou at adacore.com>
++
++	PR middle-end/77594
++	* internal-fn.c (expand_arith_overflow) <case MINUS_EXPR>: Don't fall
++	through into expand_addsub_overflow after expand_neg_overflow.
++
++2016-09-16  Jakub Jelinek  <jakub at redhat.com>
++
++	Backported from mainline
++	2016-09-14  Jakub Jelinek  <jakub at redhat.com>
++
++	PR sanitizer/68260
++	* tsan.c: Include target.h.
++	(enum tsan_atomic_action): Add bool_clear and bool_test_and_set.
++	(BOOL_CLEAR, BOOL_TEST_AND_SET): Define.
++	(tsan_atomic_table): Add BUILT_IN_ATOMIC_CLEAR and
++	BUILT_IN_ATOMIC_TEST_AND_SET entries.
++	(instrument_builtin_call): Handle bool_clear and bool_test_and_set.
++
++	2016-09-08  Jakub Jelinek  <jakub at redhat.com>
++
++	PR fortran/77516
++	* omp-low.c (lower_rec_simd_input_clauses): Use max_vf for non-positive
++	OMP_CLAUSE_SAFELEN_EXPR.
++
++	2016-09-06  Jakub Jelinek  <jakub at redhat.com>
++
++	PR target/69255
++	* config/i386/i386.c (ix86_expand_builtin): For builtin with
++	unsupported or unknown ISA, use expand_call.
++
 +2016-09-06  Uros Bizjak  <ubizjak at gmail.com>
 +
 +	Backport from mainline
@@ -1063,10 +1292,11 @@ Index: gcc/ChangeLog
 +	PR middle-end/71700
 +	* expr.c (store_constructor): Mask sign-extended bits when widening
 +	sub-word constructor element at the start of a word.
++
  2016-08-22  Release Manager
  
  	* GCC 6.2.0 released.
-@@ -205,9 +442,9 @@
+@@ -205,9 +509,9 @@
  
  2016-08-09  Martin Jambor  <mjambor at suse.cz>
  
@@ -1111,6 +1341,37 @@ Index: gcc/testsuite/gcc.target/powerpc/pr72863.c
 +    d8 += 16;
 +  }
 +}
+Index: gcc/testsuite/gcc.target/avr/torture/pr77326.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/avr/torture/pr77326.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/avr/torture/pr77326.c	(.../branches/gcc-6-branch)
+@@ -0,0 +1,26 @@
++/* { dg-do run } */
++/* { dg-options "-Wl,--defsym,test1=0" } */
++
++extern void test1 (void) __attribute__((weak));
++
++__attribute__((noinline,noclone))
++static void va_pseudo (int flag, ...)
++{
++  __asm ("nop":);
++}
++
++__attribute__((noinline,noclone))
++static void func (void)
++{
++  va_pseudo (0, 0, 0, 0);
++
++  if (test1)
++    __builtin_abort ();
++}
++
++int main (void)
++{
++  func();
++  __builtin_exit (0);
++  return 0;
++}
 Index: gcc/testsuite/gcc.target/i386/pr71077.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.target/i386/pr71077.c	(.../tags/gcc_6_2_0_release)
@@ -1186,6 +1447,28 @@ Index: gcc/testsuite/gcc.target/i386/pr72867.c
 +  if (!__builtin_isnan (x[0]))
 +    abort ();
 +}
+Index: gcc/testsuite/gcc.target/i386/pr69255-1.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/pr69255-1.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/pr69255-1.c	(.../branches/gcc-6-branch)
+@@ -0,0 +1,17 @@
++/* PR target/69255 */
++/* { dg-do compile } */
++/* { dg-options "-msse4 -mno-avx" } */
++
++#pragma GCC target "avx512vl"
++#pragma GCC target "no-avx512vl"
++__attribute__ ((__vector_size__ (32))) long long a;
++__attribute__ ((__vector_size__ (16))) int b;
++
++void
++foo (const long long *p)
++{
++  a = __builtin_ia32_gather3siv4di (a, p, b, 1, 1);	/* { dg-error "needs isa option -m32 -mavx512vl" } */
++}
++
++/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */
++/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */
 Index: gcc/testsuite/gcc.target/i386/pr77452.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.target/i386/pr77452.c	(.../tags/gcc_6_2_0_release)
@@ -1204,6 +1487,50 @@ Index: gcc/testsuite/gcc.target/i386/pr77452.c
 +            >> ((-~((V)(U){1, 1, v[0]})[0]) & 0xf);
 +  return v;
 +}
+Index: gcc/testsuite/gcc.target/i386/pr69255-2.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/pr69255-2.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/pr69255-2.c	(.../branches/gcc-6-branch)
+@@ -0,0 +1,17 @@
++/* PR target/69255 */
++/* { dg-do compile } */
++/* { dg-options "-msse4 -mno-avx" } */
++
++#pragma GCC target "avx512vl"
++#pragma GCC target ""
++__attribute__ ((__vector_size__ (32))) long long a;
++__attribute__ ((__vector_size__ (16))) int b;
++
++void
++foo (const long long *p)
++{
++  __builtin_ia32_gather3siv4di (a, p, b, 1, 1);		/* { dg-error "needs isa option -m32 -mavx512vl" } */
++}
++
++/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */
++/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */
+Index: gcc/testsuite/gcc.target/i386/pr69255-3.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/pr69255-3.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/pr69255-3.c	(.../branches/gcc-6-branch)
+@@ -0,0 +1,17 @@
++/* PR target/69255 */
++/* { dg-do compile } */
++/* { dg-options "-msse4 -mno-avx" } */
++
++#pragma GCC target "avx512vl"
++#pragma GCC target ""
++__attribute__ ((__vector_size__ (32))) long long a;
++__attribute__ ((__vector_size__ (16))) int b;
++
++void
++foo (const long long *p, __attribute__ ((__vector_size__ (32))) long long *q)
++{
++  *q = __builtin_ia32_gather3siv4di (a, p, b, 1, 1);	/* { dg-error "needs isa option -m32 -mavx512vl" } */
++}
++
++/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */
++/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */
 Index: gcc/testsuite/gcc.target/i386/pr77403.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.target/i386/pr77403.c	(.../tags/gcc_6_2_0_release)
@@ -1224,6 +1551,22 @@ Index: gcc/testsuite/gcc.target/i386/pr77403.c
 +{
 +  v ^= (V){1};
 +}
+Index: gcc/testsuite/gcc.target/i386/pr77594.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/pr77594.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/pr77594.c	(.../branches/gcc-6-branch)
+@@ -0,0 +1,11 @@
++/* PR middle-end/77594 */
++/* { dg-do compile } */
++/* { dg-options "-O0" } */
++
++int
++foo (int a, int *b)
++{
++  return __builtin_sub_overflow (0, a, b);
++}
++
++/* { dg-final { scan-assembler-times "\tjn?o\t" 1 } } */
 Index: gcc/testsuite/gcc.target/i386/pr77377.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.target/i386/pr77377.c	(.../tags/gcc_6_2_0_release)
@@ -1279,6 +1622,23 @@ Index: gcc/testsuite/gfortran.dg/gomp/pr72744.f90
 +  x(:) = x(n:1:-1)
 +!$omp end parallel
 +end
+Index: gcc/testsuite/gfortran.dg/gomp/pr77516.f90
+===================================================================
+--- a/src/gcc/testsuite/gfortran.dg/gomp/pr77516.f90	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/gfortran.dg/gomp/pr77516.f90	(.../branches/gcc-6-branch)
+@@ -0,0 +1,12 @@
++! PR fortran/77516
++! { dg-do compile }
++
++program pr77516
++   integer :: i, x
++   x = 0
++!$omp simd safelen(0) reduction(+:x)
++   do i = 1, 8
++      x = x + 1
++   end do
++   print *, x
++end
 Index: gcc/testsuite/gfortran.dg/gomp/pr77374.f08
 ===================================================================
 --- a/src/gcc/testsuite/gfortran.dg/gomp/pr77374.f08	(.../tags/gcc_6_2_0_release)
@@ -1305,6 +1665,20 @@ Index: gcc/testsuite/gfortran.dg/gomp/pr77374.f08
 +!$omp atomic
 +  baz (i) = 1		! { dg-error "unexpected" }
 +end subroutine
+Index: gcc/testsuite/gfortran.dg/gomp/pr77500.f90
+===================================================================
+--- a/src/gcc/testsuite/gfortran.dg/gomp/pr77500.f90	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/gfortran.dg/gomp/pr77500.f90	(.../branches/gcc-6-branch)
+@@ -0,0 +1,9 @@
++! PR fortran/77500
++! { dg-do compile }
++
++program pr77500
++   real :: x
++!$omp atomic write
++   x = f()
++!$omp end atomic
++end
 Index: gcc/testsuite/gfortran.dg/gomp/pr69281.f90
 ===================================================================
 --- a/src/gcc/testsuite/gfortran.dg/gomp/pr69281.f90	(.../tags/gcc_6_2_0_release)
@@ -1460,6 +1834,35 @@ Index: gcc/testsuite/gcc.c-torture/execute/pr71700.c
 +    __builtin_abort ();
 +  return 0;
 +}
+Index: gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x
+===================================================================
+--- a/src/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x	(.../branches/gcc-6-branch)
+@@ -19,7 +19,6 @@
+ 	    regsub dump1/ $dump1 dump2/ dump2
+ 	    set dumptail "gcc.c-torture/unsorted/[file tail $dump1]"
+ 	    regsub {\.\d+((t|r|i)\.[^.]+)$} $dumptail {.*\1} dumptail
+-	    #puts "$option $dump1"
+ 	    set tmp [ diff "$dump1" "$dump2" ]
+ 	    if { $tmp == 0 } {
+ 		untested "$dumptail, $option comparison"
+@@ -28,7 +27,6 @@
+ 	    } else {
+ 		fail "$dumptail, $option comparison"
+ 	    }
+-	    #exec diff $dump1 $dump2
+ 	}
+     }
+     file delete -force dump1
+@@ -35,7 +33,5 @@
+     file delete -force dump2
+ }
+ 
+-catch {dump_compare $src $options} result
+-puts $result
+-verbose result
++dump_compare $src $options
+ return 1
 Index: gcc/testsuite/gcc.dg/pr76783.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.dg/pr76783.c	(.../tags/gcc_6_2_0_release)
@@ -1838,7 +2241,69 @@ Index: gcc/testsuite/ChangeLog
 ===================================================================
 --- a/src/gcc/testsuite/ChangeLog	(.../tags/gcc_6_2_0_release)
 +++ b/src/gcc/testsuite/ChangeLog	(.../branches/gcc-6-branch)
-@@ -1,3 +1,173 @@
+@@ -1,3 +1,235 @@
++2016-09-21  Uros Bizjak  <ubizjak at gmail.com>
++
++	* gcc.c-torture/unsorted/dump-noaddr.x: Remove debug statements.
++
++2016-09-21  Georg-Johann Lay  <avr at gjlay.de>
++
++	Backport from 2016-09-21 trunk r240306.
++
++	PR target/77326
++	* gcc.target/avr/torture/pr77326.c: New test.
++
++2016-09-16  Jakub Jelinek  <jakub at redhat.com>
++	    Eric Botcazou  <ebotcazou at adacore.com>
++
++	PR middle-end/77594
++	* gcc.target/i386/pr77594.c: New test.
++
++2016-09-16  Jakub Jelinek  <jakub at redhat.com>
++
++	Backported from mainline
++	2016-09-14  Jakub Jelinek  <jakub at redhat.com>
++
++	PR sanitizer/68260
++	* c-c++-common/tsan/pr68260.c: New test.
++
++	2016-09-13  Jakub Jelinek  <jakub at redhat.com>
++
++	PR c++/77553
++	* g++.dg/cpp1y/constexpr-77553.C: New test.
++
++	2016-09-08  Jakub Jelinek  <jakub at redhat.com>
++
++	PR fortran/77500
++	* gfortran.dg/gomp/pr77500.f90: New test.
++
++	PR fortran/77516
++	* gfortran.dg/gomp/pr77516.f90: New test.
++
++	2016-09-06  Jakub Jelinek  <jakub at redhat.com>
++
++	PR target/69255
++	* gcc.target/i386/pr69255-1.c: New test.
++	* gcc.target/i386/pr69255-2.c: New test.
++	* gcc.target/i386/pr69255-3.c: New test.
++
++	2016-09-05  Jakub Jelinek  <jakub at redhat.com>
++
++	PR sanitizer/77396
++	* g++.dg/asan/pr77396-2.C: New test.
++
++	2016-09-02  Jakub Jelinek  <jakub at redhat.com>
++
++	PR sanitizer/77396
++	* g++.dg/asan/pr77396.C: New test.
++
++2016-09-14  Nathan Sidwell  <nathan at acm.org>
++
++	PR c++/77539
++	* g++.dg/cpp0x/constexpr-recursion3.C: New.
++	* g++.dg/ubsan/pr63956.C: Adjust error location.
++	* g++.dg/cpp1y/pr77539.C: New.
++
 +2016-09-13  Tom de Vries  <tom at codesourcery.com>
 +
 +	backport from trunk:
@@ -2012,7 +2477,7 @@ Index: gcc/testsuite/ChangeLog
  2016-08-22  Release Manager
  
  	* GCC 6.2.0 released.
-@@ -150,8 +320,8 @@
+@@ -150,8 +382,8 @@
  
  2016-08-09  Martin Jambor  <mjambor at suse.cz>
  
@@ -2023,7 +2488,7 @@ Index: gcc/testsuite/ChangeLog
  
  2016-08-09  Richard Biener  <rguenther at suse.de>
  
-@@ -276,8 +446,8 @@
+@@ -276,8 +508,8 @@
  
  2016-07-20  Martin Jambor  <mjambor at suse.cz>
  
@@ -2034,7 +2499,7 @@ Index: gcc/testsuite/ChangeLog
  
  2016-07-19  Jakub Jelinek  <jakub at redhat.com>
  
-@@ -418,7 +588,7 @@
+@@ -418,7 +650,7 @@
  	2016-07-06  Yuri Rumyantsev  <ysrumyan at gmail.com>
  
  	PR tree-optimization/71518
@@ -2107,6 +2572,47 @@ Index: gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C
 +  } c;
 +} type5;
 +type5 var;
+Index: gcc/testsuite/g++.dg/ubsan/pr63956.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/ubsan/pr63956.C	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/g++.dg/ubsan/pr63956.C	(.../branches/gcc-6-branch)
+@@ -92,7 +92,7 @@
+ fn6 (const int &a, int b)
+ {
+   if (b != 2)
+-    b = a;
++    b = a;  // { dg-error "is not a constant expression" }
+   return b;
+ }
+ 
+@@ -106,7 +106,7 @@
+ 
+ constexpr int n1 = 7;
+ constexpr int n2 = fn7 (&n1, 5);
+-constexpr int n3 = fn7 ((const int *) 0, 8); // { dg-error "is not a constant expression" }
++constexpr int n3 = fn7 ((const int *) 0, 8);
+ 
+ constexpr int
+ fn8 (int i)
+Index: gcc/testsuite/g++.dg/cpp0x/constexpr-recursion3.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion3.C	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion3.C	(.../branches/gcc-6-branch)
+@@ -0,0 +1,14 @@
++// { dg-do compile { target c++11 } }
++
++constexpr int Foo (int i)
++{
++  return (i ? Foo (i - 1): 0) + i;
++}
++
++static int a = Foo (0);
++static int b = Foo (1);
++static int d = Foo (3);
++static int c = Foo (2);
++static int e = Foo (4);
++static int g = Foo (6);
++static int f = Foo (5);
 Index: gcc/testsuite/g++.dg/ipa/devirt-52.C
 ===================================================================
 --- a/src/gcc/testsuite/g++.dg/ipa/devirt-52.C	(.../tags/gcc_6_2_0_release)
@@ -2168,6 +2674,59 @@ Index: gcc/testsuite/g++.dg/ipa/devirt-52.C
 +  G (int);
 +};
 +void test () { G (0); }
+Index: gcc/testsuite/g++.dg/cpp1y/pr77539.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/cpp1y/pr77539.C	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/g++.dg/cpp1y/pr77539.C	(.../branches/gcc-6-branch)
+@@ -0,0 +1,14 @@
++// PR c++/77539
++// { dg-do compile { target c++14 } }
++
++constexpr int foobar()
++{
++  int array[100] = {};
++  int *ar = array;
++  if (ar == nullptr) // Error...
++  {
++    return 0;
++  }
++  return 1;
++}
++static_assert(foobar(),"");
+Index: gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C	(.../branches/gcc-6-branch)
+@@ -0,0 +1,29 @@
++// PR c++/77553
++// { dg-do compile { target c++14 } }
++
++constexpr void
++bar (int *x)
++{
++  int i = 0;
++  x[i++] = 1;
++  x[3] = i;
++}
++
++constexpr int
++foo ()
++{
++  int a[] = { 0, 0, 0, 0 };
++  bar (a);
++
++  return a[0] + 8 * a[1] + 64 * a[2] + 512 * a[3];
++}
++
++constexpr int b = foo ();
++
++int
++main ()
++{
++  static_assert (b == 513, "");
++  if (foo () != 513)
++    __builtin_abort ();
++}
 Index: gcc/testsuite/g++.dg/gomp/pr71910.C
 ===================================================================
 --- a/src/gcc/testsuite/g++.dg/gomp/pr71910.C	(.../tags/gcc_6_2_0_release)
@@ -2186,6 +2745,40 @@ Index: gcc/testsuite/g++.dg/gomp/pr71910.C
 +#pragma omp parallel
 +  __builtin_exit (0);
 +}
+Index: gcc/testsuite/g++.dg/asan/pr77396-2.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/asan/pr77396-2.C	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/g++.dg/asan/pr77396-2.C	(.../branches/gcc-6-branch)
+@@ -0,0 +1,12 @@
++// PR sanitizer/77396
++// { dg-do run }
++// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" }
++
++struct S { S () { asm volatile ("" : : : "memory"); } };
++static S c;
++
++int
++main ()
++{
++  return 0;
++}
+Index: gcc/testsuite/g++.dg/asan/pr77396.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/asan/pr77396.C	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/g++.dg/asan/pr77396.C	(.../branches/gcc-6-branch)
+@@ -0,0 +1,12 @@
++// PR sanitizer/77396
++// { dg-do run }
++// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" }
++
++static int a = 0; 
++static int b = a; 
++
++int
++main ()
++{
++  return 0;
++}
 Index: gcc/testsuite/g++.dg/pr77427.C
 ===================================================================
 --- a/src/gcc/testsuite/g++.dg/pr77427.C	(.../tags/gcc_6_2_0_release)
@@ -2208,6 +2801,280 @@ Index: gcc/testsuite/g++.dg/pr77427.C
 +
 +  bar (c1);
 +}
+Index: gcc/testsuite/c-c++-common/tsan/pr68260.c
+===================================================================
+--- a/src/gcc/testsuite/c-c++-common/tsan/pr68260.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/testsuite/c-c++-common/tsan/pr68260.c	(.../branches/gcc-6-branch)
+@@ -0,0 +1,28 @@
++/* PR sanitizer/68260 */
++
++#include <pthread.h>
++#include <stdbool.h>
++
++bool lock;
++int counter;
++
++void *
++tf (void *arg)
++{
++  (void) arg;
++  while (__atomic_test_and_set (&lock, __ATOMIC_ACQUIRE))
++    ;
++  ++counter;
++  __atomic_clear (&lock, __ATOMIC_RELEASE);
++  return (void *) 0;
++}
++
++int
++main ()
++{
++  pthread_t thr;
++  pthread_create (&thr, 0, tf, 0);
++  tf ((void *) 0);
++  pthread_join (thr, 0);
++  return 0;
++}
+Index: gcc/cp/constexpr.c
+===================================================================
+--- a/src/gcc/cp/constexpr.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/cp/constexpr.c	(.../branches/gcc-6-branch)
+@@ -994,7 +994,8 @@
+ }
+ 
+ /* Reuse a copy or create a new unshared copy of the function FUN.
+-   Return this copy.  */
++   Return this copy.  We use a TREE_LIST whose PURPOSE is body, VALUE
++   is parms, TYPE is result.  */
+ 
+ static tree
+ get_fundef_copy (tree fun)
+@@ -1002,15 +1003,26 @@
+   maybe_initialize_fundef_copies_table ();
+ 
+   tree copy;
+-  tree *slot = fundef_copies_table->get (fun);
+-  if (slot == NULL || *slot == NULL_TREE)
++  bool existed;
++  tree *slot = &fundef_copies_table->get_or_insert (fun, &existed);
++
++  if (!existed)
+     {
++      /* There is no cached function available, or in use.  We can use
++	 the function directly.  That the slot is now created records
++	 that this function is now in use.  */
++      copy = build_tree_list (DECL_SAVED_TREE (fun), DECL_ARGUMENTS (fun));
++      TREE_TYPE (copy) = DECL_RESULT (fun);
++    }
++  else if (*slot == NULL_TREE)
++    {
++      /* We've already used the function itself, so make a copy.  */
+       copy = build_tree_list (NULL, NULL);
+-      /* PURPOSE is body, VALUE is parms, TYPE is result.  */
+       TREE_PURPOSE (copy) = copy_fn (fun, TREE_VALUE (copy), TREE_TYPE (copy));
+     }
+   else
+     {
++      /* We have a cached function available.  */
+       copy = *slot;
+       *slot = TREE_CHAIN (copy);
+     }
+@@ -1018,12 +1030,14 @@
+   return copy;
+ }
+ 
+-/* Save the copy COPY of function FUN for later reuse by get_fundef_copy().  */
++/* Save the copy COPY of function FUN for later reuse by
++   get_fundef_copy().  By construction, there will always be an entry
++   to find.  */
+ 
+ static void
+ save_fundef_copy (tree fun, tree copy)
+ {
+-  tree *slot = &fundef_copies_table->get_or_insert (fun, NULL);
++  tree *slot = fundef_copies_table->get (fun);
+   TREE_CHAIN (copy) = *slot;
+   *slot = copy;
+ }
+@@ -1731,6 +1745,63 @@
+   return r;
+ }
+ 
++/* Helper function for cxx_eval_binary_expression.  Try to optimize
++   original POINTER_PLUS_EXPR T, LHS p+ RHS, return NULL_TREE if the
++   generic folding should be used.  */
++
++static tree
++cxx_fold_pointer_plus_expression (const constexpr_ctx *ctx, tree t,
++				  tree lhs, tree rhs, bool *non_constant_p,
++				  bool *overflow_p)
++{
++  STRIP_NOPS (lhs);
++  if (TREE_CODE (lhs) != ADDR_EXPR)
++    return NULL_TREE;
++
++  lhs = TREE_OPERAND (lhs, 0);
++
++  /* &A[i] p+ j => &A[i + j] */
++  if (TREE_CODE (lhs) == ARRAY_REF
++      && TREE_CODE (TREE_OPERAND (lhs, 1)) == INTEGER_CST
++      && TREE_CODE (rhs) == INTEGER_CST
++      && TYPE_SIZE_UNIT (TREE_TYPE (lhs))
++      && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST)
++    {
++      tree orig_type = TREE_TYPE (t);
++      location_t loc = EXPR_LOCATION (t);
++      tree type = TREE_TYPE (lhs);
++
++      t = fold_convert_loc (loc, ssizetype, TREE_OPERAND (lhs, 1));
++      tree nelts = array_type_nelts_top (TREE_TYPE (TREE_OPERAND (lhs, 0)));
++      nelts = cxx_eval_constant_expression (ctx, nelts, false, non_constant_p,
++					    overflow_p);
++      if (*non_constant_p)
++	return NULL_TREE;
++      /* Don't fold an out-of-bound access.  */
++      if (!tree_int_cst_le (t, nelts))
++	return NULL_TREE;
++      rhs = cp_fold_convert (ssizetype, rhs);
++      /* Don't fold if rhs can't be divided exactly by TYPE_SIZE_UNIT.
++	 constexpr int A[1]; ... (char *)&A[0] + 1 */
++      if (!integer_zerop (fold_build2_loc (loc, TRUNC_MOD_EXPR, sizetype,
++					   rhs, TYPE_SIZE_UNIT (type))))
++	return NULL_TREE;
++      /* Make sure to treat the second operand of POINTER_PLUS_EXPR
++	 as signed.  */
++      rhs = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetype, rhs,
++			     TYPE_SIZE_UNIT (type));
++      t = size_binop_loc (loc, PLUS_EXPR, rhs, t);
++      t = build4_loc (loc, ARRAY_REF, type, TREE_OPERAND (lhs, 0),
++		      t, NULL_TREE, NULL_TREE);
++      t = cp_build_addr_expr (t, tf_warning_or_error);
++      t = cp_fold_convert (orig_type, t);
++      return cxx_eval_constant_expression (ctx, t, /*lval*/false,
++					   non_constant_p, overflow_p);
++    }
++
++  return NULL_TREE;
++}
++
+ /* Subroutine of cxx_eval_constant_expression.
+    Like cxx_eval_unary_expression, except for binary expressions.  */
+ 
+@@ -1776,6 +1847,9 @@
+       else if (TREE_CODE (rhs) == PTRMEM_CST)
+ 	rhs = cplus_expand_constant (rhs);
+     }
++  else if (code == POINTER_PLUS_EXPR)
++    r = cxx_fold_pointer_plus_expression (ctx, t, lhs, rhs, non_constant_p,
++					  overflow_p);
+ 
+   if (r == NULL_TREE)
+     r = fold_binary_loc (loc, code, type, lhs, rhs);
+@@ -3434,65 +3508,6 @@
+   return NULL_TREE;
+ }
+ 
+-/* Subroutine of cxx_eval_constant_expression.
+-   Attempt to reduce a POINTER_PLUS_EXPR expression T.  */
+-
+-static tree
+-cxx_eval_pointer_plus_expression (const constexpr_ctx *ctx, tree t,
+-				  bool lval, bool *non_constant_p,
+-				  bool *overflow_p)
+-{
+-  tree orig_type = TREE_TYPE (t);
+-  tree op00 = TREE_OPERAND (t, 0);
+-  tree op01 = TREE_OPERAND (t, 1);
+-  location_t loc = EXPR_LOCATION (t);
+-
+-  op00 = cxx_eval_constant_expression (ctx, op00, lval,
+-				       non_constant_p, overflow_p);
+-
+-  STRIP_NOPS (op00);
+-  if (TREE_CODE (op00) != ADDR_EXPR)
+-    return NULL_TREE;
+-
+-  op01 = cxx_eval_constant_expression (ctx, op01, lval,
+-				       non_constant_p, overflow_p);
+-  op00 = TREE_OPERAND (op00, 0);
+-
+-  /* &A[i] p+ j => &A[i + j] */
+-  if (TREE_CODE (op00) == ARRAY_REF
+-      && TREE_CODE (TREE_OPERAND (op00, 1)) == INTEGER_CST
+-      && TREE_CODE (op01) == INTEGER_CST
+-      && TYPE_SIZE_UNIT (TREE_TYPE (op00))
+-      && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (op00))) == INTEGER_CST)
+-    {
+-      tree type = TREE_TYPE (op00);
+-      t = fold_convert_loc (loc, ssizetype, TREE_OPERAND (op00, 1));
+-      tree nelts = array_type_nelts_top (TREE_TYPE (TREE_OPERAND (op00, 0)));
+-      /* Don't fold an out-of-bound access.  */
+-      if (!tree_int_cst_le (t, nelts))
+-	return NULL_TREE;
+-      op01 = cp_fold_convert (ssizetype, op01);
+-      /* Don't fold if op01 can't be divided exactly by TYPE_SIZE_UNIT.
+-	 constexpr int A[1]; ... (char *)&A[0] + 1 */
+-      if (!integer_zerop (fold_build2_loc (loc, TRUNC_MOD_EXPR, sizetype,
+-					   op01, TYPE_SIZE_UNIT (type))))
+-	return NULL_TREE;
+-      /* Make sure to treat the second operand of POINTER_PLUS_EXPR
+-	 as signed.  */
+-      op01 = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetype, op01,
+-			      TYPE_SIZE_UNIT (type));
+-      t = size_binop_loc (loc, PLUS_EXPR, op01, t);
+-      t = build4_loc (loc, ARRAY_REF, type, TREE_OPERAND (op00, 0),
+-		      t, NULL_TREE, NULL_TREE);
+-      t = cp_build_addr_expr (t, tf_warning_or_error);
+-      t = cp_fold_convert (orig_type, t);
+-      return cxx_eval_constant_expression (ctx, t, lval, non_constant_p,
+-					   overflow_p);
+-    }
+-
+-  return NULL_TREE;
+-}
+-
+ /* Attempt to reduce the expression T to a constant value.
+    On failure, issue diagnostic and return error_mark_node.  */
+ /* FIXME unify with c_fully_fold */
+@@ -3810,12 +3825,6 @@
+       break;
+ 
+     case POINTER_PLUS_EXPR:
+-      r = cxx_eval_pointer_plus_expression (ctx, t, lval, non_constant_p,
+-					    overflow_p);
+-      if (r)
+-	break;
+-      /* else fall through */
+-
+     case PLUS_EXPR:
+     case MINUS_EXPR:
+     case MULT_EXPR:
+Index: gcc/cp/ChangeLog
+===================================================================
+--- a/src/gcc/cp/ChangeLog	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/cp/ChangeLog	(.../branches/gcc-6-branch)
+@@ -1,3 +1,22 @@
++2016-09-16  Jakub Jelinek  <jakub at redhat.com>
++
++	Backported from mainline
++	2016-09-13  Jakub Jelinek  <jakub at redhat.com>
++
++	PR c++/77553
++	* constexpr.c (cxx_fold_pointer_plus_expression): New function.
++	(cxx_eval_binary_expression): Use it for POINTER_PLUS_EXPR.
++	(cxx_eval_pointer_plus_expression): Remove.
++	(cxx_eval_constant_expression) <case POINTER_PLUS_EXPR>: Don't
++	call cxx_eval_pointer_plus_expression.
++
++2016-09-14  Nathan Sidwell  <nathan at acm.org>
++
++	PR c++/77539
++	* constexpr.c (get_fundef_copy): Use the original function for
++	non-recursive evaluations.
++	(save_fundef_copy): Always expect a slot to be available.
++
+ 2016-08-22  Release Manager
+ 
+ 	* GCC 6.2.0 released.
 Index: gcc/tree-ssa-propagate.c
 ===================================================================
 --- a/src/gcc/tree-ssa-propagate.c	(.../tags/gcc_6_2_0_release)
@@ -2731,6 +3598,110 @@ Index: gcc/expr.c
  		  }
  
  		if (BYTES_BIG_ENDIAN)
+Index: gcc/tsan.c
+===================================================================
+--- a/src/gcc/tsan.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/tsan.c	(.../branches/gcc-6-branch)
+@@ -40,6 +40,7 @@
+ #include "tsan.h"
+ #include "asan.h"
+ #include "builtins.h"
++#include "target.h"
+ 
+ /* Number of instrumented memory accesses in the current function.  */
+ 
+@@ -240,7 +241,8 @@
+ enum tsan_atomic_action
+ {
+   check_last, add_seq_cst, add_acquire, weak_cas, strong_cas,
+-  bool_cas, val_cas, lock_release, fetch_op, fetch_op_seq_cst
++  bool_cas, val_cas, lock_release, fetch_op, fetch_op_seq_cst,
++  bool_clear, bool_test_and_set
+ };
+ 
+ /* Table how to map sync/atomic builtins to their corresponding
+@@ -274,6 +276,10 @@
+   TRANSFORM (fcode, tsan_fcode, fetch_op, code)
+ #define FETCH_OPS(fcode, tsan_fcode, code) \
+   TRANSFORM (fcode, tsan_fcode, fetch_op_seq_cst, code)
++#define BOOL_CLEAR(fcode, tsan_fcode) \
++  TRANSFORM (fcode, tsan_fcode, bool_clear, ERROR_MARK)
++#define BOOL_TEST_AND_SET(fcode, tsan_fcode) \
++  TRANSFORM (fcode, tsan_fcode, bool_test_and_set, ERROR_MARK)
+ 
+   CHECK_LAST (ATOMIC_LOAD_1, TSAN_ATOMIC8_LOAD),
+   CHECK_LAST (ATOMIC_LOAD_2, TSAN_ATOMIC16_LOAD),
+@@ -463,7 +469,11 @@
+   LOCK_RELEASE (SYNC_LOCK_RELEASE_2, TSAN_ATOMIC16_STORE),
+   LOCK_RELEASE (SYNC_LOCK_RELEASE_4, TSAN_ATOMIC32_STORE),
+   LOCK_RELEASE (SYNC_LOCK_RELEASE_8, TSAN_ATOMIC64_STORE),
+-  LOCK_RELEASE (SYNC_LOCK_RELEASE_16, TSAN_ATOMIC128_STORE)
++  LOCK_RELEASE (SYNC_LOCK_RELEASE_16, TSAN_ATOMIC128_STORE),
++
++  BOOL_CLEAR (ATOMIC_CLEAR, TSAN_ATOMIC8_STORE),
++
++  BOOL_TEST_AND_SET (ATOMIC_TEST_AND_SET, TSAN_ATOMIC8_EXCHANGE)
+ };
+ 
+ /* Instrument an atomic builtin.  */
+@@ -615,6 +625,57 @@
+ 				build_int_cst (NULL_TREE,
+ 					       MEMMODEL_RELEASE));
+ 	    return;
++	  case bool_clear:
++	  case bool_test_and_set:
++	    if (BOOL_TYPE_SIZE != 8)
++	      {
++		decl = NULL_TREE;
++		for (j = 1; j < 5; j++)
++		  if (BOOL_TYPE_SIZE == (8 << j))
++		    {
++		      enum built_in_function tsan_fcode
++			= (enum built_in_function)
++			  (tsan_atomic_table[i].tsan_fcode + j);
++		      decl = builtin_decl_implicit (tsan_fcode);
++		      break;
++		    }
++		if (decl == NULL_TREE)
++		  return;
++	      }
++	    last_arg = gimple_call_arg (stmt, num - 1);
++	    if (!tree_fits_uhwi_p (last_arg)
++		|| memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST)
++	      return;
++	    t = TYPE_ARG_TYPES (TREE_TYPE (decl));
++	    t = TREE_VALUE (TREE_CHAIN (t));
++	    if (tsan_atomic_table[i].action == bool_clear)
++	      {
++		update_gimple_call (gsi, decl, 3, gimple_call_arg (stmt, 0),
++				    build_int_cst (t, 0), last_arg);
++		return;
++	      }
++	    t = build_int_cst (t, targetm.atomic_test_and_set_trueval);
++	    update_gimple_call (gsi, decl, 3, gimple_call_arg (stmt, 0),
++				t, last_arg);
++	    stmt = gsi_stmt (*gsi);
++	    lhs = gimple_call_lhs (stmt);
++	    if (lhs == NULL_TREE)
++	      return;
++	    if (targetm.atomic_test_and_set_trueval != 1
++		|| !useless_type_conversion_p (TREE_TYPE (lhs),
++					       TREE_TYPE (t)))
++	      {
++		tree new_lhs = make_ssa_name (TREE_TYPE (t));
++		gimple_call_set_lhs (stmt, new_lhs);
++		if (targetm.atomic_test_and_set_trueval != 1)
++		  g = gimple_build_assign (lhs, NE_EXPR, new_lhs,
++					   build_int_cst (TREE_TYPE (t), 0));
++		else
++		  g = gimple_build_assign (lhs, NOP_EXPR, new_lhs);
++		gsi_insert_after (gsi, g, GSI_NEW_STMT);
++		update_stmt (stmt);
++	      }
++	    return;
+ 	  default:
+ 	    continue;
+ 	  }
 Index: gcc/fortran/openmp.c
 ===================================================================
 --- a/src/gcc/fortran/openmp.c	(.../tags/gcc_6_2_0_release)
@@ -2779,7 +3750,52 @@ Index: gcc/fortran/trans-openmp.c
 ===================================================================
 --- a/src/gcc/fortran/trans-openmp.c	(.../tags/gcc_6_2_0_release)
 +++ b/src/gcc/fortran/trans-openmp.c	(.../branches/gcc-6-branch)
-@@ -3552,7 +3552,9 @@
+@@ -2816,7 +2816,11 @@
+   gfc_start_block (&block);
+ 
+   expr2 = code->expr2;
+-  if (expr2->expr_type == EXPR_FUNCTION
++  if (((atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
++       != GFC_OMP_ATOMIC_WRITE)
++      && (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_SWAP) == 0
++      && expr2->expr_type == EXPR_FUNCTION
++      && expr2->value.function.isym
+       && expr2->value.function.isym->id == GFC_ISYM_CONVERSION)
+     expr2 = expr2->value.function.actual->expr;
+ 
+@@ -2855,6 +2859,7 @@
+ 	  var = code->expr1->symtree->n.sym;
+ 	  expr2 = code->expr2;
+ 	  if (expr2->expr_type == EXPR_FUNCTION
++	      && expr2->value.function.isym
+ 	      && expr2->value.function.isym->id == GFC_ISYM_CONVERSION)
+ 	    expr2 = expr2->value.function.actual->expr;
+ 	}
+@@ -2912,6 +2917,7 @@
+ 	}
+       e = expr2->value.op.op1;
+       if (e->expr_type == EXPR_FUNCTION
++	  && e->value.function.isym
+ 	  && e->value.function.isym->id == GFC_ISYM_CONVERSION)
+ 	e = e->value.function.actual->expr;
+       if (e->expr_type == EXPR_VARIABLE
+@@ -2925,6 +2931,7 @@
+ 	{
+ 	  e = expr2->value.op.op2;
+ 	  if (e->expr_type == EXPR_FUNCTION
++	      && e->value.function.isym
+ 	      && e->value.function.isym->id == GFC_ISYM_CONVERSION)
+ 	    e = e->value.function.actual->expr;
+ 	  gcc_assert (e->expr_type == EXPR_VARIABLE
+@@ -3039,6 +3046,7 @@
+ 	  code = code->next;
+ 	  expr2 = code->expr2;
+ 	  if (expr2->expr_type == EXPR_FUNCTION
++	      && expr2->value.function.isym
+ 	      && expr2->value.function.isym->id == GFC_ISYM_CONVERSION)
+ 	    expr2 = expr2->value.function.actual->expr;
+ 
+@@ -3552,7 +3560,9 @@
    gfc_start_block (&block);
    omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses,
  				       code->loc);
@@ -2789,7 +3805,7 @@ Index: gcc/fortran/trans-openmp.c
    stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt,
  		     omp_clauses);
    gfc_add_expr_to_block (&block, stmt);
-@@ -3997,10 +3999,7 @@
+@@ -3997,10 +4007,7 @@
  				       code->loc);
    pushlevel ();
    stmt = gfc_trans_omp_workshare (code, &workshare_clauses);
@@ -2801,7 +3817,7 @@ Index: gcc/fortran/trans-openmp.c
    stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt,
  		     omp_clauses);
    OMP_PARALLEL_COMBINED (stmt) = 1;
-@@ -4060,7 +4059,9 @@
+@@ -4060,7 +4067,9 @@
    gfc_start_block (&block);
    omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses,
  				       code->loc);
@@ -2811,7 +3827,7 @@ Index: gcc/fortran/trans-openmp.c
    stmt = build2_loc (input_location, OMP_TASK, void_type_node, stmt,
  		     omp_clauses);
    gfc_add_expr_to_block (&block, stmt);
-@@ -4213,7 +4214,11 @@
+@@ -4213,7 +4222,11 @@
        = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_TARGET],
  			       code->loc);
    if (code->op == EXEC_OMP_TARGET)
@@ -2828,7 +3844,17 @@ Index: gcc/fortran/ChangeLog
 ===================================================================
 --- a/src/gcc/fortran/ChangeLog	(.../tags/gcc_6_2_0_release)
 +++ b/src/gcc/fortran/ChangeLog	(.../branches/gcc-6-branch)
-@@ -1,3 +1,39 @@
+@@ -1,3 +1,49 @@
++2016-09-16  Jakub Jelinek  <jakub at redhat.com>
++
++	Backported from mainline
++	2016-09-08  Jakub Jelinek  <jakub at redhat.com>
++
++	PR fortran/77500
++	* trans-openmp.c (gfc_trans_omp_atomic): For atomic write or
++	swap, don't try to look through GFC_ISYM_CONVERSION.  In other cases,
++	check that value.function.isym is non-NULL before dereferencing it.
++
 +2016-09-01  Jakub Jelinek  <jakub at redhat.com>
 +
 +	Backported from mainline
@@ -2951,6 +3977,137 @@ Index: gcc/fortran/parse.c
    count = 1 + ((cp->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
  	       == GFC_OMP_ATOMIC_CAPTURE);
  
+Index: gcc/lra-constraints.c
+===================================================================
+--- a/src/gcc/lra-constraints.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/lra-constraints.c	(.../branches/gcc-6-branch)
+@@ -871,15 +871,18 @@
+ }
+ 
+ /* Generate reloads for matching OUT and INS (array of input operand
+-   numbers with end marker -1) with reg class GOAL_CLASS.  Add input
+-   and output reloads correspondingly to the lists *BEFORE and *AFTER.
+-   OUT might be negative.  In this case we generate input reloads for
+-   matched input operands INS.  EARLY_CLOBBER_P is a flag that the
+-   output operand is early clobbered for chosen alternative.  */
++   numbers with end marker -1) with reg class GOAL_CLASS, considering
++   output operands OUTS (similar array to INS) needing to be in different
++   registers.  Add input and output reloads correspondingly to the lists
++   *BEFORE and *AFTER.  OUT might be negative.  In this case we generate
++   input reloads for matched input operands INS.  EARLY_CLOBBER_P is a flag
++   that the output operand is early clobbered for chosen alternative.  */
+ static void
+-match_reload (signed char out, signed char *ins, enum reg_class goal_class,
+-	      rtx_insn **before, rtx_insn **after, bool early_clobber_p)
++match_reload (signed char out, signed char *ins, signed char *outs,
++	      enum reg_class goal_class, rtx_insn **before,
++	      rtx_insn **after, bool early_clobber_p)
+ {
++  bool out_conflict;
+   int i, in;
+   rtx new_in_reg, new_out_reg, reg;
+   machine_mode inmode, outmode;
+@@ -968,6 +971,25 @@
+ 	 We don't care about eliminable hard regs here as we are
+ 	 interesting only in pseudos.  */
+ 
++      /* Matching input's register value is the same as one of the other
++	 output operand.  Output operands in a parallel insn must be in
++	 different registers.  */
++      out_conflict = false;
++      if (REG_P (in_rtx))
++	{
++	  for (i = 0; outs[i] >= 0; i++)
++	    {
++	      rtx other_out_rtx = *curr_id->operand_loc[outs[i]];
++	      if (REG_P (other_out_rtx)
++		  && (regno_val_use_in (REGNO (in_rtx), other_out_rtx)
++		      != NULL_RTX))
++		{
++		  out_conflict = true;
++		  break;
++		}
++	    }
++	}
++
+       new_in_reg = new_out_reg
+ 	= (! early_clobber_p && ins[1] < 0 && REG_P (in_rtx)
+ 	   && (int) REGNO (in_rtx) < lra_new_regno_start
+@@ -974,6 +996,7 @@
+ 	   && find_regno_note (curr_insn, REG_DEAD, REGNO (in_rtx))
+ 	   && (out < 0
+ 	       || regno_val_use_in (REGNO (in_rtx), out_rtx) == NULL_RTX)
++	   && !out_conflict
+ 	   ? lra_create_new_reg (inmode, in_rtx, goal_class, "")
+ 	   : lra_create_new_reg_with_unique_value (outmode, out_rtx,
+ 						   goal_class, ""));
+@@ -3396,9 +3419,11 @@
+   int i, j, k;
+   int n_operands;
+   int n_alternatives;
++  int n_outputs;
+   int commutative;
+   signed char goal_alt_matched[MAX_RECOG_OPERANDS][MAX_RECOG_OPERANDS];
+   signed char match_inputs[MAX_RECOG_OPERANDS + 1];
++  signed char outputs[MAX_RECOG_OPERANDS + 1];
+   rtx_insn *before, *after;
+   bool alt_p = false;
+   /* Flag that the insn has been changed through a transformation.  */
+@@ -3806,6 +3831,8 @@
+ 	  }
+       }
+ 
++  n_outputs = 0;
++  outputs[0] = -1;
+   for (i = 0; i < n_operands; i++)
+     {
+       int regno;
+@@ -3963,7 +3990,7 @@
+ 	  /* generate reloads for input and matched outputs.  */
+ 	  match_inputs[0] = i;
+ 	  match_inputs[1] = -1;
+-	  match_reload (goal_alt_matched[i][0], match_inputs,
++	  match_reload (goal_alt_matched[i][0], match_inputs, outputs,
+ 			goal_alt[i], &before, &after,
+ 			curr_static_id->operand_alternative
+ 			[goal_alt_number * n_operands + goal_alt_matched[i][0]]
+@@ -3973,9 +4000,9 @@
+ 	       && (curr_static_id->operand[goal_alt_matched[i][0]].type
+ 		   == OP_IN))
+ 	/* Generate reloads for output and matched inputs.  */
+-	match_reload (i, goal_alt_matched[i], goal_alt[i], &before, &after,
+-		      curr_static_id->operand_alternative
+-		      [goal_alt_number * n_operands + i].earlyclobber);
++	match_reload (i, goal_alt_matched[i], outputs, goal_alt[i], &before,
++		      &after, curr_static_id->operand_alternative
++			      [goal_alt_number * n_operands + i].earlyclobber);
+       else if (curr_static_id->operand[i].type == OP_IN
+ 	       && (curr_static_id->operand[goal_alt_matched[i][0]].type
+ 		   == OP_IN))
+@@ -3985,12 +4012,22 @@
+ 	  for (j = 0; (k = goal_alt_matched[i][j]) >= 0; j++)
+ 	    match_inputs[j + 1] = k;
+ 	  match_inputs[j + 1] = -1;
+-	  match_reload (-1, match_inputs, goal_alt[i], &before, &after, false);
++	  match_reload (-1, match_inputs, outputs, goal_alt[i], &before,
++			&after, false);
+ 	}
+       else
+ 	/* We must generate code in any case when function
+ 	   process_alt_operands decides that it is possible.  */
+ 	gcc_unreachable ();
++
++      /* Memorise processed outputs so that output remaining to be processed
++	 can avoid using the same register value (see match_reload).  */
++      if (curr_static_id->operand[i].type == OP_OUT)
++	{
++	  outputs[n_outputs++] = i;
++	  outputs[n_outputs] = -1;
++	}
++
+       if (optional_p)
+ 	{
+ 	  lra_assert (REG_P (op));
 Index: gcc/tree-cfgcleanup.c
 ===================================================================
 --- a/src/gcc/tree-cfgcleanup.c	(.../tags/gcc_6_2_0_release)
@@ -569075,6 +570232,15 @@ Index: gcc/config/i386/i386.c
      {
        int u = is_min ? UNSPEC_IEEE_MIN : UNSPEC_IEEE_MAX;
        rtvec v;
+@@ -40361,7 +40380,7 @@
+ 	  error ("%qE needs isa option %s", fndecl, opts);
+ 	  free (opts);
+ 	}
+-      return const0_rtx;
++      return expand_call (exp, target, ignore);
+     }
+ 
+   switch (fcode)
 @@ -48848,6 +48867,8 @@
    /* ms_abi and sysv_abi calling convention function attributes.  */
    { "ms_abi", 0, 0, false, true, true, ix86_handle_abi_attribute, true },
@@ -569172,6 +570338,72 @@ Index: gcc/config/i386/i386.c
    return std_canonical_va_list_type (type);
  }
  
+Index: gcc/config/avr/avr.c
+===================================================================
+--- a/src/gcc/config/avr/avr.c	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/config/avr/avr.c	(.../branches/gcc-6-branch)
+@@ -2518,9 +2518,45 @@
+       break;
+ 
+     case CC_NONE:
+-      /* Insn does not affect CC at all.  */
+-      break;
++      /* Insn does not affect CC at all, but it might set some registers
++         that are stored in cc_status.  If such a register is affected by
++         the current insn, for example by means of a SET or a CLOBBER,
++         then we must reset cc_status; cf. PR77326.
+ 
++         Unfortunately, set_of cannot be used as reg_overlap_mentioned_p
++         will abort on COMPARE (which might be found in cc_status.value1/2).
++         Thus work out the registers set by the insn and regs mentioned
++         in cc_status.value1/2.  */
++
++      if (cc_status.value1
++          || cc_status.value2)
++        {
++          HARD_REG_SET regs_used;
++          HARD_REG_SET regs_set;
++          CLEAR_HARD_REG_SET (regs_used);
++
++          if (cc_status.value1
++              && !CONSTANT_P (cc_status.value1))
++            {
++              find_all_hard_regs (cc_status.value1, &regs_used);
++            }
++
++          if (cc_status.value2
++              && !CONSTANT_P (cc_status.value2))
++            {
++              find_all_hard_regs (cc_status.value2, &regs_used);
++            }
++
++          find_all_hard_reg_sets (insn, &regs_set, false);
++
++          if (hard_reg_set_intersect_p (regs_used, regs_set))
++            {
++              CC_STATUS_INIT;
++            }
++        }
++
++      break; // CC_NONE
++
+     case CC_SET_N:
+       CC_STATUS_INIT;
+       break;
+Index: gcc/config/rs6000/xcoff.h
+===================================================================
+--- a/src/gcc/config/rs6000/xcoff.h	(.../tags/gcc_6_2_0_release)
++++ b/src/gcc/config/rs6000/xcoff.h	(.../branches/gcc-6-branch)
+@@ -313,6 +313,9 @@
+ #define EH_FRAME_THROUGH_COLLECT2 1
+ #define EH_TABLES_CAN_BE_READ_ONLY 1
+ 
++/* AIX Assembler implicitly assumes DWARF 64 bit extension in 64 bit mode.  */
++#define DWARF_OFFSET_SIZE PTR_SIZE
++
+ #define ASM_OUTPUT_DWARF_PCREL(FILE,SIZE,LABEL) \
+   rs6000_asm_output_dwarf_pcrel ((FILE), (SIZE), (LABEL));
+ 
 Index: gcc/config/rs6000/vsx.md
 ===================================================================
 --- a/src/gcc/config/rs6000/vsx.md	(.../tags/gcc_6_2_0_release)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/gcc-6.git



More information about the Reproducible-commits mailing list