aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2015-02-06 19:22:04 +0000
committerMichael Meissner <meissner@linux.vnet.ibm.com>2015-02-06 19:22:04 +0000
commit8af22d29027e0c2bb1b2ae709d792a7fc10d88c5 (patch)
tree08f701e9370f9a8978bfc6a067bcdea879a4ac33
parenta92368752be5b142ba4a07dd0bcb8ad539767daa (diff)
parentdbb9389264233b31bfa3a45e4bcb19db07fc6531 (diff)
Merge up to 220484
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_9-addr@220486 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog390
-rw-r--r--gcc/ChangeLog.ibm15
-rw-r--r--gcc/ChangeLog.meissner5
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/REVISION2
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/Makefile.in9
-rw-r--r--gcc/alias.c14
-rw-r--r--gcc/c-family/ChangeLog9
-rw-r--r--gcc/c-family/c-common.c3
-rw-r--r--gcc/c/ChangeLog15
-rw-r--r--gcc/c/c-typeck.c5
-rw-r--r--gcc/cfgrtl.c16
-rw-r--r--gcc/combine.c4
-rw-r--r--gcc/config/aarch64/aarch64-simd.md35
-rw-r--r--gcc/config/arm/arm.h4
-rw-r--r--gcc/config/i386/avx2intrin.h18
-rw-r--r--gcc/config/i386/driver-i386.c14
-rw-r--r--gcc/config/i386/emmintrin.h16
-rw-r--r--gcc/config/i386/i386.c28
-rw-r--r--gcc/config/i386/i386.md10
-rw-r--r--gcc/config/i386/mmx.md36
-rw-r--r--gcc/config/i386/predicates.md9
-rw-r--r--gcc/config/i386/sse.md2
-rw-r--r--gcc/config/nios2/nios2.c15
-rw-r--r--gcc/config/pa/pa.md8
-rw-r--r--gcc/config/pa/predicates.md21
-rw-r--r--gcc/config/rs6000/rs6000-cpus.def1
-rw-r--r--gcc/config/rs6000/rs6000.c35
-rw-r--r--gcc/config/rs6000/rs6000.md12
-rw-r--r--gcc/config/rs6000/rtems.h3
-rw-r--r--gcc/config/rs6000/t-rtems73
-rw-r--r--gcc/config/rx/rx.c2
-rw-r--r--gcc/config/rx/rx.h6
-rw-r--r--gcc/config/s390/s390.c31
-rw-r--r--gcc/config/s390/s390.md2
-rw-r--r--gcc/config/sh/sh-mem.cc24
-rw-r--r--gcc/cp/ChangeLog55
-rw-r--r--gcc/cp/call.c4
-rw-r--r--gcc/cp/cp-tree.h12
-rw-r--r--gcc/cp/decl.c22
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/mangle.c2
-rw-r--r--gcc/cp/parser.c7
-rw-r--r--gcc/cp/pt.c26
-rw-r--r--gcc/cp/repo.c6
-rw-r--r--gcc/cp/semantics.c11
-rw-r--r--gcc/cp/typeck.c6
-rw-r--r--gcc/cse.c40
-rw-r--r--gcc/doc/md.texi6
-rw-r--r--gcc/dse.c8
-rw-r--r--gcc/dwarf2out.c16
-rw-r--r--gcc/dwarf2out.h2
-rw-r--r--gcc/expr.c18
-rw-r--r--gcc/fortran/ChangeLog73
-rw-r--r--gcc/fortran/class.c37
-rw-r--r--gcc/fortran/dependency.c37
-rw-r--r--gcc/fortran/interface.c110
-rw-r--r--gcc/fortran/intrinsic.texi4
-rw-r--r--gcc/fortran/resolve.c139
-rw-r--r--gcc/fortran/trans-array.c7
-rw-r--r--gcc/fortran/trans-decl.c5
-rw-r--r--gcc/go/gofrontend/export.cc16
-rw-r--r--gcc/go/gofrontend/export.h5
-rw-r--r--gcc/go/gofrontend/gogo.cc79
-rw-r--r--gcc/go/gofrontend/gogo.h16
-rw-r--r--gcc/go/gofrontend/import-archive.cc9
-rw-r--r--gcc/go/gofrontend/import.cc10
-rw-r--r--gcc/go/gofrontend/unsafe.cc2
-rw-r--r--gcc/ipa-inline-transform.c2
-rw-r--r--gcc/ipa.c14
-rw-r--r--gcc/jump.c25
-rw-r--r--gcc/lto-cgraph.c3
-rw-r--r--gcc/omp-low.c11
-rw-r--r--gcc/ree.c75
-rw-r--r--gcc/reload.c1
-rw-r--r--gcc/rtlanal.c13
-rw-r--r--gcc/testsuite/ChangeLog283
-rw-r--r--gcc/testsuite/ChangeLog.meissner4
-rw-r--r--gcc/testsuite/c-c++-common/pr61553.c8
-rw-r--r--gcc/testsuite/c-c++-common/tsan/atomic_stack.c8
-rw-r--r--gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c9
-rw-r--r--gcc/testsuite/c-c++-common/tsan/mutexset1.c9
-rw-r--r--gcc/testsuite/c-c++-common/tsan/race_on_barrier.c10
-rw-r--r--gcc/testsuite/c-c++-common/tsan/race_on_mutex.c12
-rw-r--r--gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c11
-rw-r--r--gcc/testsuite/c-c++-common/tsan/simple_race.c11
-rw-r--r--gcc/testsuite/c-c++-common/tsan/simple_stack.c25
-rw-r--r--gcc/testsuite/c-c++-common/tsan/sleep_sync.c6
-rw-r--r--gcc/testsuite/c-c++-common/tsan/tiny_race.c8
-rw-r--r--gcc/testsuite/c-c++-common/tsan/tls_race.c8
-rw-r--r--gcc/testsuite/c-c++-common/tsan/tsan_barrier.h14
-rw-r--r--gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/deleted9.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist89.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/override1.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/ref-qual16.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic165.C17
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr64068.C49
-rw-r--r--gcc/testsuite/g++.dg/pr54442.C12
-rw-r--r--gcc/testsuite/g++.dg/pr64037.C27
-rw-r--r--gcc/testsuite/g++.dg/template/non-dependent14.C7
-rw-r--r--gcc/testsuite/g++.dg/template/offsetof3.C18
-rw-r--r--gcc/testsuite/g++.dg/template/ref9.C15
-rw-r--r--gcc/testsuite/g++.dg/template/repo11.C31
-rw-r--r--gcc/testsuite/g++.dg/tsan/atomic_free.C9
-rw-r--r--gcc/testsuite/g++.dg/tsan/atomic_free2.C9
-rw-r--r--gcc/testsuite/g++.dg/tsan/cond_race.C9
-rw-r--r--gcc/testsuite/g++.dg/tsan/tsan_barrier.h14
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-22.C12
-rw-r--r--gcc/testsuite/g++.dg/warn/register-parm-1.C9
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr64269.c9
-rw-r--r--gcc/testsuite/gcc.dg/ipa/PR64559.c39
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr63551.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr61058.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr63637-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr63637-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr63637-3.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr63637-4.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr63637-5.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr63637-6.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr64536.c67
-rw-r--r--gcc/testsuite/gcc.dg/pr64563.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr64663.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr64766.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr64778.c10
-rw-r--r--gcc/testsuite/gcc.dg/tm/pr64391.c10
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr64421.c36
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr63424.c39
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-pr64286.c37
-rw-r--r--gcc/testsuite/gcc.target/i386/builtin_target.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr57003.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59927.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr60516.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63637-1.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63637-2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63637-3.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63637-4.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63637-5.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr63637-6.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr64409.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr64513.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-14.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-22.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr64505.c231
-rw-r--r--gcc/testsuite/gcc.target/sh/pr64507.c25
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_mold_1.f9047
-rw-r--r--gcc/testsuite/gfortran.dg/class_allocate_17.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/class_allocate_18.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_36.f347
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_37.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/dependency_45.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/internal_pack_15.f9077
-rw-r--r--gcc/testsuite/gfortran.dg/pr64528.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_26.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_operator_20.f9053
-rw-r--r--gcc/testsuite/gnat.dg/opt47.adb31
-rw-r--r--gcc/testsuite/gnat.dg/unchecked_convert1.adb4
-rw-r--r--gcc/testsuite/go.test/go-test.exp6
-rw-r--r--gcc/trans-mem.c9
-rw-r--r--gcc/tree-ssa-forwprop.c6
-rw-r--r--gcc/tree-vrp.c2
-rw-r--r--gcc/tree.c7
-rw-r--r--gcc/tsan.c15
-rw-r--r--libatomic/ChangeLog5
-rw-r--r--libatomic/fop_n.c12
-rw-r--r--libbacktrace/ChangeLog5
-rwxr-xr-xlibbacktrace/configure133
-rw-r--r--libbacktrace/configure.ac5
-rw-r--r--libcilkrts/ChangeLog5
-rw-r--r--libcilkrts/configure105
-rw-r--r--libcilkrts/configure.ac3
-rw-r--r--libgcc/ChangeLog30
-rw-r--r--libgcc/config/i386/cpuinfo.c12
-rw-r--r--libgcc/config/nios2/linux-unwind.h3
-rw-r--r--libgcc/config/pa/linux-atomic.c42
-rw-r--r--libgo/Makefile.am14
-rw-r--r--libgo/Makefile.in18
-rwxr-xr-xlibgo/configure35
-rw-r--r--libgo/configure.ac13
-rw-r--r--libgo/go/debug/elf/elf.go236
-rw-r--r--libgo/go/debug/elf/file.go46
-rw-r--r--libgo/go/debug/elf/file_test.go6
-rw-r--r--libgo/go/debug/elf/testdata/go-relocation-test-gcc447-ppc64.objbin0 -> 3048 bytes
-rw-r--r--libgo/go/go/build/syslist.go2
-rw-r--r--libgo/go/reflect/all_test.go8
-rw-r--r--libgo/go/reflect/makefunc.go6
-rw-r--r--libgo/go/reflect/makefunc_ppc.c95
-rw-r--r--libgo/go/reflect/makefuncgo_ppc.go621
-rwxr-xr-xlibgo/mksysinfo.sh26
-rw-r--r--libgo/runtime/go-panic.h4
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.c/pr64734.c55
-rw-r--r--libquadmath/ChangeLog5
-rwxr-xr-xlibquadmath/configure131
-rw-r--r--libquadmath/configure.ac3
-rw-r--r--libsanitizer/ChangeLog5
-rwxr-xr-xlibsanitizer/configure105
-rw-r--r--libsanitizer/configure.ac3
-rw-r--r--libstdc++-v3/ChangeLog102
-rw-r--r--libstdc++-v3/include/bits/regex.h123
-rw-r--r--libstdc++-v3/include/bits/regex.tcc101
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.tcc2
-rw-r--r--libstdc++-v3/include/bits/stl_algo.h3
-rw-r--r--libstdc++-v3/include/bits/stl_uninitialized.h5
-rw-r--r--libstdc++-v3/include/std/future3
-rw-r--r--libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/64476.cc65
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc35
-rw-r--r--libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc13
-rw-r--r--libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc20
-rw-r--r--libstdc++-v3/testsuite/28_regex/basic_regex/imbue/string.cc44
-rw-r--r--libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc45
-rw-r--r--libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc49
-rw-r--r--libstdc++-v3/testsuite/28_regex/match_results/swap.cc43
-rw-r--r--libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc22
-rw-r--r--libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc12
-rw-r--r--libstdc++-v3/testsuite/28_regex/traits/wchar_t/user_defined.cc24
218 files changed, 5769 insertions, 860 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 48bb653809e..f7bb14f74fc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,393 @@
+2015-02-05 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/64580
+ Backport from mainline
+ * config.rs6000/rs6000.c (compute_vrsave_mask): Reverse loop order.
+ (rs6000_stack_info): Add assert.
+ (rs6000_output_savres_externs): New function, split off from...
+ (rs6000_output_function_prologue): ... here. Do not call it for
+ thunks.
+
+2015-02-04 Matthias Klose <doko@ubuntu.com>
+
+ PR target/64938
+ Backport from mainline
+ 2015-01-15 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/64068
+ PR ipa/64559
+ * ipa.c (symbol_table::remove_unreachable_nodes):
+ Do not put abstract origins into boundary.
+
+2015-02-04 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2015-01-31 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/64882
+ * config/i386/predicates.md (address_no_seg_operand): Reject
+ non-CONST_INT_P operands in invalid mode.
+
+ Backport from mainline
+ 2015-01-31 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (*prefetch_prefetchw1): Remove mode of
+ address_operand 0. Rename from *prefetch_prefetchwt1_<mode>.
+ * config/i386/predicates.md (address_no_seg_operand): Call
+ address_operand with VOIDmode.
+ (vsib_address_operand): Ditto.
+
+2015-02-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2015-01-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/driver-i386.c (host_detect_local_cpu): Check new
+ Silvermont, Haswell, Broadwell and Knights Landing model numbers.
+ * config/i386/i386.c (processor_model): Add
+ M_INTEL_COREI7_BROADWELL.
+ (arch_names_table): Add "broadwell".
+
+2015-02-01 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2015-01-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/61058
+ * jump.c (cleanup_barriers): Update basic block boundaries
+ if BLOCK_FOR_INSN is non-NULL on PREV.
+
+ 2015-01-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/64421
+ * omp-low.c (simd_clone_mangle): If DECL_ASSEMBLER_NAME starts
+ with asterisk, skip the first character.
+
+ * config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add
+ OPTION_MASK_QUAD_MEMORY_ATOMIC.
+
+ 2015-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/63637
+ PR rtl-optimization/60663
+ * cse.c (merge_equiv_classes): Set new_elt->cost to MAX_COST
+ if elt->cost is MAX_COST for ASM_OPERANDS.
+ (find_sets_in_insn): Fix up comment typo.
+ (cse_insn): Don't set src_volatile for all non-volatile
+ ASM_OPERANDS in PARALLELs, but just those with multiple outputs
+ or with "memory" clobber. Set elt->cost to MAX_COST
+ for ASM_OPERANDS in PARALLEL. Set src_elt->cost to MAX_COST
+ if new_src is ASM_OPERANDS and elt->cost is MAX_COST.
+
+ PR debug/64511
+ * dwarf2out.c (struct dw_loc_descr_node): Add chain_next
+ GTY markup.
+
+ 2015-01-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/64663
+ * dwarf2out.c (decl_piece_node): Don't put bitsize into
+ mode if bitsize <= 0.
+ (decl_piece_bitsize, adjust_piece_list, add_var_loc_to_decl,
+ dw_sra_loc_expr): Use HOST_WIDE_INT instead of int for bit
+ sizes and positions.
+
+2015-01-29 Ilya Tocar <ilya.tocar@intel.com>
+
+ * config/i386/avx2intrin.h (_mm256_bslli_epi128,
+ _mm256_bsrli_epi128): New.
+ * config/i386/emmintrin.h (_mm_bsrli_si128, _mm_bslli_si128): Ditto.
+
+2015-01-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * config/s390/s390.c (s390_memory_move_cost): Increase costs for
+ memory accesses.
+
+2015-01-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * config/s390/s390.c (s390_register_move_cost): Increase costs for
+ FPR->GPR moves.
+
+2015-01-26 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2015-01-26 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/64795
+ * config/i386/i386.md (*movdi_internal): Also check operand 0
+ to determine TYPE_LEA operand.
+ (*movsi_internal): Ditto.
+
+ Backport from mainline
+ 2015-01-23 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/sse.md (sse2_loadld): Set attribute isa to sse2 for
+ alternative 1.
+
+2015-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/64734
+ * omp-low.c (scan_sharing_clauses): Don't ignore
+ OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION GOMP_MAP_POINTER clauses
+ on target data/update constructs.
+
+2015-01-23 Wei Mi <wmi@google.com>
+
+ Backported from trunk.
+ 2015-01-22 Wei Mi <wmi@google.com>
+
+ PR rtl-optimization/64557
+ * dse.c (record_store): Call get_addr for mem_addr.
+ (check_mem_read_rtx): Likewise.
+
+2015-01-22 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * config/s390/s390.md (atomic code attribute): Fix typo "ior" ->
+ "or".
+
+2015-01-21 Wei Mi <wmi@google.com>
+
+ Backported from trunk.
+ 2014-11-22 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/63970
+ * ipa.c (symbol_table::remove_unreachable_nodes): Mark all inline clones
+ as having abstract origin used.
+ * ipa-inline-transform.c (can_remove_node_now_p_1): Drop abstract origin check.
+ (clone_inlined_nodes): Copy abstract originflag.
+ * lto-cgraph.c (compute_ltrans_boundary): Use get_create to get abstract origin node.
+
+2015-01-20 Chung-Lin Tang <cltang@codesourcery.com>
+
+ Backport from mainline
+ * config/nios2/nios2.c (nios2_asm_file_end): Implement
+ TARGET_ASM_FILE_END hook for adding .note.GNU-stack section when
+ needed.
+ (TARGET_ASM_FILE_END): Define.
+
+2015-01-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2014-11-27 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/63704
+ * alias.c (mems_in_disjoint_alias_sets_p): Remove assert
+ and instead return false when !fstrict-aliasing.
+
+2015-01-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * expr.c (expand_expr_real_1) <normal_inner_ref>: Use the expression to
+ set the memory attributes in all cases but clear MEM_EXPR if need be.
+
+2015-01-14 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2015-01-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/64513
+ * config/i386/i386.c (ix86_expand_prologue): Add
+ REG_FRAME_RELATED_EXPR to %rax and %r10 pushes.
+
+ 2015-01-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/64286
+ * ree.c (combine_reaching_defs): Move part of comment earlier,
+ remove !SCALAR_INT_MODE_P check.
+ (add_removable_extension): Don't add vector mode
+ extensions if all uses of the source register aren't the same
+ vector extensions.
+
+ 2015-01-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/64563
+ * tree-vrp.c (vrp_evaluate_conditional): Check for VR_RANGE
+ instead of != VR_VARYING.
+
+2015-01-14 Marek Polacek <polacek@redhat.com>
+
+ Backport from mainline
+ 2015-01-13 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/64391
+ * trans-mem.c (get_attrs_for): Return NULL_TREE if X is NULL_TREE.
+
+2015-01-13 Marc Glisse <marc.glisse@inria.fr>
+
+ PR c++/54442
+ * tree.c (build_qualified_type): Use a canonical type for
+ TYPE_CANONICAL.
+
+2015-01-13 Pat Haugen <pthaugen@us.ibm.com>
+
+ Backport from mainline
+ 2014-12-20 Segher Boessenkool <segher@kernel.crashing.org>
+
+ 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 (*boolc<mode>3_internal1 for BOOL_128):
+ Swap BOOL_REGS_OP1 and BOOL_REGS_OP2. Correct arguments to
+ rs6000_split_logical.
+ (*boolc<mode>3_internal2 for TI2): Swap operands[1] and operands[2].
+
+2015-01-13 Renlin Li <renlin.li@arm.com>
+
+ Backport from mainline:
+ 2014-11-19 Renlin Li <renlin.li@arm.com>
+
+ PR target/63424
+ * config/aarch64/aarch64-simd.md (<su><maxmin>v2di3): New.
+
+2015-01-13 Oleg Endo <olegendo@gcc.gnu.org>
+
+ Backport form mainline
+ 2015-01-13 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/64479
+ * rtlanal.c (set_reg_p): Handle SEQUENCE constructs.
+
+2015-01-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/64536
+ * cfgrtl.c (rtl_tidy_fallthru_edge): Handle removal of degenerate
+ tablejumps.
+
+2015-01-09 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Backport from mainline:
+ 2015-01-06 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/64505
+ * config/rs6000/rs6000.c (rs6000_secondary_reload): Return the
+ correct reload handler if -m32 -mpowerpc64 is used.
+
+2015-01-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backport from mainline:
+ 2015-01-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config/rs6000/rtems.h (CPP_OS_RTEMS_SPEC): Define __PPC_CPU_E6500__
+ for -mcpu=e6500.
+ * config/rs6000/t-rtems: Add e6500 multilibs.
+
+2015-01-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backport from mainline:
+ 2015-01-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config/rs6000/t-rtems: Add -mno-spe to soft-float multilib for
+ MPC8540.
+
+2015-01-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backport from mainline:
+ 2015-01-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config/rs6000/t-rtems: Use MULTILIB_REQUIRED instead of
+ MULTILIB_EXCEPTIONS.
+
+2015-01-09 Renlin Li <renlin.li@arm.com>
+
+ Backport from mainline:
+ 2014-08-12 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+
+ PR target/61413
+ * config/arm/arm.h (TARGET_CPU_CPP_BUILTINS): Fix definition
+ of __ARM_SIZEOF_WCHAR_T.
+
+2015-01-08 Christian Bruel <christian.bruel@st.com>
+
+ PR target/64507
+ * config/sh/sh-mem.cc (sh_expand_cmpnstr): Check 0 length.
+
+2015-01-03 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/pa.md (decrement_and_branch_until_zero): Use `Q' constraint
+ instead of `m' constraint. Likewise for unnamed movb comparison
+ patterns using reg_before_reload_operand predicate.
+ * config/pa/predicates.md (reg_before_reload_operand): Tighten
+ predicate to reject register index and LO_SUM DLT memory forms
+ after reload.
+
+2014-12-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline:
+ 2014-12-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/64409
+ * config/i386/i386.c (ix86_function_type_abi): Issue an error
+ when ms_abi attribute is used with x32.
+
+2014-12-27 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/mmx.md (*vec_extractv2sf_1): Do not emit unpckhps.
+ Emit movshdup for SSE3 and shufps otherwise.
+ (*vec_extractv2si_1): Do not emit punpckhdq and unpckhps.
+ Emit pshufd for SSE2 and shufps otherwise.
+
+2014-12-24 Nick Clifton <nickc@redhat.com>
+
+ Backport from mainline:
+ 2014-06-13 Nick Clifton <nickc@redhat.com>
+
+ * config/rx/rx.h (JUMP_ALIGN): Return the log value if user
+ requested alignment is active.
+ (LABEL_ALIGN): Likewise.
+ (LOOP_ALIGN): Likewise.
+
+ 2014-03-25 Nick Clifton <nickc@redhat.com>
+
+ * config/rx/rx.c (rx_print_operand): Allow R operator to accept
+ SImode values.
+
+2014-12-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ Backport from mainline
+ 2014-12-03 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ PR rtl-optimization/64010
+ * reload.c (push_reload): Before reusing a register contained
+ in an operand as input reload register, ensure that it is not
+ used in CALL_INSN_FUNCTION_USAGE.
+
+2014-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/64265
+ * tsan.c (instrument_func_entry): Insert __tsan_func_entry
+ call on edge from entry block to single succ instead
+ of after labels of single succ of entry block.
+
+2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR rtl-optimization/64037
+ * combine.c (setup_incoming_promotions): Pass the argument
+ before any promotions happen to promote_function_mode.
+
+2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2014-12-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/64200
+ * config/i386/i386.c (decide_alg): Don't assert "alg != libcall"
+ for TARGET_INLINE_STRINGOPS_DYNAMICALLY.
+
+2014-12-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2014-12-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/64269
+ * tree-ssa-forwprop.c (simplify_builtin_call): Bail out if
+ len2 or diff are too large.
+
+2014-12-11 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/md.texi (Insn Lengths): Fix description of (pc).
+
2014-12-11 Renlin Li <renlin.li@arm.com>
Backport from mainline
diff --git a/gcc/ChangeLog.ibm b/gcc/ChangeLog.ibm
index 6a599ac53c7..540c91260f5 100644
--- a/gcc/ChangeLog.ibm
+++ b/gcc/ChangeLog.ibm
@@ -1,3 +1,18 @@
+2015-02-05 Peter Bergner <bergner@vnet.ibm.com>
+
+ Merge up to 220457.
+ * REVISION: Update subversion id.
+
+2015-01-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ Merge up to 219552.
+ * REVISION: Update subversion id.
+
+2015-01-12 Peter Bergner <bergner@vnet.ibm.com>
+
+ Merge up to 219498.
+ * REVISION: Update subversion id.
+
2014-12-11 Michael Meissner <meissner@linux.vnet.ibm.com>
Merge up to 218639.
diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index 5cdf66d2a5f..d83c79fcf21 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,3 +1,8 @@
+2015-02-06 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Merge up to ibm/gcc-4_9-branch, subversion id 220484.
+ * REVISION: Update subversion id.
+
2014-12-11 Michael Meissner <meissner@linux.vnet.ibm.com>
Merge up to ibm/gcc-4_9-branch, subversion id 218646.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index f40a662095f..a16793f6a92 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20141211
+20150205
diff --git a/gcc/REVISION b/gcc/REVISION
index 3042fe51c76..62601b616b3 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-[ibm/gcc-4_9-addr merged from gcc-4_9-branch, revision 217046, merged from at8 branch 218646]
+[ibm/gcc-4_9-addr merged from gcc-4_9-branch, revision 220457, merged from at8 branch 220484]
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ea5a7bebf5a..ba21f435ed0 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/64492
+ * gcc-interface/Makefile.in (../stamp-tools): Reinstate dropped code.
+
2014-11-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (push_range_check_info): Replace early test
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 5c36962ef3b..e2cc4a9e0ec 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2510,9 +2510,16 @@ GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) $(LDFLAGS)
# Build directory for the tools. Let's copy the target-dependent
# sources using the same mechanism as for gnatlib. The other sources are
# accessed using the vpath directive below
-# Note: dummy target, stamp-tools is mainly handled by gnattools.
../stamp-tools:
+ -$(RM) tools/*
+ -$(RMDIR) tools
+ -$(MKDIR) tools
+ -(cd tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .)
+ -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
+ $(RM) tools/$(word 1,$(subst <, ,$(PAIR)));\
+ $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \
+ tools/$(word 1,$(subst <, ,$(PAIR)));)
touch ../stamp-tools
# when compiling the tools, the runtime has to be first on the path so that
diff --git a/gcc/alias.c b/gcc/alias.c
index 99add2627d0..9956306ae29 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -383,17 +383,9 @@ get_alias_set_entry (alias_set_type alias_set)
static inline int
mems_in_disjoint_alias_sets_p (const_rtx mem1, const_rtx mem2)
{
-/* Perform a basic sanity check. Namely, that there are no alias sets
- if we're not using strict aliasing. This helps to catch bugs
- whereby someone uses PUT_CODE, but doesn't clear MEM_ALIAS_SET, or
- where a MEM is allocated in some way other than by the use of
- gen_rtx_MEM, and the MEM_ALIAS_SET is not cleared. If we begin to
- use alias sets to indicate that spilled registers cannot alias each
- other, we might need to remove this check. */
- gcc_assert (flag_strict_aliasing
- || (!MEM_ALIAS_SET (mem1) && !MEM_ALIAS_SET (mem2)));
-
- return ! alias_sets_conflict_p (MEM_ALIAS_SET (mem1), MEM_ALIAS_SET (mem2));
+ return (flag_strict_aliasing
+ && ! alias_sets_conflict_p (MEM_ALIAS_SET (mem1),
+ MEM_ALIAS_SET (mem2)));
}
/* Insert the NODE into the splay tree given by DATA. Used by
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index c1f2fc0dc24..701d1cef771 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,12 @@
+2015-01-20 Marek Polacek <polacek@redhat.com>
+
+ Backport from mainline
+ 2014-06-23 Marek Polacek <polacek@redhat.com>
+
+ PR c/61553
+ * c-common.c (get_atomic_generic_size): Don't segfault if the
+ type doesn't have a size.
+
2014-10-30 Release Manager
* GCC 4.9.2 released.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 487fb4ee277..88567018502 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -10402,7 +10402,8 @@ get_atomic_generic_size (location_t loc, tree function,
function);
return 0;
}
- size = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (type)));
+ tree type_size = TYPE_SIZE_UNIT (TREE_TYPE (type));
+ size = type_size ? tree_to_uhwi (type_size) : 0;
if (size != size_0)
{
error_at (loc, "size mismatch in argument %d of %qE", x + 1,
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index deb70eb7251..57be674171d 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,18 @@
+2015-02-01 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2015-01-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/64766
+ * c-typeck.c (store_init_value): Don't overwrite DECL_INITIAL
+ of FUNCTION_DECLs with error_mark_node.
+
+ 2015-01-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/64778
+ * c-typeck.c (convert_arguments): Return -1 if there are
+ error_args, even if we've diagnosed too many arguments.
+
2014-10-30 Release Manager
* GCC 4.9.2 released.
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index d096ad405dc..2a335ae33bf 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3085,7 +3085,7 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
else
error_at (loc, "too many arguments to function %qE", function);
inform_declaration (fundecl);
- return parmnum;
+ return error_args ? -1 : (int) parmnum;
}
if (selector && argnum > 2)
@@ -6249,7 +6249,8 @@ store_init_value (location_t init_loc, tree decl, tree init, tree origtype)
warning (OPT_Wtraditional, "traditional C rejects automatic "
"aggregate initialization");
- DECL_INITIAL (decl) = value;
+ if (value != error_mark_node || TREE_CODE (decl) != FUNCTION_DECL)
+ DECL_INITIAL (decl) = value;
/* ANSI wants warnings about out-of-range constant initializers. */
STRIP_TYPE_NOPS (value);
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 60b0c069f44..f0e31671b8d 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1761,6 +1761,22 @@ rtl_tidy_fallthru_edge (edge e)
&& (any_uncondjump_p (q)
|| single_succ_p (b)))
{
+ rtx label, table;
+
+ if (tablejump_p (q, &label, &table))
+ {
+ /* The label is likely mentioned in some instruction before
+ the tablejump and might not be DCEd, so turn it into
+ a note instead and move before the tablejump that is going to
+ be deleted. */
+ const char *name = LABEL_NAME (label);
+ PUT_CODE (label, NOTE);
+ NOTE_KIND (label) = NOTE_INSN_DELETED_LABEL;
+ NOTE_DELETED_LABEL_NAME (label) = name;
+ reorder_insns (label, label, PREV_INSN (q));
+ delete_insn (table);
+ }
+
#ifdef HAVE_cc0
/* If this was a conditional jump, we need to also delete
the insn that set cc0. */
diff --git a/gcc/combine.c b/gcc/combine.c
index 7c00452056c..adea2c161b6 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1529,8 +1529,8 @@ setup_incoming_promotions (rtx first)
uns3 = TYPE_UNSIGNED (DECL_ARG_TYPE (arg));
/* The mode and signedness of the argument as it is actually passed,
- after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions. */
- mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3,
+ see assign_parm_setup_reg in function.c. */
+ mode3 = promote_function_mode (TREE_TYPE (arg), mode1, &uns3,
TREE_TYPE (cfun->decl), 0);
/* The mode of the register in which the argument is being passed. */
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 30e9f60e92f..7626ed31fd6 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -934,6 +934,41 @@
[(set_attr "type" "neon_minmax<q>")]
)
+(define_expand "<su><maxmin>v2di3"
+ [(parallel [
+ (set (match_operand:V2DI 0 "register_operand" "")
+ (MAXMIN:V2DI (match_operand:V2DI 1 "register_operand" "")
+ (match_operand:V2DI 2 "register_operand" "")))
+ (clobber (reg:CC CC_REGNUM))])]
+ "TARGET_SIMD"
+{
+ enum rtx_code cmp_operator;
+ rtx cmp_fmt;
+
+ switch (<CODE>)
+ {
+ case UMIN:
+ cmp_operator = LTU;
+ break;
+ case SMIN:
+ cmp_operator = LT;
+ break;
+ case UMAX:
+ cmp_operator = GTU;
+ break;
+ case SMAX:
+ cmp_operator = GT;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ cmp_fmt = gen_rtx_fmt_ee (cmp_operator, V2DImode, operands[1], operands[2]);
+ emit_insn (gen_aarch64_vcond_internalv2div2di (operands[0], operands[1],
+ operands[2], cmp_fmt, operands[1], operands[2]));
+ DONE;
+})
+
;; vec_concat gives a new vector with the low elements from operand 1, and
;; the high elements from operand 2. That is to say, given op1 = { a, b }
;; op2 = { c, d }, vec_concat (op1, op2) = { a, b, c, d }.
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index c0f218470c3..23333eb6df5 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -74,8 +74,8 @@ extern char arm_arch_name[];
builtin_define_with_int_value ( \
"__ARM_SIZEOF_MINIMAL_ENUM", \
flag_short_enums ? 1 : 4); \
- builtin_define_with_int_value ( \
- "__ARM_SIZEOF_WCHAR_T", WCHAR_TYPE_SIZE); \
+ builtin_define_type_sizeof ("__ARM_SIZEOF_WCHAR_T", \
+ wchar_type_node); \
if (TARGET_ARM_ARCH_PROFILE) \
builtin_define_with_int_value ( \
"__ARM_ARCH_PROFILE", TARGET_ARM_ARCH_PROFILE); \
diff --git a/gcc/config/i386/avx2intrin.h b/gcc/config/i386/avx2intrin.h
index d04c972ed89..76233b524ff 100644
--- a/gcc/config/i386/avx2intrin.h
+++ b/gcc/config/i386/avx2intrin.h
@@ -648,11 +648,20 @@ _mm256_sign_epi32 (__m256i __X, __m256i __Y)
#ifdef __OPTIMIZE__
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_bslli_epi128 (__m256i __A, const int __N)
+{
+ return (__m256i)__builtin_ia32_pslldqi256 (__A, __N * 8);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_slli_si256 (__m256i __A, const int __N)
{
return (__m256i)__builtin_ia32_pslldqi256 (__A, __N * 8);
}
#else
+#define _mm256_bslli_epi128(A, N) \
+ ((__m256i)__builtin_ia32_pslldqi256 ((__m256i)(A), (int)(N) * 8))
#define _mm256_slli_si256(A, N) \
((__m256i)__builtin_ia32_pslldqi256 ((__m256i)(A), (int)(N) * 8))
#endif
@@ -730,11 +739,20 @@ _mm256_sra_epi32 (__m256i __A, __m128i __B)
#ifdef __OPTIMIZE__
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_bsrli_epi128 (__m256i __A, const int __N)
+{
+ return (__m256i)__builtin_ia32_psrldqi256 (__A, __N * 8);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_srli_si256 (__m256i __A, const int __N)
{
return (__m256i)__builtin_ia32_psrldqi256 (__A, __N * 8);
}
#else
+#define _mm256_bsrli_epi128(A, N) \
+ ((__m256i)__builtin_ia32_psrldqi256 ((__m256i)(A), (int)(N) * 8))
#define _mm256_srli_si256(A, N) \
((__m256i)__builtin_ia32_psrldqi256 ((__m256i)(A), (int)(N) * 8))
#endif
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 722c5469255..992f91f8a57 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -670,7 +670,10 @@ const char *host_detect_local_cpu (int argc, const char **argv)
cpu = "bonnell";
break;
case 0x37:
+ case 0x4a:
case 0x4d:
+ case 0x5a:
+ case 0x5d:
/* Silvermont. */
cpu = "silvermont";
break;
@@ -705,11 +708,22 @@ const char *host_detect_local_cpu (int argc, const char **argv)
cpu = "ivybridge";
break;
case 0x3c:
+ case 0x3f:
case 0x45:
case 0x46:
/* Haswell. */
cpu = "haswell";
break;
+ case 0x3d:
+ case 0x4f:
+ case 0x56:
+ /* Broadwell. */
+ cpu = "broadwell";
+ break;
+ case 0x57:
+ /* Knights Landing. */
+ cpu = "knl";
+ break;
default:
if (arch)
{
diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h
index a2bdf0edade..8eb5cabdee2 100644
--- a/gcc/config/i386/emmintrin.h
+++ b/gcc/config/i386/emmintrin.h
@@ -1161,6 +1161,18 @@ _mm_srai_epi32 (__m128i __A, int __B)
#ifdef __OPTIMIZE__
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_bsrli_si128 (__m128i __A, const int __N)
+{
+ return (__m128i)__builtin_ia32_psrldqi128 (__A, __N * 8);
+}
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_bslli_si128 (__m128i __A, const int __N)
+{
+ return (__m128i)__builtin_ia32_pslldqi128 (__A, __N * 8);
+}
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_srli_si128 (__m128i __A, const int __N)
{
return (__m128i)__builtin_ia32_psrldqi128 (__A, __N * 8);
@@ -1172,6 +1184,10 @@ _mm_slli_si128 (__m128i __A, const int __N)
return (__m128i)__builtin_ia32_pslldqi128 (__A, __N * 8);
}
#else
+#define _mm_bsrli_si128(A, N) \
+ ((__m128i)__builtin_ia32_psrldqi128 ((__m128i)(A), (int)(N) * 8))
+#define _mm_bslli_si128(A, N) \
+ ((__m128i)__builtin_ia32_pslldqi128 ((__m128i)(A), (int)(N) * 8))
#define _mm_srli_si128(A, N) \
((__m128i)__builtin_ia32_psrldqi128 ((__m128i)(A), (int)(N) * 8))
#define _mm_slli_si128(A, N) \
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 81ee71b9f26..2c7c965fbd2 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5974,7 +5974,18 @@ ix86_function_type_abi (const_tree fntype)
if (abi == SYSV_ABI)
{
if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)))
- abi = MS_ABI;
+ {
+ if (TARGET_X32)
+ {
+ static bool warned = false;
+ if (!warned)
+ {
+ error ("X32 does not support ms_abi attribute");
+ warned = true;
+ }
+ }
+ abi = MS_ABI;
+ }
}
else if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)))
abi = SYSV_ABI;
@@ -11065,6 +11076,10 @@ ix86_expand_prologue (void)
if (sp_is_cfa_reg)
m->fs.cfa_offset += UNITS_PER_WORD;
RTX_FRAME_RELATED_P (insn) = 1;
+ add_reg_note (insn, REG_FRAME_RELATED_EXPR,
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ plus_constant (Pmode, stack_pointer_rtx,
+ -UNITS_PER_WORD)));
}
}
@@ -11078,6 +11093,10 @@ ix86_expand_prologue (void)
if (sp_is_cfa_reg)
m->fs.cfa_offset += UNITS_PER_WORD;
RTX_FRAME_RELATED_P (insn) = 1;
+ add_reg_note (insn, REG_FRAME_RELATED_EXPR,
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ plus_constant (Pmode, stack_pointer_rtx,
+ -UNITS_PER_WORD)));
}
}
@@ -23931,9 +23950,10 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
alg = decide_alg (count, max / 2, min_size, max_size, memset,
zero_memset, dynamic_check, noalign);
gcc_assert (*dynamic_check == -1);
- gcc_assert (alg != libcall);
if (TARGET_INLINE_STRINGOPS_DYNAMICALLY)
*dynamic_check = max;
+ else
+ gcc_assert (alg != libcall);
return alg;
}
return (alg_usable_p (algs->unknown_size, memset)
@@ -32347,7 +32367,8 @@ fold_builtin_cpu (tree fndecl, tree *args)
M_AMDFAM15H_BDVER3,
M_AMDFAM15H_BDVER4,
M_INTEL_COREI7_IVYBRIDGE,
- M_INTEL_COREI7_HASWELL
+ M_INTEL_COREI7_HASWELL,
+ M_INTEL_COREI7_BROADWELL
};
static struct _arch_names_table
@@ -32368,6 +32389,7 @@ fold_builtin_cpu (tree fndecl, tree *args)
{"sandybridge", M_INTEL_COREI7_SANDYBRIDGE},
{"ivybridge", M_INTEL_COREI7_IVYBRIDGE},
{"haswell", M_INTEL_COREI7_HASWELL},
+ {"broadwell", M_INTEL_COREI7_BROADWELL},
{"bonnell", M_INTEL_BONNELL},
{"silvermont", M_INTEL_SILVERMONT},
{"amdfam10h", M_AMDFAM10H},
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index cd7eadb55d9..2f76305d23e 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2110,7 +2110,8 @@
(const_string "ssemov")
(eq_attr "alternative" "19,20")
(const_string "ssecvt")
- (match_operand 1 "pic_32bit_operand")
+ (and (match_operand 0 "register_operand")
+ (match_operand 1 "pic_32bit_operand"))
(const_string "lea")
]
(const_string "imov")))
@@ -2254,7 +2255,8 @@
(const_string "sselog1")
(eq_attr "alternative" "7,8,9,10,12")
(const_string "ssemov")
- (match_operand 1 "pic_32bit_operand")
+ (and (match_operand 0 "register_operand")
+ (match_operand 1 "pic_32bit_operand"))
(const_string "lea")
]
(const_string "imov")))
@@ -17621,8 +17623,8 @@
(symbol_ref "memory_address_length (operands[0], false)"))
(set_attr "memory" "none")])
-(define_insn "*prefetch_prefetchwt1_<mode>"
- [(prefetch (match_operand:P 0 "address_operand" "p")
+(define_insn "*prefetch_prefetchwt1"
+ [(prefetch (match_operand 0 "address_operand" "p")
(const_int 1)
(const_int 2))]
"TARGET_PREFETCHWT1"
diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index 214acde23c4..a7d2a7eec12 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -600,20 +600,25 @@
;; Avoid combining registers from different units in a single alternative,
;; see comment above inline_secondary_memory_needed function in i386.c
(define_insn "*vec_extractv2sf_1"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=y,x,y,x,f,r")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=y,x,x,y,x,f,r")
(vec_select:SF
- (match_operand:V2SF 1 "nonimmediate_operand" " 0,0,o,o,o,o")
+ (match_operand:V2SF 1 "nonimmediate_operand" " 0,x,x,o,o,o,o")
(parallel [(const_int 1)])))]
"TARGET_MMX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
"@
punpckhdq\t%0, %0
- unpckhps\t%0, %0
+ %vmovshdup\t{%1, %0|%0, %1}
+ shufps\t{$0xe5, %1, %0|%0, %1, 0xe5}
#
#
#
#"
- [(set_attr "type" "mmxcvt,sselog1,mmxmov,ssemov,fmov,imov")
- (set_attr "mode" "DI,V4SF,SF,SF,SF,SF")])
+ [(set_attr "isa" "*,sse3,noavx,*,*,*,*")
+ (set_attr "type" "mmxcvt,sse,sseshuf1,mmxmov,ssemov,fmov,imov")
+ (set_attr "length_immediate" "*,*,1,*,*,*,*")
+ (set_attr "prefix_rep" "*,1,*,*,*,*,*")
+ (set_attr "prefix" "orig,maybe_vex,orig,orig,orig,orig,orig")
+ (set_attr "mode" "DI,V4SF,V4SF,SF,SF,SF,SF")])
(define_split
[(set (match_operand:SF 0 "register_operand")
@@ -1288,26 +1293,23 @@
;; Avoid combining registers from different units in a single alternative,
;; see comment above inline_secondary_memory_needed function in i386.c
(define_insn "*vec_extractv2si_1"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=y,x,x,x,y,x,r")
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=y,x,x,y,x,r")
(vec_select:SI
- (match_operand:V2SI 1 "nonimmediate_operand" " 0,0,x,0,o,o,o")
+ (match_operand:V2SI 1 "nonimmediate_operand" " 0,x,x,o,o,o")
(parallel [(const_int 1)])))]
"TARGET_MMX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
"@
punpckhdq\t%0, %0
- punpckhdq\t%0, %0
- pshufd\t{$85, %1, %0|%0, %1, 85}
- unpckhps\t%0, %0
+ %vpshufd\t{$0xe5, %1, %0|%0, %1, 0xe5}
+ shufps\t{$0xe5, %1, %0|%0, %1, 0xe5}
#
#
#"
- [(set (attr "isa")
- (if_then_else (eq_attr "alternative" "1,2")
- (const_string "sse2")
- (const_string "*")))
- (set_attr "type" "mmxcvt,sselog1,sselog1,sselog1,mmxmov,ssemov,imov")
- (set_attr "length_immediate" "*,*,1,*,*,*,*")
- (set_attr "mode" "DI,TI,TI,V4SF,SI,SI,SI")])
+ [(set_attr "isa" "*,sse2,noavx,*,*,*")
+ (set_attr "type" "mmxcvt,sseshuf1,sseshuf1,mmxmov,ssemov,imov")
+ (set_attr "length_immediate" "*,1,1,*,*,*")
+ (set_attr "prefix" "orig,maybe_vex,orig,orig,orig,orig")
+ (set_attr "mode" "DI,TI,V4SF,SI,SI,SI")])
(define_split
[(set (match_operand:SI 0 "register_operand")
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 2ef1384246e..4ba2e6fbbca 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -968,11 +968,16 @@
;; a segment override. Defined as a special predicate to allow
;; mode-less const_int operands pass to address_operand.
(define_special_predicate "address_no_seg_operand"
- (match_operand 0 "address_operand")
+ (match_test "address_operand (op, VOIDmode)")
{
struct ix86_address parts;
int ok;
+ if (!CONST_INT_P (op)
+ && mode != VOIDmode
+ && GET_MODE (op) != mode)
+ return false;
+
ok = ix86_decompose_address (op, &parts);
gcc_assert (ok);
return parts.seg == SEG_DEFAULT;
@@ -981,7 +986,7 @@
;; Return true if op if a valid base register, displacement or
;; sum of base register and displacement for VSIB addressing.
(define_predicate "vsib_address_operand"
- (match_operand 0 "address_operand")
+ (match_test "address_operand (op, VOIDmode)")
{
struct ix86_address parts;
int ok;
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index c700425dc2c..5a62572b0cd 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -10303,7 +10303,7 @@
movss\t{%2, %0|%0, %2}
movss\t{%2, %0|%0, %2}
vmovss\t{%2, %1, %0|%0, %1, %2}"
- [(set_attr "isa" "sse2,*,noavx,noavx,avx")
+ [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
(set_attr "type" "ssemov")
(set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,vex")
(set_attr "mode" "TI,TI,V4SF,SF,SF")])
diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index cdd2e6bc98b..047b615bab9 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -2135,6 +2135,18 @@ nios2_output_dwarf_dtprel (FILE *file, int size, rtx x)
fprintf (file, ")");
}
+/* Implemet TARGET_ASM_FILE_END. */
+
+static void
+nios2_asm_file_end (void)
+{
+ /* The Nios II Linux stack is mapped non-executable by default, so add a
+ .note.GNU-stack section for switching to executable stacks only when
+ trampolines are generated. */
+ if (TARGET_LINUX_ABI && trampolines_created)
+ file_end_indicate_exec_stack ();
+}
+
/* Implement TARGET_ASM_FUNCTION_PROLOGUE. */
static void
nios2_asm_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
@@ -3313,6 +3325,9 @@ nios2_merge_decl_attributes (tree olddecl, tree newdecl)
#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA nios2_output_addr_const_extra
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END nios2_asm_file_end
+
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE nios2_option_override
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index f4f966a6c3e..43b909e35ba 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -8935,14 +8935,14 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
;; strength reduction is used. It is actually created when the instruction
;; combination phase combines the special loop test. Since this insn
;; is both a jump insn and has an output, it must deal with its own
-;; reloads, hence the `m' constraints. The `!' constraints direct reload
+;; reloads, hence the `Q' constraints. The `!' constraints direct reload
;; to not choose the register alternatives in the event a reload is needed.
(define_insn "decrement_and_branch_until_zero"
[(set (pc)
(if_then_else
(match_operator 2 "comparison_operator"
[(plus:SI
- (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*m")
+ (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*Q")
(match_operand:SI 1 "int5_operand" "L,L,L"))
(const_int 0)])
(label_ref (match_operand 3 "" ""))
@@ -9031,7 +9031,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
[(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
(label_ref (match_operand 3 "" ""))
(pc)))
- (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
+ (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*Q,!*q")
(match_dup 1))]
""
"* return pa_output_movb (operands, insn, which_alternative, 0); "
@@ -9103,7 +9103,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
[(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
(pc)
(label_ref (match_operand 3 "" ""))))
- (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
+ (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*Q,!*q")
(match_dup 1))]
""
"* return pa_output_movb (operands, insn, which_alternative, 1); "
diff --git a/gcc/config/pa/predicates.md b/gcc/config/pa/predicates.md
index 8dcfce0e92b..405cf7f63c3 100644
--- a/gcc/config/pa/predicates.md
+++ b/gcc/config/pa/predicates.md
@@ -528,20 +528,29 @@
;; This predicate is used for branch patterns that internally handle
;; register reloading. We need to accept non-symbolic memory operands
;; after reload to ensure that the pattern is still valid if reload
-;; didn't find a hard register for the operand.
+;; didn't find a hard register for the operand. We also reject index
+;; and lo_sum DLT address as these are invalid for move destinations.
(define_predicate "reg_before_reload_operand"
(match_code "reg,mem")
{
+ rtx op0;
+
if (register_operand (op, mode))
return true;
- if (reload_completed
- && memory_operand (op, mode)
- && !symbolic_memory_operand (op, mode))
- return true;
+ if (!reload_in_progress && !reload_completed)
+ return false;
- return false;
+ if (! MEM_P (op))
+ return false;
+
+ op0 = XEXP (op, 0);
+
+ return (memory_address_p (mode, op0)
+ && !IS_INDEX_ADDR_P (op0)
+ && !IS_LO_SUM_DLT_ADDR_P (op0)
+ && !symbolic_memory_operand (op, mode));
})
;; True iff OP is a register or const_0 operand for MODE.
diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def
index c1a7649c3fb..17f5a571383 100644
--- a/gcc/config/rs6000/rs6000-cpus.def
+++ b/gcc/config/rs6000/rs6000-cpus.def
@@ -93,6 +93,7 @@
| OPTION_MASK_PPC_GFXOPT \
| OPTION_MASK_PPC_GPOPT \
| OPTION_MASK_QUAD_MEMORY \
+ | OPTION_MASK_QUAD_MEMORY_ATOMIC \
| OPTION_MASK_RECIP_PRECISION \
| OPTION_MASK_SOFT_FLOAT \
| OPTION_MASK_STRICT_ALIGN_OPTIONAL \
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 15ed0b921f1..b5b18411f85 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -17013,10 +17013,13 @@ rs6000_secondary_reload (bool in_p,
: (offset + 0x8000 < 0x10000 - extra /* legitimate_address_p */
&& (offset & 3) != 0))
{
+ /* -m32 -mpowerpc64 needs to use a 32-bit scratch register. */
if (in_p)
- sri->icode = CODE_FOR_reload_di_load;
+ sri->icode = ((TARGET_32BIT) ? CODE_FOR_reload_si_load
+ : CODE_FOR_reload_di_load);
else
- sri->icode = CODE_FOR_reload_di_store;
+ sri->icode = ((TARGET_32BIT) ? CODE_FOR_reload_si_store
+ : CODE_FOR_reload_di_store);
sri->extra_cost = 2;
ret = NO_REGS;
done_p = true;
@@ -21041,7 +21044,7 @@ compute_vrsave_mask (void)
them in again. More importantly, the mask we compute here is
used to generate CLOBBERs in the set_vrsave insn, and we do not
wish the argument registers to die. */
- for (i = crtl->args.info.vregno - 1; i >= ALTIVEC_ARG_MIN_REG; --i)
+ for (i = ALTIVEC_ARG_MIN_REG; i < (unsigned) crtl->args.info.vregno; i++)
mask &= ~ALTIVEC_REG_BIT (i);
/* Similarly, remove the return value from the set. */
@@ -21450,6 +21453,9 @@ rs6000_savres_strategy (rs6000_stack_t *info,
static rs6000_stack_t *
rs6000_stack_info (void)
{
+ /* We should never be called for thunks, we are not set up for that. */
+ gcc_assert (!cfun->is_thunk);
+
rs6000_stack_t *info_ptr = &stack_info;
int reg_size = TARGET_32BIT ? 4 : 8;
int ehrd_size;
@@ -24171,11 +24177,10 @@ rs6000_emit_prologue (void)
}
}
-/* Write function prologue. */
+/* Output .extern statements for the save/restore routines we use. */
static void
-rs6000_output_function_prologue (FILE *file,
- HOST_WIDE_INT size ATTRIBUTE_UNUSED)
+rs6000_output_savres_externs (FILE *file)
{
rs6000_stack_t *info = rs6000_stack_info ();
@@ -24207,6 +24212,16 @@ rs6000_output_function_prologue (FILE *file,
fprintf (file, "\t.extern %s\n", name);
}
}
+}
+
+/* Write function prologue. */
+
+static void
+rs6000_output_function_prologue (FILE *file,
+ HOST_WIDE_INT size ATTRIBUTE_UNUSED)
+{
+ if (!cfun->is_thunk)
+ rs6000_output_savres_externs (file);
/* ELFv2 ABI r2 setup code and local entry point. This must follow
immediately after the global entry point label. */
@@ -32903,6 +32918,14 @@ 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)
+ {
+ rtx temp = op1;
+ op1 = op2;
+ op2 = temp;
+ }
+
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 5d1d4c82629..fff13f06000 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -8627,8 +8627,8 @@
[(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], <MODE>mode))
@@ -8643,7 +8643,7 @@
&& reload_completed && int_reg_operand (operands[0], <MODE>mode)"
[(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,
NULL_RTX);
DONE;
}
@@ -8665,14 +8665,14 @@
[(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,
NULL_RTX);
DONE;
}
diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h
index 2402d53364e..04648803499 100644
--- a/gcc/config/rs6000/rtems.h
+++ b/gcc/config/rs6000/rtems.h
@@ -52,7 +52,8 @@
%{mcpu=750: %{!Dppc*: %{!Dmpc*: -Dmpc750} } } \
%{mcpu=821: %{!Dppc*: %{!Dmpc*: -Dmpc821} } } \
%{mcpu=860: %{!Dppc*: %{!Dmpc*: -Dmpc860} } } \
-%{mcpu=8540: %{!Dppc*: %{!Dmpc*: -Dppc8540} } }"
+%{mcpu=8540: %{!Dppc*: %{!Dmpc*: -Dppc8540} } } \
+%{mcpu=e6500: -D__PPC_CPU_E6500__}"
#undef SUBSUBTARGET_EXTRA_SPECS
#define SUBSUBTARGET_EXTRA_SPECS \
diff --git a/gcc/config/rs6000/t-rtems b/gcc/config/rs6000/t-rtems
index 426f75ac564..eadda0d20fe 100644
--- a/gcc/config/rs6000/t-rtems
+++ b/gcc/config/rs6000/t-rtems
@@ -18,16 +18,24 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-MULTILIB_OPTIONS = \
-mcpu=403/mcpu=505/mcpu=603e/mcpu=604/mcpu=860/mcpu=7400/mcpu=8540 \
-msoft-float/mfloat-gprs=double
+MULTILIB_OPTIONS =
+MULTILIB_DIRNAMES =
+MULTILIB_MATCHES =
+MULTILIB_EXCEPTIONS =
+MULTILIB_REQUIRED =
+
+MULTILIB_OPTIONS += mcpu=403/mcpu=505/mcpu=603e/mcpu=604/mcpu=860/mcpu=7400/mcpu=8540/mcpu=e6500
+MULTILIB_DIRNAMES += m403 m505 m603e m604 m860 m7400 m8540 me6500
+
+MULTILIB_OPTIONS += m32
+MULTILIB_DIRNAMES += m32
-MULTILIB_DIRNAMES = \
-m403 m505 m603e m604 m860 m7400 m8540 \
-nof gprsdouble
+MULTILIB_OPTIONS += msoft-float/mfloat-gprs=double
+MULTILIB_DIRNAMES += nof gprsdouble
+
+MULTILIB_OPTIONS += mno-spe/mno-altivec
+MULTILIB_DIRNAMES += nospe noaltivec
-# MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT}
-MULTILIB_MATCHES =
MULTILIB_MATCHES += ${MULTILIB_MATCHES_ENDIAN}
MULTILIB_MATCHES += ${MULTILIB_MATCHES_SYSV}
# Map 405 to 403
@@ -52,37 +60,20 @@ MULTILIB_MATCHES += mcpu?8540=mcpu?8548
# (mfloat-gprs=single is implicit default)
MULTILIB_MATCHES += mcpu?8540=mcpu?8540/mfloat-gprs?single
-# Soft-float only, default implies msoft-float
-# NOTE: Must match with MULTILIB_MATCHES_FLOAT and MULTILIB_MATCHES
-MULTILIB_SOFTFLOAT_ONLY = \
-*mcpu=401/*msoft-float* \
-*mcpu=403/*msoft-float* \
-*mcpu=405/*msoft-float* \
-*mcpu=801/*msoft-float* \
-*mcpu=821/*msoft-float* \
-*mcpu=823/*msoft-float* \
-*mcpu=860/*msoft-float*
-
-# Hard-float only, take out msoft-float
-MULTILIB_HARDFLOAT_ONLY = \
-*mcpu=505/*msoft-float*
-
-# Targets which do not support gprs
-MULTILIB_NOGPRS = \
-mfloat-gprs=* \
-*mcpu=403/*mfloat-gprs=* \
-*mcpu=505/*mfloat-gprs=* \
-*mcpu=603e/*mfloat-gprs=* \
-*mcpu=604/*mfloat-gprs=* \
-*mcpu=860/*mfloat-gprs=* \
-*mcpu=7400/*mfloat-gprs=*
-
-MULTILIB_EXCEPTIONS =
-
-# Disallow -Dppc and -Dmpc without other options
-MULTILIB_EXCEPTIONS += Dppc* Dmpc*
+# Enumeration of multilibs
-MULTILIB_EXCEPTIONS += \
-${MULTILIB_SOFTFLOAT_ONLY} \
-${MULTILIB_HARDFLOAT_ONLY} \
-${MULTILIB_NOGPRS}
+MULTILIB_REQUIRED += msoft-float
+MULTILIB_REQUIRED += mcpu=403
+MULTILIB_REQUIRED += mcpu=505
+MULTILIB_REQUIRED += mcpu=603e
+MULTILIB_REQUIRED += mcpu=603e/msoft-float
+MULTILIB_REQUIRED += mcpu=604
+MULTILIB_REQUIRED += mcpu=604/msoft-float
+MULTILIB_REQUIRED += mcpu=7400
+MULTILIB_REQUIRED += mcpu=7400/msoft-float
+MULTILIB_REQUIRED += mcpu=8540
+MULTILIB_REQUIRED += mcpu=8540/msoft-float/mno-spe
+MULTILIB_REQUIRED += mcpu=8540/mfloat-gprs=double
+MULTILIB_REQUIRED += mcpu=860
+MULTILIB_REQUIRED += mcpu=e6500/m32
+MULTILIB_REQUIRED += mcpu=e6500/m32/msoft-float/mno-altivec
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index 4242c1a9717..11a825cfa8a 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -733,7 +733,7 @@ rx_print_operand (FILE * file, rtx op, int letter)
break;
case 'R':
- gcc_assert (GET_MODE_SIZE (GET_MODE (op)) < 4);
+ gcc_assert (GET_MODE_SIZE (GET_MODE (op)) <= 4);
unsigned_load = true;
/* Fall through. */
case 'Q':
diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h
index d99b19ad202..06a0ae850ca 100644
--- a/gcc/config/rx/rx.h
+++ b/gcc/config/rx/rx.h
@@ -433,9 +433,9 @@ typedef unsigned int CUMULATIVE_ARGS;
/* Compute the alignment needed for label X in various situations.
If the user has specified an alignment then honour that, otherwise
use rx_align_for_label. */
-#define JUMP_ALIGN(x) (align_jumps ? align_jumps : rx_align_for_label (x, 0))
-#define LABEL_ALIGN(x) (align_labels ? align_labels : rx_align_for_label (x, 3))
-#define LOOP_ALIGN(x) (align_loops ? align_loops : rx_align_for_label (x, 2))
+#define JUMP_ALIGN(x) (align_jumps > 1 ? align_jumps_log : rx_align_for_label (x, 0))
+#define LABEL_ALIGN(x) (align_labels > 1 ? align_labels_log : rx_align_for_label (x, 3))
+#define LOOP_ALIGN(x) (align_loops > 1 ? align_loops_log : rx_align_for_label (x, 2))
#define LABEL_ALIGN_AFTER_BARRIER(x) rx_align_for_label (x, 0)
#define ASM_OUTPUT_MAX_SKIP_ALIGN(STREAM, LOG, MAX_SKIP) \
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 866de858cf0..1a879cf6ef9 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -2384,16 +2384,29 @@ s390_float_const_zero_p (rtx value)
/* Implement TARGET_REGISTER_MOVE_COST. */
static int
-s390_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+s390_register_move_cost (enum machine_mode mode,
reg_class_t from, reg_class_t to)
{
- /* On s390, copy between fprs and gprs is expensive as long as no
- ldgr/lgdr can be used. */
- if ((!TARGET_Z10 || GET_MODE_SIZE (mode) != 8)
- && ((reg_classes_intersect_p (from, GENERAL_REGS)
- && reg_classes_intersect_p (to, FP_REGS))
- || (reg_classes_intersect_p (from, FP_REGS)
- && reg_classes_intersect_p (to, GENERAL_REGS))))
+ /* On s390, copy between fprs and gprs is expensive. */
+
+ /* It becomes somewhat faster having ldgr/lgdr. */
+ if (TARGET_Z10 && GET_MODE_SIZE (mode) == 8)
+ {
+ /* ldgr is single cycle. */
+ if (reg_classes_intersect_p (from, GENERAL_REGS)
+ && reg_classes_intersect_p (to, FP_REGS))
+ return 1;
+ /* lgdr needs 3 cycles. */
+ if (reg_classes_intersect_p (to, GENERAL_REGS)
+ && reg_classes_intersect_p (from, FP_REGS))
+ return 3;
+ }
+
+ /* Otherwise copying is done via memory. */
+ if ((reg_classes_intersect_p (from, GENERAL_REGS)
+ && reg_classes_intersect_p (to, FP_REGS))
+ || (reg_classes_intersect_p (from, FP_REGS)
+ && reg_classes_intersect_p (to, GENERAL_REGS)))
return 10;
return 1;
@@ -2406,7 +2419,7 @@ s390_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
reg_class_t rclass ATTRIBUTE_UNUSED,
bool in ATTRIBUTE_UNUSED)
{
- return 1;
+ return 2;
}
/* Compute a (partial) cost for rtx X. Return true if the complete
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index b17c1fac875..10d7a5a6d74 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -460,7 +460,7 @@
;; This iterator and attribute allow to combine most atomic operations.
(define_code_iterator ATOMIC [and ior xor plus minus mult])
(define_code_iterator ATOMIC_Z196 [and ior xor plus])
-(define_code_attr atomic [(and "and") (ior "ior") (xor "xor")
+(define_code_attr atomic [(and "and") (ior "or") (xor "xor")
(plus "add") (minus "sub") (mult "nand")])
(define_code_attr noxa [(and "n") (ior "o") (xor "x") (plus "a")])
diff --git a/gcc/config/sh/sh-mem.cc b/gcc/config/sh/sh-mem.cc
index 45af23acb48..e5ef165cf95 100644
--- a/gcc/config/sh/sh-mem.cc
+++ b/gcc/config/sh/sh-mem.cc
@@ -1,5 +1,5 @@
/* Helper routines for memory move and comparison insns.
- Copyright (C) 2013-2014 Free Software Foundation, Inc.
+ Copyright (C) 2013-2015 Free Software Foundation, Inc.
This file is part of GCC.
@@ -226,7 +226,7 @@ sh_expand_cmpstr (rtx *operands)
emit_move_insn (tmp3, addr2);
emit_move_insn (s2_addr, plus_constant (Pmode, s2_addr, 4));
- /*start long loop. */
+ /* start long loop. */
emit_label (L_loop_long);
emit_move_insn (tmp2, tmp3);
@@ -335,7 +335,7 @@ sh_expand_cmpnstr (rtx *operands)
rtx len = force_reg (SImode, operands[3]);
int constp = CONST_INT_P (operands[3]);
- /* Loop on a register count. */
+ /* Loop on a register count. */
if (constp)
{
rtx tmp0 = gen_reg_rtx (SImode);
@@ -364,7 +364,7 @@ sh_expand_cmpnstr (rtx *operands)
add_int_reg_note (jump, REG_BR_PROB, prob_likely);
}
- /* word count. Do we have iterations ? */
+ /* word count. Do we have iterations ? */
emit_insn (gen_lshrsi3 (lenw, len, GEN_INT (2)));
/*start long loop. */
@@ -407,6 +407,7 @@ sh_expand_cmpnstr (rtx *operands)
/* end loop. Reached max iterations. */
if (! sbytes)
{
+ emit_insn (gen_subsi3 (operands[0], tmp1, tmp2));
jump = emit_jump_insn (gen_jump_compact (L_return));
emit_barrier_after (jump);
}
@@ -482,6 +483,13 @@ sh_expand_cmpnstr (rtx *operands)
jump = emit_jump_insn (gen_jump_compact( L_end_loop_byte));
emit_barrier_after (jump);
}
+ else
+ {
+ emit_insn (gen_cmpeqsi_t (len, const0_rtx));
+ emit_move_insn (operands[0], const0_rtx);
+ jump = emit_jump_insn (gen_branch_true (L_return));
+ add_int_reg_note (jump, REG_BR_PROB, prob_unlikely);
+ }
addr1 = adjust_automodify_address (addr1, QImode, s1_addr, 0);
addr2 = adjust_automodify_address (addr2, QImode, s2_addr, 0);
@@ -522,14 +530,14 @@ sh_expand_cmpnstr (rtx *operands)
emit_insn (gen_zero_extendqisi2 (tmp2, gen_lowpart (QImode, tmp2)));
emit_insn (gen_zero_extendqisi2 (tmp1, gen_lowpart (QImode, tmp1)));
- emit_label (L_return);
-
emit_insn (gen_subsi3 (operands[0], tmp1, tmp2));
+ emit_label (L_return);
+
return true;
}
-/* Emit code to perform a strlen
+/* Emit code to perform a strlen.
OPERANDS[0] is the destination.
OPERANDS[1] is the string.
@@ -568,7 +576,7 @@ sh_expand_strlen (rtx *operands)
addr1 = adjust_automodify_address (addr1, SImode, current_addr, 0);
- /*start long loop. */
+ /* start long loop. */
emit_label (L_loop_long);
/* tmp1 is aligned, OK to load. */
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2dfc5d379a5..83bf91d54bc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,58 @@
+2015-02-04 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR c++/64901
+ * decl.c (duplicate_decls): Also duplicate DECL_FINAL_P and
+ DECL_OVERRIDE_P.
+
+2015-01-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/64521
+ * repo.c (repo_emit_p): It's OK for a clone to be extern at this
+ point.
+
+2015-01-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/64514
+ * pt.c (coerce_template_parameter_pack): Return NULL for a
+ zero-length fixed parameter pack with a pack expansion arg.
+
+2015-01-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/64487
+ * semantics.c (finish_offsetof): Handle templates here.
+ * parser.c (cp_parser_builtin_offsetof): Not here.
+
+ PR c++/64352
+ * pt.c (tsubst_copy_and_build): Pass complain to mark_used.
+
+ PR c++/64251
+ * decl2.c (mark_used): Don't mark if in_template_function.
+
+ PR c++/64297
+ * typeck.c (apply_memfn_quals): Correct wrong TYPE_CANONICAL.
+
+ PR c++/64029
+ * decl.c (grok_reference_init): Complete array type.
+
+ PR c++/63657
+ PR c++/38958
+ * call.c (set_up_extended_ref_temp): Set TREE_USED on the reference
+ if the temporary has a non-trivial destructor.
+ * decl.c (poplevel): Don't look through references.
+
+ PR c++/63658
+ * pt.c (convert_nontype_argument): Call convert_from_reference.
+ (check_instantiated_arg): Don't be confused by reference refs.
+ (unify): Look through reference refs on the arg, too.
+ * mangle.c (write_template_arg): Look through reference refs.
+
+2014-12-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/60955
+ * pt.c (struct warning_sentinel): Move it...
+ * cp-tree.h: ... here.
+ * semantics.c (force_paren_expr): Use it.
+
2014-11-21 Jason Merrill <jason@redhat.com>
PR c++/63849
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 709b6be0e3d..46bb880a878 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -9393,6 +9393,10 @@ set_up_extended_ref_temp (tree decl, tree expr, vec<tree, va_gc> **cleanups,
/* Check whether the dtor is callable. */
cxx_maybe_build_cleanup (var, tf_warning_or_error);
}
+ /* Avoid -Wunused-variable warning (c++/38958). */
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
+ && TREE_CODE (decl) == VAR_DECL)
+ TREE_USED (decl) = DECL_READ_P (decl) = true;
*initp = init;
return var;
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d149810bc42..163ee87a1ed 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1098,6 +1098,18 @@ struct GTY(()) saved_scope {
#define processing_specialization scope_chain->x_processing_specialization
#define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
+/* RAII sentinel to disable certain warnings during template substitution
+ and elsewhere. */
+
+struct warning_sentinel
+{
+ int &flag;
+ int val;
+ warning_sentinel(int& flag, bool suppress=true)
+ : flag(flag), val(flag) { if (suppress) flag = 0; }
+ ~warning_sentinel() { flag = val; }
+};
+
/* The cached class binding level, from the most recently exited
class, or NULL if none. */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1f3a552f94f..4cc386e117f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -630,8 +630,7 @@ poplevel (int keep, int reverse, int functionbody)
push_local_binding where the list of decls returned by
getdecls is built. */
decl = TREE_CODE (d) == TREE_LIST ? TREE_VALUE (d) : d;
- // See through references for improved -Wunused-variable (PR 38958).
- tree type = non_reference (TREE_TYPE (decl));
+ tree type = TREE_TYPE (decl);
if (VAR_P (decl)
&& (! TREE_USED (decl) || !DECL_READ_P (decl))
&& ! DECL_IN_SYSTEM_HEADER (decl)
@@ -1789,6 +1788,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
DECL_PURE_VIRTUAL_P (newdecl) |= DECL_PURE_VIRTUAL_P (olddecl);
DECL_VIRTUAL_P (newdecl) |= DECL_VIRTUAL_P (olddecl);
DECL_INVALID_OVERRIDER_P (newdecl) |= DECL_INVALID_OVERRIDER_P (olddecl);
+ DECL_FINAL_P (newdecl) |= DECL_FINAL_P (olddecl);
+ DECL_OVERRIDE_P (newdecl) |= DECL_OVERRIDE_P (olddecl);
DECL_THIS_STATIC (newdecl) |= DECL_THIS_STATIC (olddecl);
if (DECL_OVERLOADED_OPERATOR_P (olddecl) != ERROR_MARK)
SET_OVERLOADED_OPERATOR_CODE
@@ -4792,11 +4793,26 @@ grok_reference_init (tree decl, tree type, tree init, int flags)
init = build_x_compound_expr_from_list (init, ELK_INIT,
tf_warning_or_error);
- if (TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE
+ tree ttype = TREE_TYPE (type);
+ if (TREE_CODE (ttype) != ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE)
/* Note: default conversion is only called in very special cases. */
init = decay_conversion (init, tf_warning_or_error);
+ /* check_initializer handles this for non-reference variables, but for
+ references we need to do it here or the initializer will get the
+ incomplete array type and confuse later calls to
+ cp_complete_array_type. */
+ if (TREE_CODE (ttype) == ARRAY_TYPE
+ && TYPE_DOMAIN (ttype) == NULL_TREE
+ && (BRACE_ENCLOSED_INITIALIZER_P (init)
+ || TREE_CODE (init) == STRING_CST))
+ {
+ cp_complete_array_type (&ttype, init, false);
+ if (ttype != TREE_TYPE (type))
+ type = cp_build_reference_type (ttype, TYPE_REF_IS_RVALUE (type));
+ }
+
/* Convert INIT to the reference type TYPE. This may involve the
creation of a temporary, whose lifetime must be the same as that
of the reference. If so, a DECL_EXPR for the temporary will be
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index a2626d4c77b..78c1124e277 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4914,7 +4914,7 @@ mark_used (tree decl, tsubst_flags_t complain)
--function_depth;
}
- if (processing_template_decl)
+ if (processing_template_decl || in_template_function ())
return true;
/* Check this too in case we're within fold_non_dependent_expr. */
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index d944d5e0f3a..c9b1c5f8eb0 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3111,6 +3111,8 @@ write_template_arg (tree node)
}
}
+ if (REFERENCE_REF_P (node))
+ node = TREE_OPERAND (node, 0);
if (TREE_CODE (node) == NOP_EXPR
&& TREE_CODE (TREE_TYPE (node)) == REFERENCE_TYPE)
{
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7893235afba..93f94d260c1 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -8479,12 +8479,7 @@ cp_parser_builtin_offsetof (cp_parser *parser)
}
success:
- /* If we're processing a template, we can't finish the semantics yet.
- Otherwise we can fold the entire expression now. */
- if (processing_template_decl)
- expr = build1 (OFFSETOF_EXPR, size_type_node, expr);
- else
- expr = finish_offsetof (expr);
+ expr = finish_offsetof (expr);
failure:
parser->integral_constant_expression_p = save_ice_p;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c0b8b9238b5..2abfc70ef6d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6084,7 +6084,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
right type? */
gcc_assert (same_type_ignoring_top_level_qualifiers_p
(type, TREE_TYPE (expr)));
- return expr;
+ return convert_from_reference (expr);
}
/* Subroutine of coerce_template_template_parms, which returns 1 if
@@ -6671,6 +6671,9 @@ coerce_template_parameter_pack (tree parms,
if (invalid_nontype_parm_type_p (t, complain))
return error_mark_node;
}
+ /* We don't know how many args we have yet, just
+ use the unconverted ones for now. */
+ return NULL_TREE;
}
packed_args = make_tree_vec (TREE_VEC_LENGTH (packed_parms));
@@ -14151,16 +14154,6 @@ tsubst_non_call_postfix_expression (tree t, tree args,
return t;
}
-/* Sentinel to disable certain warnings during template substitution. */
-
-struct warning_sentinel {
- int &flag;
- int val;
- warning_sentinel(int& flag, bool suppress=true)
- : flag(flag), val(flag) { if (suppress) flag = 0; }
- ~warning_sentinel() { flag = val; }
-};
-
/* Like tsubst but deals with expressions and performs semantic
analysis. FUNCTION_P is true if T is the "F" in "F (ARGS)". */
@@ -14828,7 +14821,7 @@ tsubst_copy_and_build (tree t,
/* Remember that there was a reference to this entity. */
if (DECL_P (function))
- mark_used (function);
+ mark_used (function, complain);
/* Put back tf_decltype for the actual call. */
complain |= decltype_flag;
@@ -15446,6 +15439,7 @@ check_instantiated_arg (tree tmpl, tree t, tsubst_flags_t complain)
constant. */
else if (TREE_TYPE (t)
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (t))
+ && !REFERENCE_REF_P (t)
&& !TREE_CONSTANT (t))
{
if (complain & tf_error)
@@ -18169,8 +18163,12 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
case INDIRECT_REF:
if (REFERENCE_REF_P (parm))
- return unify (tparms, targs, TREE_OPERAND (parm, 0), arg,
- strict, explain_p);
+ {
+ if (REFERENCE_REF_P (arg))
+ arg = TREE_OPERAND (arg, 0);
+ return unify (tparms, targs, TREE_OPERAND (parm, 0), arg,
+ strict, explain_p);
+ }
/* FALLTHRU */
default:
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index f076f23c8f2..2b571c5d459 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -293,7 +293,11 @@ repo_emit_p (tree decl)
int ret = 0;
gcc_assert (TREE_PUBLIC (decl));
gcc_assert (VAR_OR_FUNCTION_DECL_P (decl));
- gcc_assert (!DECL_REALLY_EXTERN (decl));
+ gcc_assert (!DECL_REALLY_EXTERN (decl)
+ /* A clone might not have its linkage flags updated yet
+ because we call import_export_decl before
+ maybe_clone_body. */
+ || DECL_ABSTRACT_ORIGIN (decl));
/* When not using the repository, emit everything. */
if (!flag_use_repository)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5c6a9d3ce83..bbed56fb06e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1629,6 +1629,9 @@ force_paren_expr (tree expr)
tree type = unlowered_expr_type (expr);
bool rval = !!(kind & clk_rvalueref);
type = cp_build_reference_type (type, rval);
+ /* This inhibits warnings in, eg, cxx_mark_addressable
+ (c++/60955). */
+ warning_sentinel s (extra_warnings);
expr = build_static_cast (type, expr, tf_error);
if (expr != error_mark_node)
REF_PARENTHESIZED_P (expr) = true;
@@ -3800,6 +3803,14 @@ finish_bases (tree type, bool direct)
tree
finish_offsetof (tree expr)
{
+ /* If we're processing a template, we can't finish the semantics yet.
+ Otherwise we can fold the entire expression now. */
+ if (processing_template_decl)
+ {
+ expr = build1 (OFFSETOF_EXPR, size_type_node, expr);
+ return expr;
+ }
+
if (TREE_CODE (expr) == PSEUDO_DTOR_EXPR)
{
error ("cannot apply %<offsetof%> to destructor %<~%T%>",
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 03d7ab807d7..cd8318d92c6 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -8881,6 +8881,12 @@ apply_memfn_quals (tree type, cp_cv_quals memfn_quals, cp_ref_qualifier rqual)
/* This should really have a different TYPE_MAIN_VARIANT, but that gets
complex. */
tree result = build_qualified_type (type, memfn_quals);
+ if (tree canon = TYPE_CANONICAL (result))
+ if (canon != result)
+ /* check_qualified_type doesn't check the ref-qualifier, so make sure
+ TYPE_CANONICAL is correct. */
+ TYPE_CANONICAL (result)
+ = build_ref_qualified_type (canon, type_memfn_rqual (result));
result = build_exception_variant (result, TYPE_RAISES_EXCEPTIONS (type));
return build_ref_qualified_type (result, rqual);
}
diff --git a/gcc/cse.c b/gcc/cse.c
index ec9aff4195a..9b8b8160c41 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -1805,6 +1805,8 @@ merge_equiv_classes (struct table_elt *class1, struct table_elt *class2)
}
new_elt = insert (exp, class1, hash, mode);
new_elt->in_memory = hash_arg_in_memory;
+ if (GET_CODE (exp) == ASM_OPERANDS && elt->cost == MAX_COST)
+ new_elt->cost = MAX_COST;
}
}
}
@@ -4266,7 +4268,7 @@ find_sets_in_insn (rtx insn, struct set **psets)
{
int i, lim = XVECLEN (x, 0);
- /* Go over the epressions of the PARALLEL in forward order, to
+ /* Go over the expressions of the PARALLEL in forward order, to
put them in the same order in the SETS array. */
for (i = 0; i < lim; i++)
{
@@ -4642,12 +4644,27 @@ cse_insn (rtx insn)
&& REGNO (dest) >= FIRST_PSEUDO_REGISTER)
sets[i].src_volatile = 1;
- /* Also do not record result of a non-volatile inline asm with
- more than one result or with clobbers, we do not want CSE to
- break the inline asm apart. */
else if (GET_CODE (src) == ASM_OPERANDS
&& GET_CODE (x) == PARALLEL)
- sets[i].src_volatile = 1;
+ {
+ /* Do not record result of a non-volatile inline asm with
+ more than one result. */
+ if (n_sets > 1)
+ sets[i].src_volatile = 1;
+
+ int j, lim = XVECLEN (x, 0);
+ for (j = 0; j < lim; j++)
+ {
+ rtx y = XVECEXP (x, 0, j);
+ /* And do not record result of a non-volatile inline asm
+ with "memory" clobber. */
+ if (GET_CODE (y) == CLOBBER && MEM_P (XEXP (y, 0)))
+ {
+ sets[i].src_volatile = 1;
+ break;
+ }
+ }
+ }
#if 0
/* It is no longer clear why we used to do this, but it doesn't
@@ -5238,8 +5255,8 @@ cse_insn (rtx insn)
;
/* Look for a substitution that makes a valid insn. */
- else if (validate_unshare_change
- (insn, &SET_SRC (sets[i].rtl), trial, 0))
+ else if (validate_unshare_change (insn, &SET_SRC (sets[i].rtl),
+ trial, 0))
{
rtx new_rtx = canon_reg (SET_SRC (sets[i].rtl), insn);
@@ -5600,6 +5617,12 @@ cse_insn (rtx insn)
}
elt = insert (src, classp, sets[i].src_hash, mode);
elt->in_memory = sets[i].src_in_memory;
+ /* If inline asm has any clobbers, ensure we only reuse
+ existing inline asms and never try to put the ASM_OPERANDS
+ into an insn that isn't inline asm. */
+ if (GET_CODE (src) == ASM_OPERANDS
+ && GET_CODE (x) == PARALLEL)
+ elt->cost = MAX_COST;
sets[i].src_elt = classp = elt;
}
if (sets[i].src_const && sets[i].src_const_elt == 0
@@ -5913,6 +5936,9 @@ cse_insn (rtx insn)
}
src_elt = insert (new_src, classp, src_hash, new_mode);
src_elt->in_memory = elt->in_memory;
+ if (GET_CODE (new_src) == ASM_OPERANDS
+ && elt->cost == MAX_COST)
+ src_elt->cost = MAX_COST;
}
else if (classp && classp != src_elt->first_same_value)
/* Show that two things that we've seen before are
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index baa13a3bb2e..602d7e70ed3 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -8410,9 +8410,9 @@ must be a @code{label_ref}.
@cindex @code{pc} and attributes
@item (pc)
-This refers to the address of the @emph{current} insn. It might have
-been more consistent with other usage to make this the address of the
-@emph{next} insn but this would be confusing because the length of the
+For non-branch instructions and backward branch instructions, this refers
+to the address of the current insn. But for forward branch instructions,
+this refers to the address of the next insn, because the length of the
current insn is to be computed.
@end table
diff --git a/gcc/dse.c b/gcc/dse.c
index 09dc5df6e93..878fedcec3b 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -1549,6 +1549,10 @@ record_store (rtx body, bb_info_t bb_info)
= rtx_group_vec[group_id];
mem_addr = group->canon_base_addr;
}
+ /* get_addr can only handle VALUE but cannot handle expr like:
+ VALUE + OFFSET, so call get_addr to get original addr for
+ mem_addr before plus_constant. */
+ mem_addr = get_addr (mem_addr);
if (offset)
mem_addr = plus_constant (get_address_mode (mem), mem_addr, offset);
}
@@ -2166,6 +2170,10 @@ check_mem_read_rtx (rtx *loc, void *data)
= rtx_group_vec[group_id];
mem_addr = group->canon_base_addr;
}
+ /* get_addr can only handle VALUE but cannot handle expr like:
+ VALUE + OFFSET, so call get_addr to get original addr for
+ mem_addr before plus_constant. */
+ mem_addr = get_addr (mem_addr);
if (offset)
mem_addr = plus_constant (get_address_mode (mem), mem_addr, offset);
}
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index d48895cde6e..23319d0d17d 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -4930,7 +4930,7 @@ equate_decl_number_to_die (tree decl, dw_die_ref decl_die)
/* Return how many bits covers PIECE EXPR_LIST. */
-static int
+static HOST_WIDE_INT
decl_piece_bitsize (rtx piece)
{
int ret = (int) GET_MODE (piece);
@@ -4958,7 +4958,7 @@ decl_piece_varloc_ptr (rtx piece)
static rtx
decl_piece_node (rtx loc_note, HOST_WIDE_INT bitsize, rtx next)
{
- if (bitsize <= (int) MAX_MACHINE_MODE)
+ if (bitsize > 0 && bitsize <= (int) MAX_MACHINE_MODE)
return alloc_EXPR_LIST (bitsize, loc_note, next);
else
return alloc_EXPR_LIST (0, gen_rtx_CONCAT (VOIDmode,
@@ -4997,7 +4997,7 @@ adjust_piece_list (rtx *dest, rtx *src, rtx *inner,
HOST_WIDE_INT bitpos, HOST_WIDE_INT piece_bitpos,
HOST_WIDE_INT bitsize, rtx loc_note)
{
- int diff;
+ HOST_WIDE_INT diff;
bool copy = inner != NULL;
if (copy)
@@ -5137,7 +5137,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
{
struct var_loc_node *last = temp->last, *unused = NULL;
rtx *piece_loc = NULL, last_loc_note;
- int piece_bitpos = 0;
+ HOST_WIDE_INT piece_bitpos = 0;
if (last->next)
{
last = last->next;
@@ -5148,7 +5148,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
piece_loc = &last->loc;
do
{
- int cur_bitsize = decl_piece_bitsize (*piece_loc);
+ HOST_WIDE_INT cur_bitsize = decl_piece_bitsize (*piece_loc);
if (piece_bitpos + cur_bitsize > bitpos)
break;
piece_bitpos += cur_bitsize;
@@ -13573,7 +13573,7 @@ static dw_loc_descr_ref
dw_sra_loc_expr (tree decl, rtx loc)
{
rtx p;
- unsigned int padsize = 0;
+ unsigned HOST_WIDE_INT padsize = 0;
dw_loc_descr_ref descr, *descr_tail;
unsigned HOST_WIDE_INT decl_size;
rtx varloc;
@@ -13589,11 +13589,11 @@ dw_sra_loc_expr (tree decl, rtx loc)
for (p = loc; p; p = XEXP (p, 1))
{
- unsigned int bitsize = decl_piece_bitsize (p);
+ unsigned HOST_WIDE_INT bitsize = decl_piece_bitsize (p);
rtx loc_note = *decl_piece_varloc_ptr (p);
dw_loc_descr_ref cur_descr;
dw_loc_descr_ref *tail, last = NULL;
- unsigned int opsize = 0;
+ unsigned HOST_WIDE_INT opsize = 0;
if (loc_note == NULL_RTX
|| NOTE_VAR_LOCATION_LOC (loc_note) == NULL_RTX)
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index 696fef938f1..a8e6452c3f2 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -201,7 +201,7 @@ struct GTY(()) dw_val_node {
/* Locations in memory are described using a sequence of stack machine
operations. */
-struct GTY(()) dw_loc_descr_node {
+struct GTY((chain_next ("%h.dw_loc_next"))) dw_loc_descr_node {
dw_loc_descr_ref dw_loc_next;
ENUM_BITFIELD (dwarf_location_atom) dw_loc_opc : 8;
/* Used to distinguish DW_OP_addr with a direct symbol relocation
diff --git a/gcc/expr.c b/gcc/expr.c
index 6d68d37e95f..8d1844aa886 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9992,7 +9992,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
tree tem = get_inner_reference (exp, &bitsize, &bitpos, &offset,
&mode1, &unsignedp, &volatilep, true);
rtx orig_op0, memloc;
- bool mem_attrs_from_type = false;
+ bool clear_mem_expr = false;
/* If we got back the original object, something is wrong. Perhaps
we are evaluating an expression too early. In any event, don't
@@ -10088,7 +10088,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
memloc = assign_temp (TREE_TYPE (tem), 1, 1);
emit_move_insn (memloc, op0);
op0 = memloc;
- mem_attrs_from_type = true;
+ clear_mem_expr = true;
}
if (offset)
@@ -10273,17 +10273,17 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
if (op0 == orig_op0)
op0 = copy_rtx (op0);
- /* If op0 is a temporary because of forcing to memory, pass only the
- type to set_mem_attributes so that the original expression is never
- marked as ADDRESSABLE through MEM_EXPR of the temporary. */
- if (mem_attrs_from_type)
- set_mem_attributes (op0, type, 0);
- else
- set_mem_attributes (op0, exp, 0);
+ set_mem_attributes (op0, exp, 0);
if (REG_P (XEXP (op0, 0)))
mark_reg_pointer (XEXP (op0, 0), MEM_ALIGN (op0));
+ /* If op0 is a temporary because the original expressions was forced
+ to memory, clear MEM_EXPR so that the original expression cannot
+ be marked as addressable through MEM_EXPR of the temporary. */
+ if (clear_mem_expr)
+ set_mem_expr (op0, NULL_TREE);
+
MEM_VOLATILE_P (op0) |= volatilep;
if (mode == mode1 || mode1 == BLKmode || mode1 == tmode
|| modifier == EXPAND_CONST_ADDRESS
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 573c26167b0..f9509e6665a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,76 @@
+2015-02-03 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ * intrinsic.texi (CO_ASSOCIATED): c_prt_1 should be c_ptr_1.
+
+2015-01-27 Paul Thomas <pault@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/62044
+ * resolve.c (resolve_allocate_expr): If the default initializer
+ is NULL, keep the original MOLD expression so that the correct
+ typespec is available.
+
+2015-01-27 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/64771
+ * interface.c (check_dummy_characteristics): Fix coarray handling.
+
+2015-01-26 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/64230
+ * class.c (finalize_component): New argument 'sub_ns'. Insert code to
+ check if 'expr' is associated.
+ (generate_finalization_wrapper): Rename 'ptr' symbols to 'ptr1' and
+ 'ptr2'. Pass 'sub_ns' to finalize_component.
+
+2015-01-24 Thomas Koenig <tkoenig@netcologne.de>
+
+ Backport from trunk
+ PR fortran/57023
+ * dependency.c (callback_dummy_intent_not_int): New function.
+ (dummy_intent_not_in): New function.
+ (gfc_full_array_ref_p): Use dummy_intent_not_in.
+
+2015-01-24 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/60922
+ * class.c (finalize_component): Apply the check for 'fini_coarray' only
+ to coarray components.
+
+2015-01-14 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2015-01-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/64528
+ * trans-decl.c (create_function_arglist): Don't set TREE_READONLY
+ on dummy args with VALUE attribute.
+
+2015-01-12 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/63733
+ * interface.c (gfc_extend_expr): Look for type-bound operators before
+ non-typebound ones.
+
+2015-01-08 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/56867
+ * trans-array.c (gfc_conv_resolve_dependencies): Also check
+ dependencies when there may be substrings of character arrays.
+
+2014-12-23 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/64244
+ * resolve.c (resolve_typebound_call): New argument to pass out the
+ non-overridable attribute of the specific procedure.
+ (resolve_typebound_subroutine): Get overridable flag from
+ resolve_typebound_call.
+
2014-11-28 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 346aee65205..aee96666ed9 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -828,7 +828,8 @@ comp_is_finalizable (gfc_component *comp)
static void
finalize_component (gfc_expr *expr, gfc_symbol *derived, gfc_component *comp,
- gfc_symbol *stat, gfc_symbol *fini_coarray, gfc_code **code)
+ gfc_symbol *stat, gfc_symbol *fini_coarray, gfc_code **code,
+ gfc_namespace *sub_ns)
{
gfc_expr *e;
gfc_ref *ref;
@@ -875,7 +876,7 @@ finalize_component (gfc_expr *expr, gfc_symbol *derived, gfc_component *comp,
/* Add IF (fini_coarray). */
if (comp->attr.codimension
|| (comp->ts.type == BT_CLASS && CLASS_DATA (comp)
- && CLASS_DATA (comp)->attr.allocatable))
+ && CLASS_DATA (comp)->attr.codimension))
{
block = gfc_get_code (EXEC_IF);
if (*code)
@@ -897,15 +898,32 @@ finalize_component (gfc_expr *expr, gfc_symbol *derived, gfc_component *comp,
dealloc->ext.alloc.list->expr = e;
dealloc->expr1 = gfc_lval_expr_from_sym (stat);
+ gfc_code *cond = gfc_get_code (EXEC_IF);
+ cond->block = gfc_get_code (EXEC_IF);
+ cond->block->expr1 = gfc_get_expr ();
+ cond->block->expr1->expr_type = EXPR_FUNCTION;
+ gfc_get_sym_tree ("associated", sub_ns, &cond->block->expr1->symtree, false);
+ cond->block->expr1->symtree->n.sym->attr.flavor = FL_PROCEDURE;
+ cond->block->expr1->symtree->n.sym->attr.intrinsic = 1;
+ cond->block->expr1->symtree->n.sym->result = cond->block->expr1->symtree->n.sym;
+ gfc_commit_symbol (cond->block->expr1->symtree->n.sym);
+ cond->block->expr1->ts.type = BT_LOGICAL;
+ cond->block->expr1->ts.kind = gfc_default_logical_kind;
+ cond->block->expr1->value.function.isym = gfc_intrinsic_function_by_id (GFC_ISYM_ASSOCIATED);
+ cond->block->expr1->value.function.actual = gfc_get_actual_arglist ();
+ cond->block->expr1->value.function.actual->expr = gfc_copy_expr (expr);
+ cond->block->expr1->value.function.actual->next = gfc_get_actual_arglist ();
+ cond->block->next = dealloc;
+
if (block)
- block->next = dealloc;
+ block->next = cond;
else if (*code)
{
- (*code)->next = dealloc;
+ (*code)->next = cond;
(*code) = (*code)->next;
}
else
- (*code) = dealloc;
+ (*code) = cond;
}
else if (comp->ts.type == BT_DERIVED
&& comp->ts.u.derived->f2k_derived
@@ -941,7 +959,8 @@ finalize_component (gfc_expr *expr, gfc_symbol *derived, gfc_component *comp,
gfc_component *c;
for (c = comp->ts.u.derived->components; c; c = c->next)
- finalize_component (e, comp->ts.u.derived, c, stat, fini_coarray, code);
+ finalize_component (e, comp->ts.u.derived, c, stat, fini_coarray, code,
+ sub_ns);
gfc_free_expr (e);
}
}
@@ -1874,7 +1893,7 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns,
{
gfc_finalizer *fini, *fini_elem = NULL;
- gfc_get_symbol ("ptr", sub_ns, &ptr);
+ gfc_get_symbol ("ptr1", sub_ns, &ptr);
ptr->ts.type = BT_DERIVED;
ptr->ts.u.derived = derived;
ptr->attr.flavor = FL_VARIABLE;
@@ -1998,7 +2017,7 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns,
if (!ptr)
{
- gfc_get_symbol ("ptr", sub_ns, &ptr);
+ gfc_get_symbol ("ptr2", sub_ns, &ptr);
ptr->ts.type = BT_DERIVED;
ptr->ts.u.derived = derived;
ptr->attr.flavor = FL_VARIABLE;
@@ -2047,7 +2066,7 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns,
continue;
finalize_component (gfc_lval_expr_from_sym (ptr), derived, comp,
- stat, fini_coarray, &block);
+ stat, fini_coarray, &block, sub_ns);
if (!last_code->block->next)
last_code->block->next = block;
}
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index f9b975ad9c5..3c7d57913c3 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -1848,11 +1848,40 @@ gfc_check_element_vs_element (gfc_ref *lref, gfc_ref *rref, int n)
return GFC_DEP_EQUAL;
}
+/* Callback function for checking if an expression depends on a
+ dummy variable which is any other than INTENT(IN). */
+
+static int
+callback_dummy_intent_not_in (gfc_expr **ep,
+ int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ gfc_expr *e = *ep;
+
+ if (e->expr_type == EXPR_VARIABLE && e->symtree
+ && e->symtree->n.sym->attr.dummy)
+ return e->symtree->n.sym->attr.intent != INTENT_IN;
+ else
+ return 0;
+}
+
+/* Auxiliary function to check if subexpressions have dummy variables which
+ are not intent(in).
+*/
+
+static bool
+dummy_intent_not_in (gfc_expr **ep)
+{
+ return gfc_expr_walker (ep, callback_dummy_intent_not_in, NULL);
+}
/* Determine if an array ref, usually an array section specifies the
entire array. In addition, if the second, pointer argument is
provided, the function will return true if the reference is
- contiguous; eg. (:, 1) gives true but (1,:) gives false. */
+ contiguous; eg. (:, 1) gives true but (1,:) gives false.
+ If one of the bounds depends on a dummy variable which is
+ not INTENT(IN), also return false, because the user may
+ have changed the variable. */
bool
gfc_full_array_ref_p (gfc_ref *ref, bool *contiguous)
@@ -1916,14 +1945,16 @@ gfc_full_array_ref_p (gfc_ref *ref, bool *contiguous)
&& (!ref->u.ar.as
|| !ref->u.ar.as->lower[i]
|| gfc_dep_compare_expr (ref->u.ar.start[i],
- ref->u.ar.as->lower[i])))
+ ref->u.ar.as->lower[i])
+ || dummy_intent_not_in (&ref->u.ar.start[i])))
lbound_OK = false;
/* Check the upper bound. */
if (ref->u.ar.end[i]
&& (!ref->u.ar.as
|| !ref->u.ar.as->upper[i]
|| gfc_dep_compare_expr (ref->u.ar.end[i],
- ref->u.ar.as->upper[i])))
+ ref->u.ar.as->upper[i])
+ || dummy_intent_not_in (&ref->u.ar.end[i])))
ubound_OK = false;
/* Check the stride. */
if (ref->u.ar.stride[i]
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 21af23b7f57..db20475af1e 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1204,8 +1204,15 @@ check_dummy_characteristics (gfc_symbol *s1, gfc_symbol *s2,
return false;
}
+ if (s1->as->corank != s2->as->corank)
+ {
+ snprintf (errmsg, err_len, "Corank mismatch in argument '%s' (%i/%i)",
+ s1->name, s1->as->corank, s2->as->corank);
+ return false;
+ }
+
if (s1->as->type == AS_EXPLICIT)
- for (i = 0; i < s1->as->rank + s1->as->corank; i++)
+ for (i = 0; i < s1->as->rank + MAX (0, s1->as->corank-1); i++)
{
shape1 = gfc_subtract (gfc_copy_expr (s1->as->upper[i]),
gfc_copy_expr (s1->as->lower[i]));
@@ -1219,8 +1226,12 @@ check_dummy_characteristics (gfc_symbol *s1, gfc_symbol *s2,
case -1:
case 1:
case -3:
- snprintf (errmsg, err_len, "Shape mismatch in dimension %i of "
- "argument '%s'", i + 1, s1->name);
+ if (i < s1->as->rank)
+ snprintf (errmsg, err_len, "Shape mismatch in dimension %i of"
+ " argument '%s'", i + 1, s1->name);
+ else
+ snprintf (errmsg, err_len, "Shape mismatch in codimension %i "
+ "of argument '%s'", i - s1->as->rank + 1, s1->name);
return false;
case -2:
@@ -3675,6 +3686,8 @@ gfc_extend_expr (gfc_expr *e)
gfc_user_op *uop;
gfc_intrinsic_op i;
const char *gname;
+ gfc_typebound_proc* tbo;
+ gfc_expr* tb_base;
sym = NULL;
@@ -3691,6 +3704,48 @@ gfc_extend_expr (gfc_expr *e)
i = fold_unary_intrinsic (e->value.op.op);
+ /* See if we find a matching type-bound operator. */
+ if (i == INTRINSIC_USER)
+ tbo = matching_typebound_op (&tb_base, actual,
+ i, e->value.op.uop->name, &gname);
+ else
+ switch (i)
+ {
+#define CHECK_OS_COMPARISON(comp) \
+ case INTRINSIC_##comp: \
+ case INTRINSIC_##comp##_OS: \
+ tbo = matching_typebound_op (&tb_base, actual, \
+ INTRINSIC_##comp, NULL, &gname); \
+ if (!tbo) \
+ tbo = matching_typebound_op (&tb_base, actual, \
+ INTRINSIC_##comp##_OS, NULL, &gname); \
+ break;
+ CHECK_OS_COMPARISON(EQ)
+ CHECK_OS_COMPARISON(NE)
+ CHECK_OS_COMPARISON(GT)
+ CHECK_OS_COMPARISON(GE)
+ CHECK_OS_COMPARISON(LT)
+ CHECK_OS_COMPARISON(LE)
+#undef CHECK_OS_COMPARISON
+
+ default:
+ tbo = matching_typebound_op (&tb_base, actual, i, NULL, &gname);
+ break;
+ }
+
+ /* If there is a matching typebound-operator, replace the expression with
+ a call to it and succeed. */
+ if (tbo)
+ {
+ gcc_assert (tb_base);
+ build_compcall_for_operator (e, actual, tb_base, tbo, gname);
+
+ if (!gfc_resolve_expr (e))
+ return MATCH_ERROR;
+ else
+ return MATCH_YES;
+ }
+
if (i == INTRINSIC_USER)
{
for (ns = gfc_current_ns; ns; ns = ns->parent)
@@ -3741,58 +3796,9 @@ gfc_extend_expr (gfc_expr *e)
if (sym == NULL)
{
- gfc_typebound_proc* tbo;
- gfc_expr* tb_base;
-
- /* See if we find a matching type-bound operator. */
- if (i == INTRINSIC_USER)
- tbo = matching_typebound_op (&tb_base, actual,
- i, e->value.op.uop->name, &gname);
- else
- switch (i)
- {
-#define CHECK_OS_COMPARISON(comp) \
- case INTRINSIC_##comp: \
- case INTRINSIC_##comp##_OS: \
- tbo = matching_typebound_op (&tb_base, actual, \
- INTRINSIC_##comp, NULL, &gname); \
- if (!tbo) \
- tbo = matching_typebound_op (&tb_base, actual, \
- INTRINSIC_##comp##_OS, NULL, &gname); \
- break;
- CHECK_OS_COMPARISON(EQ)
- CHECK_OS_COMPARISON(NE)
- CHECK_OS_COMPARISON(GT)
- CHECK_OS_COMPARISON(GE)
- CHECK_OS_COMPARISON(LT)
- CHECK_OS_COMPARISON(LE)
-#undef CHECK_OS_COMPARISON
-
- default:
- tbo = matching_typebound_op (&tb_base, actual, i, NULL, &gname);
- break;
- }
-
- /* If there is a matching typebound-operator, replace the expression with
- a call to it and succeed. */
- if (tbo)
- {
- bool result;
-
- gcc_assert (tb_base);
- build_compcall_for_operator (e, actual, tb_base, tbo, gname);
-
- result = gfc_resolve_expr (e);
- if (!result)
- return MATCH_ERROR;
-
- return MATCH_YES;
- }
-
/* Don't use gfc_free_actual_arglist(). */
free (actual->next);
free (actual);
-
return MATCH_NO;
}
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index eb6924c8176..8d003d6377c 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -2231,7 +2231,7 @@ end program test_btest
@table @asis
@item @emph{Description}:
-@code{C_ASSOCIATED(c_prt_1[, c_ptr_2])} determines the status of the C pointer
+@code{C_ASSOCIATED(c_ptr_1[, c_ptr_2])} determines the status of the C pointer
@var{c_ptr_1} or if @var{c_ptr_1} is associated with the target @var{c_ptr_2}.
@item @emph{Standard}:
@@ -2241,7 +2241,7 @@ Fortran 2003 and later
Inquiry function
@item @emph{Syntax}:
-@code{RESULT = C_ASSOCIATED(c_prt_1[, c_ptr_2])}
+@code{RESULT = C_ASSOCIATED(c_ptr_1[, c_ptr_2])}
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index c959f5d9514..54d71763e2c 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1815,7 +1815,7 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype,
&& sym->ns->proc_name->attr.flavor != FL_MODULE)
{
if (!gfc_notify_std (GFC_STD_F2008, "Internal procedure '%s' is"
- " used as actual argument at %L",
+ " used as actual argument at %L",
sym->name, &e->where))
goto cleanup;
}
@@ -2435,7 +2435,7 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
if (!gfc_compare_interfaces (sym, def_sym, sym->name, 0, 1,
reason, sizeof(reason), NULL, NULL))
- {
+ {
gfc_error ("Interface mismatch in global procedure '%s' at %L: %s ",
sym->name, &sym->declared_at, reason);
goto done;
@@ -2449,7 +2449,7 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
if (sym->attr.if_source != IFSRC_IFBODY)
gfc_procedure_use (def_sym, actual, where);
}
-
+
done:
gfc_errors_to_warnings (0);
@@ -2551,7 +2551,7 @@ generic:
if (intr)
{
- if (!gfc_convert_to_structure_constructor (expr, intr->sym, NULL,
+ if (!gfc_convert_to_structure_constructor (expr, intr->sym, NULL,
NULL, false))
return false;
return resolve_structure_cons (expr, 0);
@@ -2853,7 +2853,7 @@ resolve_function (gfc_expr *expr)
no_formal_args = sym && is_external_proc (sym)
&& gfc_sym_get_dummy_args (sym) == NULL;
- if (!resolve_actual_arglist (expr->value.function.actual,
+ if (!resolve_actual_arglist (expr->value.function.actual,
p, no_formal_args))
{
inquiry_argument = false;
@@ -4122,7 +4122,7 @@ gfc_resolve_index_1 (gfc_expr *index, int check_scalar,
}
if (index->ts.type == BT_REAL)
- if (!gfc_notify_std (GFC_STD_LEGACY, "REAL array index at %L",
+ if (!gfc_notify_std (GFC_STD_LEGACY, "REAL array index at %L",
&index->where))
return false;
@@ -5590,7 +5590,7 @@ success:
/* Resolve a call to a type-bound subroutine. */
static bool
-resolve_typebound_call (gfc_code* c, const char **name)
+resolve_typebound_call (gfc_code* c, const char **name, bool *overridable)
{
gfc_actual_arglist* newactual;
gfc_symtree* target;
@@ -5614,6 +5614,10 @@ resolve_typebound_call (gfc_code* c, const char **name)
if (!resolve_typebound_generic_call (c->expr1, name))
return false;
+ /* Pass along the NON_OVERRIDABLE attribute of the specific TBP. */
+ if (overridable)
+ *overridable = !c->expr1->value.compcall.tbp->non_overridable;
+
/* Transform into an ordinary EXEC_CALL for now. */
if (!resolve_typebound_static (c->expr1, &target, &newactual))
@@ -5778,7 +5782,7 @@ resolve_typebound_function (gfc_expr* e)
/* Get the CLASS declared type. */
declared = get_declared_from_expr (&class_ref, &new_ref, e, true);
-
+
if (!resolve_fl_derived (declared))
return false;
@@ -5873,7 +5877,7 @@ resolve_typebound_subroutine (gfc_code *code)
if (c->ts.u.derived == NULL)
c->ts.u.derived = gfc_find_derived_vtab (declared);
- if (!resolve_typebound_call (code, &name))
+ if (!resolve_typebound_call (code, &name, NULL))
return false;
/* Use the generic name if it is there. */
@@ -5905,7 +5909,7 @@ resolve_typebound_subroutine (gfc_code *code)
}
if (st == NULL)
- return resolve_typebound_call (code, NULL);
+ return resolve_typebound_call (code, NULL, NULL);
if (!resolve_ref (code->expr1))
return false;
@@ -5918,10 +5922,10 @@ resolve_typebound_subroutine (gfc_code *code)
|| (!class_ref && st->n.sym->ts.type != BT_CLASS))
{
gfc_free_ref_list (new_ref);
- return resolve_typebound_call (code, NULL);
+ return resolve_typebound_call (code, NULL, NULL);
}
- if (!resolve_typebound_call (code, &name))
+ if (!resolve_typebound_call (code, &name, &overridable))
{
gfc_free_ref_list (new_ref);
return false;
@@ -5978,8 +5982,8 @@ resolve_ppc_call (gfc_code* c)
c->ext.actual = c->expr1->value.compcall.actual;
- if (!resolve_actual_arglist (c->ext.actual, comp->attr.proc,
- !(comp->ts.interface
+ if (!resolve_actual_arglist (c->ext.actual, comp->attr.proc,
+ !(comp->ts.interface
&& comp->ts.interface->formal)))
return false;
@@ -6013,8 +6017,8 @@ resolve_expr_ppc (gfc_expr* e)
if (!resolve_ref (e))
return false;
- if (!resolve_actual_arglist (e->value.function.actual, comp->attr.proc,
- !(comp->ts.interface
+ if (!resolve_actual_arglist (e->value.function.actual, comp->attr.proc,
+ !(comp->ts.interface
&& comp->ts.interface->formal)))
return false;
@@ -6226,19 +6230,19 @@ gfc_resolve_iterator (gfc_iterator *iter, bool real_ok, bool own_scope)
if (!gfc_resolve_iterator_expr (iter->var, real_ok, "Loop variable"))
return false;
- if (!gfc_check_vardef_context (iter->var, false, false, own_scope,
+ if (!gfc_check_vardef_context (iter->var, false, false, own_scope,
_("iterator variable")))
return false;
- if (!gfc_resolve_iterator_expr (iter->start, real_ok,
+ if (!gfc_resolve_iterator_expr (iter->start, real_ok,
"Start expression in DO loop"))
return false;
- if (!gfc_resolve_iterator_expr (iter->end, real_ok,
+ if (!gfc_resolve_iterator_expr (iter->end, real_ok,
"End expression in DO loop"))
return false;
- if (!gfc_resolve_iterator_expr (iter->step, real_ok,
+ if (!gfc_resolve_iterator_expr (iter->step, real_ok,
"Step expression in DO loop"))
return false;
@@ -6496,10 +6500,10 @@ resolve_deallocate_expr (gfc_expr *e)
}
if (pointer
- && !gfc_check_vardef_context (e, true, true, false,
+ && !gfc_check_vardef_context (e, true, true, false,
_("DEALLOCATE object")))
return false;
- if (!gfc_check_vardef_context (e, false, true, false,
+ if (!gfc_check_vardef_context (e, false, true, false,
_("DEALLOCATE object")))
return false;
@@ -6849,10 +6853,10 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
e2 = remove_last_array_ref (e);
t = true;
if (t && pointer)
- t = gfc_check_vardef_context (e2, true, true, false,
+ t = gfc_check_vardef_context (e2, true, true, false,
_("ALLOCATE object"));
if (t)
- t = gfc_check_vardef_context (e2, false, true, false,
+ t = gfc_check_vardef_context (e2, false, true, false,
_("ALLOCATE object"));
gfc_free_expr (e2);
if (!t)
@@ -6895,9 +6899,12 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
{
/* Default initialization via MOLD (non-polymorphic). */
gfc_expr *rhs = gfc_default_initializer (&code->expr3->ts);
- gfc_resolve_expr (rhs);
- gfc_free_expr (code->expr3);
- code->expr3 = rhs;
+ if (rhs != NULL)
+ {
+ gfc_resolve_expr (rhs);
+ gfc_free_expr (code->expr3);
+ code->expr3 = rhs;
+ }
}
if (e->ts.type == BT_CLASS && !unlimited && !UNLIMITED_POLY (code->expr3))
@@ -7051,7 +7058,7 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn)
/* Check the stat variable. */
if (stat)
{
- gfc_check_vardef_context (stat, false, false, false,
+ gfc_check_vardef_context (stat, false, false, false,
_("STAT variable"));
if ((stat->ts.type != BT_INTEGER
@@ -8264,7 +8271,7 @@ resolve_transfer (gfc_code *code)
code->ext.dt may be NULL if the TRANSFER is related to
an INQUIRE statement -- but in this case, we are not reading, either. */
if (code->ext.dt && code->ext.dt->dt_io_kind->value.iokind == M_READ
- && !gfc_check_vardef_context (exp, false, false, false,
+ && !gfc_check_vardef_context (exp, false, false, false,
_("item in READ")))
return;
@@ -8394,7 +8401,7 @@ resolve_lock_unlock (gfc_code *code)
&code->expr2->where);
if (code->expr2
- && !gfc_check_vardef_context (code->expr2, false, false, false,
+ && !gfc_check_vardef_context (code->expr2, false, false, false,
_("STAT variable")))
return;
@@ -8406,7 +8413,7 @@ resolve_lock_unlock (gfc_code *code)
&code->expr3->where);
if (code->expr3
- && !gfc_check_vardef_context (code->expr3, false, false, false,
+ && !gfc_check_vardef_context (code->expr3, false, false, false,
_("ERRMSG variable")))
return;
@@ -8418,7 +8425,7 @@ resolve_lock_unlock (gfc_code *code)
"variable", &code->expr4->where);
if (code->expr4
- && !gfc_check_vardef_context (code->expr4, false, false, false,
+ && !gfc_check_vardef_context (code->expr4, false, false, false,
_("ACQUIRED_LOCK variable")))
return;
}
@@ -9077,7 +9084,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
if (rhs->is_boz
&& !gfc_notify_std (GFC_STD_GNU, "BOZ literal at %L outside "
- "a DATA statement and outside INT/REAL/DBLE/CMPLX",
+ "a DATA statement and outside INT/REAL/DBLE/CMPLX",
&code->loc))
return false;
@@ -9878,7 +9885,7 @@ gfc_resolve_code (gfc_code *code, gfc_namespace *ns)
if (!t)
break;
- if (!gfc_check_vardef_context (code->expr1, false, false, false,
+ if (!gfc_check_vardef_context (code->expr1, false, false, false,
_("assignment")))
break;
@@ -10686,7 +10693,7 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
return false;
}
else if (!gfc_notify_std (GFC_STD_F2003, "Scalar object "
- "'%s' at %L may not be ALLOCATABLE",
+ "'%s' at %L may not be ALLOCATABLE",
sym->name, &sym->declared_at))
return false;
}
@@ -11017,8 +11024,8 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
&& !gfc_check_symbol_access (arg->sym->ts.u.derived)
&& !gfc_notify_std (GFC_STD_F2003, "'%s' is of a PRIVATE type "
"and cannot be a dummy argument"
- " of '%s', which is PUBLIC at %L",
- arg->sym->name, sym->name,
+ " of '%s', which is PUBLIC at %L",
+ arg->sym->name, sym->name,
&sym->declared_at))
{
/* Stop this message from recurring. */
@@ -11040,8 +11047,8 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
&& !gfc_notify_std (GFC_STD_F2003, "Procedure '%s' in "
"PUBLIC interface '%s' at %L "
"takes dummy arguments of '%s' which "
- "is PRIVATE", iface->sym->name,
- sym->name, &iface->sym->declared_at,
+ "is PRIVATE", iface->sym->name,
+ sym->name, &iface->sym->declared_at,
gfc_typename(&arg->sym->ts)))
{
/* Stop this message from recurring. */
@@ -11064,8 +11071,8 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
&& !gfc_notify_std (GFC_STD_F2003, "Procedure '%s' in "
"PUBLIC interface '%s' at %L takes "
"dummy arguments of '%s' which is "
- "PRIVATE", iface->sym->name,
- sym->name, &iface->sym->declared_at,
+ "PRIVATE", iface->sym->name,
+ sym->name, &iface->sym->declared_at,
gfc_typename(&arg->sym->ts)))
{
/* Stop this message from recurring. */
@@ -11176,7 +11183,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
gfc_formal_arglist *curr_arg;
int has_non_interop_arg = 0;
- if (!verify_bind_c_sym (sym, &(sym->ts), sym->attr.in_common,
+ if (!verify_bind_c_sym (sym, &(sym->ts), sym->attr.in_common,
sym->common_block))
{
/* Clear these to prevent looking at them again if there was an
@@ -12019,7 +12026,7 @@ resolve_typebound_procedures (gfc_symbol* derived)
for (op = 0; op != GFC_INTRINSIC_OPS; ++op)
{
gfc_typebound_proc* p = derived->f2k_derived->tb_op[op];
- if (p && !resolve_typebound_intrinsic_op (derived,
+ if (p && !resolve_typebound_intrinsic_op (derived,
(gfc_intrinsic_op)op, p))
resolve_bindings_result = false;
}
@@ -12471,7 +12478,7 @@ resolve_fl_derived0 (gfc_symbol *sym)
&& !gfc_check_symbol_access (c->ts.u.derived)
&& !gfc_notify_std (GFC_STD_F2003, "the component '%s' is a "
"PRIVATE type and cannot be a component of "
- "'%s', which is PUBLIC at %L", c->name,
+ "'%s', which is PUBLIC at %L", c->name,
sym->name, &sym->declared_at))
return false;
@@ -12545,8 +12552,8 @@ resolve_fl_derived0 (gfc_symbol *sym)
&& sym != c->ts.u.derived)
add_dt_to_dt_list (c->ts.u.derived);
- if (!gfc_resolve_array_spec (c->as,
- !(c->attr.pointer || c->attr.proc_pointer
+ if (!gfc_resolve_array_spec (c->as,
+ !(c->attr.pointer || c->attr.proc_pointer
|| c->attr.allocatable)))
return false;
@@ -12595,13 +12602,13 @@ resolve_fl_derived (gfc_symbol *sym)
|| gen_dt->generic->sym->module != gen_dt->generic->next->sym->module)
&& !gfc_notify_std (GFC_STD_F2003, "Generic name '%s' of function "
"'%s' at %L being the same name as derived "
- "type at %L", sym->name,
- gen_dt->generic->sym == sym
- ? gen_dt->generic->next->sym->name
- : gen_dt->generic->sym->name,
- gen_dt->generic->sym == sym
- ? &gen_dt->generic->next->sym->declared_at
- : &gen_dt->generic->sym->declared_at,
+ "type at %L", sym->name,
+ gen_dt->generic->sym == sym
+ ? gen_dt->generic->next->sym->name
+ : gen_dt->generic->sym->name,
+ gen_dt->generic->sym == sym
+ ? &gen_dt->generic->next->sym->declared_at
+ : &gen_dt->generic->sym->declared_at,
&sym->declared_at))
return false;
@@ -12656,13 +12663,13 @@ resolve_fl_namelist (gfc_symbol *sym)
if (nl->sym->as && nl->sym->as->type == AS_ASSUMED_SHAPE
&& !gfc_notify_std (GFC_STD_F2003, "NAMELIST array object '%s' "
- "with assumed shape in namelist '%s' at %L",
+ "with assumed shape in namelist '%s' at %L",
nl->sym->name, sym->name, &sym->declared_at))
return false;
if (is_non_constant_shape_array (nl->sym)
&& !gfc_notify_std (GFC_STD_F2003, "NAMELIST array object '%s' "
- "with nonconstant shape in namelist '%s' at %L",
+ "with nonconstant shape in namelist '%s' at %L",
nl->sym->name, sym->name, &sym->declared_at))
return false;
@@ -12671,7 +12678,7 @@ resolve_fl_namelist (gfc_symbol *sym)
|| !gfc_is_constant_expr (nl->sym->ts.u.cl->length))
&& !gfc_notify_std (GFC_STD_F2003, "NAMELIST object '%s' with "
"nonconstant character length in "
- "namelist '%s' at %L", nl->sym->name,
+ "namelist '%s' at %L", nl->sym->name,
sym->name, &sym->declared_at))
return false;
@@ -12691,7 +12698,7 @@ resolve_fl_namelist (gfc_symbol *sym)
{
if (!gfc_notify_std (GFC_STD_F2003, "NAMELIST object '%s' in "
"namelist '%s' at %L with ALLOCATABLE "
- "or POINTER components", nl->sym->name,
+ "or POINTER components", nl->sym->name,
sym->name, &sym->declared_at))
return false;
@@ -13261,10 +13268,10 @@ resolve_symbol (gfc_symbol *sym)
&& gfc_check_symbol_access (sym)
&& !gfc_check_symbol_access (sym->ts.u.derived)
&& !gfc_notify_std (GFC_STD_F2003, "PUBLIC %s '%s' at %L of PRIVATE "
- "derived type '%s'",
- (sym->attr.flavor == FL_PARAMETER)
- ? "parameter" : "variable",
- sym->name, &sym->declared_at,
+ "derived type '%s'",
+ (sym->attr.flavor == FL_PARAMETER)
+ ? "parameter" : "variable",
+ sym->name, &sym->declared_at,
sym->ts.u.derived->name))
return;
@@ -13407,15 +13414,15 @@ resolve_symbol (gfc_symbol *sym)
if (!gfc_logical_kinds[i].c_bool && sym->attr.dummy
&& !gfc_notify_std (GFC_STD_GNU, "LOGICAL dummy argument '%s' at "
"%L with non-C_Bool kind in BIND(C) procedure "
- "'%s'", sym->name, &sym->declared_at,
+ "'%s'", sym->name, &sym->declared_at,
sym->ns->proc_name->name))
return;
else if (!gfc_logical_kinds[i].c_bool
&& !gfc_notify_std (GFC_STD_GNU, "LOGICAL result variable "
"'%s' at %L with non-C_Bool kind in "
- "BIND(C) procedure '%s'", sym->name,
- &sym->declared_at,
- sym->attr.function ? sym->name
+ "BIND(C) procedure '%s'", sym->name,
+ &sym->declared_at,
+ sym->attr.function ? sym->name
: sym->ns->proc_name->name))
return;
}
@@ -14618,7 +14625,7 @@ resolve_types (gfc_namespace *ns)
unsigned letter;
for (letter = 0; letter != GFC_LETTERS; ++letter)
if (ns->set_flag[letter]
- && !resolve_typespec_used (&ns->default_type[letter],
+ && !resolve_typespec_used (&ns->default_type[letter],
&ns->implicit_loc[letter], NULL))
return;
}
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index a36db45c0a7..8e5bea1917a 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -4350,6 +4350,13 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest,
&& ss_expr->rank)
nDepend = gfc_check_dependency (dest_expr, ss_expr, true);
+ /* Check for cases like c(:)(1:2) = c(2)(2:3) */
+ if (!nDepend && dest_expr->rank > 0
+ && dest_expr->ts.type == BT_CHARACTER
+ && ss_expr->expr_type == EXPR_VARIABLE)
+
+ nDepend = gfc_check_dependency (dest_expr, ss_expr, false);
+
continue;
}
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 2b0667960f3..4b3e89b7910 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -2262,8 +2262,9 @@ create_function_arglist (gfc_symbol * sym)
/* Fill in arg stuff. */
DECL_CONTEXT (parm) = fndecl;
DECL_ARG_TYPE (parm) = TREE_VALUE (typelist);
- /* All implementation args are read-only. */
- TREE_READONLY (parm) = 1;
+ /* All implementation args except for VALUE are read-only. */
+ if (!f->sym->attr.value)
+ TREE_READONLY (parm) = 1;
if (POINTER_TYPE_P (type)
&& (!f->sym->attr.proc_pointer
&& f->sym->attr.flavor != FL_PROCEDURE))
diff --git a/gcc/go/gofrontend/export.cc b/gcc/go/gofrontend/export.cc
index 13c61a589fe..e37f03446c1 100644
--- a/gcc/go/gofrontend/export.cc
+++ b/gcc/go/gofrontend/export.cc
@@ -91,6 +91,7 @@ should_export(Named_object* no)
void
Export::export_globals(const std::string& package_name,
+ const std::string& prefix,
const std::string& pkgpath,
int package_priority,
const std::map<std::string, Package*>& imports,
@@ -140,9 +141,18 @@ Export::export_globals(const std::string& package_name,
this->write_string(package_name);
this->write_c_string(";\n");
- // The package path, used for all global symbols.
- this->write_c_string("pkgpath ");
- this->write_string(pkgpath);
+ // The prefix or package path, used for all global symbols.
+ if (prefix.empty())
+ {
+ go_assert(!pkgpath.empty());
+ this->write_c_string("pkgpath ");
+ this->write_string(pkgpath);
+ }
+ else
+ {
+ this->write_c_string("prefix ");
+ this->write_string(prefix);
+ }
this->write_c_string(";\n");
// The package priority.
diff --git a/gcc/go/gofrontend/export.h b/gcc/go/gofrontend/export.h
index c6a4810510a..c010a14686c 100644
--- a/gcc/go/gofrontend/export.h
+++ b/gcc/go/gofrontend/export.h
@@ -117,14 +117,17 @@ class Export : public String_dump
// Export the identifiers in BINDINGS which are marked for export.
// The exporting is done via a series of calls to THIS->STREAM_. If
// is nothing to export, this->stream_->write will not be called.
- // PKGPATH is the package path.
+ // PREFIX is the package prefix. PKGPATH is the package path.
+ // Only one of PREFIX and PKGPATH will be non-empty.
// PACKAGE_PRIORITY is the priority to use for this package.
+ // IMPORTS is the explicitly imported packages.
// IMPORT_INIT_FN is the name of the import initialization function
// for this package; it will be empty if none is needed.
// IMPORTED_INIT_FNS is the list of initialization functions for
// imported packages.
void
export_globals(const std::string& package_name,
+ const std::string& prefix,
const std::string& pkgpath,
int package_priority,
const std::map<std::string, Package*>& imports,
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index f042f64d492..699456dd4ee 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -338,22 +338,28 @@ Gogo::set_package_name(const std::string& package_name,
// Now that we know the name of the package we are compiling, set
// the package path to use for reflect.Type.PkgPath and global
// symbol names.
- if (!this->pkgpath_set_)
+ if (this->pkgpath_set_)
+ this->pkgpath_symbol_ = Gogo::pkgpath_for_symbol(this->pkgpath_);
+ else
{
if (!this->prefix_from_option_ && package_name == "main")
- this->pkgpath_ = package_name;
+ {
+ this->pkgpath_ = package_name;
+ this->pkgpath_symbol_ = Gogo::pkgpath_for_symbol(package_name);
+ }
else
{
if (!this->prefix_from_option_)
this->prefix_ = "go";
this->pkgpath_ = this->prefix_ + '.' + package_name;
+ this->pkgpath_symbol_ = (Gogo::pkgpath_for_symbol(this->prefix_) + '.'
+ + Gogo::pkgpath_for_symbol(package_name));
}
this->pkgpath_set_ = true;
}
- this->pkgpath_symbol_ = Gogo::pkgpath_for_symbol(this->pkgpath_);
-
- this->package_ = this->register_package(this->pkgpath_, location);
+ this->package_ = this->register_package(this->pkgpath_,
+ this->pkgpath_symbol_, location);
this->package_->set_package_name(package_name, location);
if (this->is_main_package())
@@ -656,10 +662,11 @@ Gogo::add_imported_package(const std::string& real_name,
const std::string& alias_arg,
bool is_alias_exported,
const std::string& pkgpath,
+ const std::string& pkgpath_symbol,
Location location,
bool* padd_to_globals)
{
- Package* ret = this->register_package(pkgpath, location);
+ Package* ret = this->register_package(pkgpath, pkgpath_symbol, location);
ret->set_package_name(real_name, location);
*padd_to_globals = false;
@@ -688,10 +695,13 @@ Gogo::add_imported_package(const std::string& real_name,
// Register a package. This package may or may not be imported. This
// returns the Package structure for the package, creating if it
// necessary. LOCATION is the location of the import statement that
-// led us to see this package.
+// led us to see this package. PKGPATH_SYMBOL is the symbol to use
+// for names in the package; it may be the empty string, in which case
+// we either get it later or make a guess when we need it.
Package*
-Gogo::register_package(const std::string& pkgpath, Location location)
+Gogo::register_package(const std::string& pkgpath,
+ const std::string& pkgpath_symbol, Location location)
{
Package* package = NULL;
std::pair<Packages::iterator, bool> ins =
@@ -701,13 +711,15 @@ Gogo::register_package(const std::string& pkgpath, Location location)
// We have seen this package name before.
package = ins.first->second;
go_assert(package != NULL && package->pkgpath() == pkgpath);
+ if (!pkgpath_symbol.empty())
+ package->set_pkgpath_symbol(pkgpath_symbol);
if (Linemap::is_unknown_location(package->location()))
package->set_location(location);
}
else
{
// First time we have seen this package name.
- package = new Package(pkgpath, location);
+ package = new Package(pkgpath, pkgpath_symbol, location);
go_assert(ins.first->second == NULL);
ins.first->second = package;
}
@@ -3424,10 +3436,24 @@ Gogo::do_exports()
// support streaming to a separate file.
Stream_to_section stream;
+ // Write out either the prefix or pkgpath depending on how we were
+ // invoked.
+ std::string prefix;
+ std::string pkgpath;
+ if (this->pkgpath_from_option_)
+ pkgpath = this->pkgpath_;
+ else if (this->prefix_from_option_)
+ prefix = this->prefix_;
+ else if (this->is_main_package())
+ pkgpath = "main";
+ else
+ prefix = "go";
+
Export exp(&stream);
exp.register_builtin_types(this);
exp.export_globals(this->package_name(),
- this->pkgpath(),
+ prefix,
+ pkgpath,
this->package_priority(),
this->imports_,
(this->need_init_fn_ && !this->is_main_package()
@@ -6030,8 +6056,9 @@ Unnamed_label::get_goto(Translate_context* context, Location location)
// Class Package.
-Package::Package(const std::string& pkgpath, Location location)
- : pkgpath_(pkgpath), pkgpath_symbol_(Gogo::pkgpath_for_symbol(pkgpath)),
+Package::Package(const std::string& pkgpath,
+ const std::string& pkgpath_symbol, Location location)
+ : pkgpath_(pkgpath), pkgpath_symbol_(pkgpath_symbol),
package_name_(), bindings_(new Bindings(NULL)), priority_(0),
location_(location), used_(false), is_imported_(false),
uses_sink_alias_(false)
@@ -6055,6 +6082,34 @@ Package::set_package_name(const std::string& package_name, Location location)
package_name.c_str());
}
+// Return the pkgpath symbol, which is a prefix for symbols defined in
+// this package.
+
+std::string
+Package::pkgpath_symbol() const
+{
+ if (this->pkgpath_symbol_.empty())
+ {
+ // In the general case, this is wrong, because the package might
+ // have been compiled with -fprefix. However, it is what we
+ // used to do, so it is no more wrong than we were before.
+ return Gogo::pkgpath_for_symbol(this->pkgpath_);
+ }
+ return this->pkgpath_symbol_;
+}
+
+// Set the package path symbol.
+
+void
+Package::set_pkgpath_symbol(const std::string& pkgpath_symbol)
+{
+ go_assert(!pkgpath_symbol.empty());
+ if (this->pkgpath_symbol_.empty())
+ this->pkgpath_symbol_ = pkgpath_symbol;
+ else
+ go_assert(this->pkgpath_symbol_ == pkgpath_symbol);
+}
+
// Set the priority. We may see multiple priorities for an imported
// package; we want to use the largest one.
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 3f2808781b7..2e378b456c8 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -255,6 +255,7 @@ class Gogo
add_imported_package(const std::string& real_name, const std::string& alias,
bool is_alias_exported,
const std::string& pkgpath,
+ const std::string& pkgpath_symbol,
Location location,
bool* padd_to_globals);
@@ -262,7 +263,8 @@ class Gogo
// This returns the Package structure for the package, creating if
// it necessary.
Package*
- register_package(const std::string& pkgpath, Location);
+ register_package(const std::string& pkgpath,
+ const std::string& pkgpath_symbol, Location);
// Start compiling a function. ADD_METHOD_TO_TYPE is true if a
// method function should be added to the type of its receiver.
@@ -2597,7 +2599,8 @@ class Unnamed_label
class Package
{
public:
- Package(const std::string& pkgpath, Location location);
+ Package(const std::string& pkgpath, const std::string& pkgpath_symbol,
+ Location location);
// Get the package path used for all symbols exported from this
// package.
@@ -2606,9 +2609,12 @@ class Package
{ return this->pkgpath_; }
// Return the package path to use for a symbol name.
- const std::string&
- pkgpath_symbol() const
- { return this->pkgpath_symbol_; }
+ std::string
+ pkgpath_symbol() const;
+
+ // Set the package path symbol.
+ void
+ set_pkgpath_symbol(const std::string&);
// Return the location of the import statement.
Location
diff --git a/gcc/go/gofrontend/import-archive.cc b/gcc/go/gofrontend/import-archive.cc
index 34fb528ab5c..a902cfaafce 100644
--- a/gcc/go/gofrontend/import-archive.cc
+++ b/gcc/go/gofrontend/import-archive.cc
@@ -295,6 +295,15 @@ Archive_file::interpret_header(const Archive_header* hdr, off_t off,
// This is the symbol table.
pname->clear();
}
+ else if (hdr->ar_name[1] == 'S' && hdr->ar_name[2] == 'Y'
+ && hdr->ar_name[3] == 'M' && hdr->ar_name[4] == '6'
+ && hdr->ar_name[5] == '4' && hdr->ar_name[6] == '/'
+ && hdr->ar_name[7] == ' '
+ )
+ {
+ // 64-bit symbol table.
+ pname->clear();
+ }
else if (hdr->ar_name[1] == '/')
{
// This is the extended name table.
diff --git a/gcc/go/gofrontend/import.cc b/gcc/go/gofrontend/import.cc
index 4913100b5fd..daeb42f7bbe 100644
--- a/gcc/go/gofrontend/import.cc
+++ b/gcc/go/gofrontend/import.cc
@@ -301,23 +301,27 @@ Import::import(Gogo* gogo, const std::string& local_name,
this->require_c_string(";\n");
std::string pkgpath;
+ std::string pkgpath_symbol;
if (this->match_c_string("prefix "))
{
this->advance(7);
std::string unique_prefix = this->read_identifier();
this->require_c_string(";\n");
pkgpath = unique_prefix + '.' + package_name;
+ pkgpath_symbol = (Gogo::pkgpath_for_symbol(unique_prefix) + '.'
+ + Gogo::pkgpath_for_symbol(package_name));
}
else
{
this->require_c_string("pkgpath ");
pkgpath = this->read_identifier();
this->require_c_string(";\n");
+ pkgpath_symbol = Gogo::pkgpath_for_symbol(pkgpath);
}
this->package_ = gogo->add_imported_package(package_name, local_name,
is_local_name_exported,
- pkgpath,
+ pkgpath, pkgpath_symbol,
this->location_,
&this->add_to_globals_);
if (this->package_ == NULL)
@@ -392,7 +396,7 @@ Import::read_one_import()
stream->advance(1);
this->require_c_string("\";\n");
- Package* p = this->gogo_->register_package(pkgpath,
+ Package* p = this->gogo_->register_package(pkgpath, "",
Linemap::unknown_location());
p->set_package_name(package_name, this->location());
}
@@ -649,7 +653,7 @@ Import::read_type()
package = this->package_;
else
{
- package = this->gogo_->register_package(pkgpath,
+ package = this->gogo_->register_package(pkgpath, "",
Linemap::unknown_location());
if (!package_name.empty())
package->set_package_name(package_name, this->location());
diff --git a/gcc/go/gofrontend/unsafe.cc b/gcc/go/gofrontend/unsafe.cc
index e7c61f02303..e9409b274b9 100644
--- a/gcc/go/gofrontend/unsafe.cc
+++ b/gcc/go/gofrontend/unsafe.cc
@@ -22,7 +22,7 @@ Gogo::import_unsafe(const std::string& local_name, bool is_local_name_exported,
bool add_to_globals;
Package* package = this->add_imported_package("unsafe", local_name,
is_local_name_exported,
- "unsafe", location,
+ "unsafe", "unsafe", location,
&add_to_globals);
if (package == NULL)
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index 6f68631a12a..a9be22f6572 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -87,7 +87,6 @@ can_remove_node_now_p_1 (struct cgraph_node *node)
the callgraph so references can point to it. */
return (!node->address_taken
&& !ipa_ref_has_aliases_p (&node->ref_list)
- && !node->used_as_abstract_origin
&& cgraph_can_remove_if_no_direct_calls_p (node)
/* Inlining might enable more devirtualizing, so we want to remove
those only after all devirtualizable virtual calls are processed.
@@ -185,6 +184,7 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
n = cgraph_clone_node (e->callee, e->callee->decl,
e->count, freq_scale, update_original,
vNULL, true, inlining_into, NULL);
+ n->used_as_abstract_origin = e->callee->used_as_abstract_origin;
cgraph_redirect_edge_callee (e, n);
}
}
diff --git a/gcc/ipa.c b/gcc/ipa.c
index ebaa82dbfe4..fe4d0fbf160 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -364,9 +364,17 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
&& DECL_ABSTRACT_ORIGIN (node->decl))
{
struct cgraph_node *origin_node
- = cgraph_get_create_node (DECL_ABSTRACT_ORIGIN (node->decl));
- origin_node->used_as_abstract_origin = true;
- enqueue_node (origin_node, &first, reachable);
+ = cgraph_get_node (DECL_ABSTRACT_ORIGIN (node->decl));
+ if (origin_node && !origin_node->used_as_abstract_origin)
+ {
+ origin_node->used_as_abstract_origin = true;
+ gcc_assert (!origin_node->prev_sibling_clone);
+ gcc_assert (!origin_node->next_sibling_clone);
+ for (cgraph_node *n = origin_node->clones; n;
+ n = n->next_sibling_clone)
+ if (n->decl == DECL_ABSTRACT_ORIGIN (node->decl))
+ n->used_as_abstract_origin = true;
+ }
}
/* If any symbol in a comdat group is reachable, force
all externally visible symbols in the same comdat
diff --git a/gcc/jump.c b/gcc/jump.c
index e6dabd05c5c..d41373b9406 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -133,7 +133,30 @@ cleanup_barriers (void)
if (BARRIER_P (prev))
delete_insn (insn);
else if (prev != PREV_INSN (insn))
- reorder_insns_nobb (insn, insn, prev);
+ {
+ basic_block bb = BLOCK_FOR_INSN (prev);
+ rtx end = PREV_INSN (insn);
+ reorder_insns_nobb (insn, insn, prev);
+ if (bb)
+ {
+ /* If the backend called in machine reorg compute_bb_for_insn
+ and didn't free_bb_for_insn again, preserve basic block
+ boundaries. Move the end of basic block to PREV since
+ it is followed by a barrier now, and clear BLOCK_FOR_INSN
+ on the following notes.
+ ??? Maybe the proper solution for the targets that have
+ cfg around after machine reorg is not to run cleanup_barriers
+ pass at all. */
+ BB_END (bb) = prev;
+ do
+ {
+ prev = NEXT_INSN (prev);
+ if (prev != insn && BLOCK_FOR_INSN (prev) == bb)
+ BLOCK_FOR_INSN (prev) = NULL;
+ }
+ while (prev != end);
+ }
+ }
}
}
return 0;
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 173067f65cf..9e6915f39cf 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -793,7 +793,8 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
if (DECL_ABSTRACT_ORIGIN (node->decl))
{
struct cgraph_node *origin_node
- = cgraph_get_node (DECL_ABSTRACT_ORIGIN (node->decl));
+ = cgraph_get_create_node (DECL_ABSTRACT_ORIGIN (node->decl));
+ origin_node->used_as_abstract_origin = true;
add_node_to (encoder, origin_node, true);
}
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index ea45e205bb9..f0059be6b5d 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1633,7 +1633,8 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
#pragma omp target data, there is nothing to map for
those. */
if (gimple_omp_target_kind (ctx->stmt) == GF_OMP_TARGET_KIND_DATA
- && !POINTER_TYPE_P (TREE_TYPE (decl)))
+ && !POINTER_TYPE_P (TREE_TYPE (decl))
+ && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c))
break;
}
if (DECL_P (decl))
@@ -11105,9 +11106,11 @@ simd_clone_mangle (struct cgraph_node *node,
}
pp_underscore (&pp);
- pp_string (&pp,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)));
- const char *str = pp_formatted_text (&pp);
+ const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl));
+ if (*str == '*')
+ ++str;
+ pp_string (&pp, str);
+ str = pp_formatted_text (&pp);
/* If there already is a SIMD clone with the same mangled name, don't
add another one. This can happen e.g. for
diff --git a/gcc/ree.c b/gcc/ree.c
index a3bd5610592..67fc9c3b0fb 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -767,6 +767,17 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state)
!= REGNO (get_extended_src_reg (SET_SRC (PATTERN (cand->insn)))));
if (copy_needed)
{
+ /* Considering transformation of
+ (set (reg1) (expression))
+ ...
+ (set (reg2) (any_extend (reg1)))
+
+ into
+
+ (set (reg2) (any_extend (expression)))
+ (set (reg1) (reg2))
+ ... */
+
/* In theory we could handle more than one reaching def, it
just makes the code to update the insn stream more complex. */
if (state->defs_list.length () != 1)
@@ -782,18 +793,6 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state)
if (state->modified[INSN_UID (cand->insn)].kind != EXT_MODIFIED_NONE)
return false;
- /* Transformation of
- (set (reg1) (expression))
- (set (reg2) (any_extend (reg1)))
- into
- (set (reg2) (any_extend (expression)))
- (set (reg1) (reg2))
- is only valid for scalar integral modes, as it relies on the low
- subreg of reg1 to have the value of (expression), which is not true
- e.g. for vector modes. */
- if (!SCALAR_INT_MODE_P (GET_MODE (SET_DEST (PATTERN (cand->insn)))))
- return false;
-
/* There's only one reaching def. */
rtx def_insn = state->defs_list[0];
@@ -1002,6 +1001,7 @@ add_removable_extension (const_rtx expr, rtx insn,
different extension. FIXME: this obviously can be improved. */
for (def = defs; def; def = def->next)
if ((idx = def_map[INSN_UID (DF_REF_INSN (def->ref))])
+ && idx != -1U
&& (cand = &(*insn_list)[idx - 1])
&& cand->code != code)
{
@@ -1013,6 +1013,57 @@ add_removable_extension (const_rtx expr, rtx insn,
}
return;
}
+ /* For vector mode extensions, ensure that all uses of the
+ XEXP (src, 0) register are the same extension (both code
+ and to which mode), as unlike integral extensions lowpart
+ subreg of the sign/zero extended register are not equal
+ to the original register, so we have to change all uses or
+ none. */
+ else if (VECTOR_MODE_P (GET_MODE (XEXP (src, 0))))
+ {
+ if (idx == 0)
+ {
+ struct df_link *ref_chain, *ref_link;
+
+ ref_chain = DF_REF_CHAIN (def->ref);
+ for (ref_link = ref_chain; ref_link; ref_link = ref_link->next)
+ {
+ if (ref_link->ref == NULL
+ || DF_REF_INSN_INFO (ref_link->ref) == NULL)
+ {
+ idx = -1U;
+ break;
+ }
+ rtx use_insn = DF_REF_INSN (ref_link->ref);
+ const_rtx use_set;
+ if (use_insn == insn || DEBUG_INSN_P (use_insn))
+ continue;
+ if (!(use_set = single_set (use_insn))
+ || !REG_P (SET_DEST (use_set))
+ || GET_MODE (SET_DEST (use_set)) != GET_MODE (dest)
+ || GET_CODE (SET_SRC (use_set)) != code
+ || !rtx_equal_p (XEXP (SET_SRC (use_set), 0),
+ XEXP (src, 0)))
+ {
+ idx = -1U;
+ break;
+ }
+ }
+ if (idx == -1U)
+ def_map[INSN_UID (DF_REF_INSN (def->ref))] = idx;
+ }
+ if (idx == -1U)
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "Cannot eliminate extension:\n");
+ print_rtl_single (dump_file, insn);
+ fprintf (dump_file,
+ " because some vector uses aren't extension\n");
+ }
+ return;
+ }
+ }
/* Then add the candidate to the list and insert the reaching definitions
into the definition map. */
diff --git a/gcc/reload.c b/gcc/reload.c
index 851daf30f29..e0405097adb 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -1622,6 +1622,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
end_hard_regno (rel_mode,
regno),
PATTERN (this_insn), inloc)
+ && ! find_reg_fusage (this_insn, USE, XEXP (note, 0))
/* If this is also an output reload, IN cannot be used as
the reload register if it is set in this insn unless IN
is also OUT. */
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 98fbacce4a2..e99ef7bf772 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -873,6 +873,17 @@ reg_set_between_p (const_rtx reg, const_rtx from_insn, const_rtx to_insn)
int
reg_set_p (const_rtx reg, const_rtx insn)
{
+ /* After delay slot handling, call and branch insns might be in a
+ sequence. Check all the elements there. */
+ if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE)
+ {
+ for (int i = 0; i < XVECLEN (PATTERN (insn), 0); ++i)
+ if (reg_set_p (reg, XVECEXP (PATTERN (insn), 0, i)))
+ return true;
+
+ return false;
+ }
+
/* We can be passed an insn or part of one. If we are passed an insn,
check if a side-effect of the insn clobbers REG. */
if (INSN_P (insn)
@@ -884,7 +895,7 @@ reg_set_p (const_rtx reg, const_rtx insn)
GET_MODE (reg), REGNO (reg)))
|| MEM_P (reg)
|| find_reg_fusage (insn, CLOBBER, reg)))))
- return 1;
+ return true;
return set_of (reg, insn) != NULL_RTX;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9751d346413..1c6a7803dc3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,286 @@
+2015-02-04 Matthias Klose <doko@ubuntu.com>
+
+ Backport from mainline
+ 2015-01-15 Martin Liska <mliska@suse.cz>
+
+ * g++.dg/ipa/pr64068.C: New test.
+ * gcc.dg/ipa/PR64559.c: New test.
+
+2015-02-04 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2015-01-31 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/64882
+ * gcc.dg/torture/pr64882.c: New test.
+
+2015-02-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2015-01-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/builtin_target.c (check_intel_cpu_model): Add
+ Silvermont, Ivy Bridge, Haswell and Broadwell tests. Update Sandy
+ Bridge test.
+
+2015-02-01 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2015-01-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/61058
+ * gcc.dg/pr61058.c: New test.
+
+ PR c/64766
+ * gcc.dg/pr64766.c: New test.
+
+ 2015-01-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/64778
+ * gcc.dg/pr64778.c: New test.
+
+ PR middle-end/64421
+ * gcc.dg/vect/pr64421.c: New test.
+
+ 2015-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/63637
+ PR rtl-optimization/60663
+ * gcc.dg/pr63637-1.c: New test.
+ * gcc.dg/pr63637-2.c: New test.
+ * gcc.dg/pr63637-3.c: New test.
+ * gcc.dg/pr63637-4.c: New test.
+ * gcc.dg/pr63637-5.c: New test.
+ * gcc.dg/pr63637-6.c: New test.
+ * gcc.target/i386/pr63637-1.c: New test.
+ * gcc.target/i386/pr63637-2.c: New test.
+ * gcc.target/i386/pr63637-3.c: New test.
+ * gcc.target/i386/pr63637-4.c: New test.
+ * gcc.target/i386/pr63637-5.c: New test.
+ * gcc.target/i386/pr63637-6.c: New test.
+
+ 2015-01-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/64663
+ * gcc.dg/pr64663.c: New test.
+
+2015-01-29 Ilya Tocar <ilya.tocar@intel.com>
+
+ * gcc.target/i386/sse-14.c: Test new intrinsic.
+ * gcc.target/i386/sse-22.c: Ditto.
+
+2015-01-27 Paul Thomas <pault@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/62044
+ * gfortran.dg/allocate_with_mold_1.f90: New test
+
+2015-01-27 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/64230
+ * gfortran.dg/class_allocate_18.f90: Remove -fsanitize option to
+ prevent linking errors.
+
+2015-01-27 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/64771
+ * gfortran.dg/coarray_36.f: New.
+ * gfortran.dg/coarray_37.f90: New.
+
+2015-01-26 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/64230
+ * gfortran.dg/class_allocate_18.f90: New.
+
+2015-01-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR testsuite/64712
+ * gnat.dg/unchecked_convert1.adb (Unchecked_Convert1): Initialize A.
+
+2015-01-24 Thomas Koenig <tkoenig@netcologne.de>
+
+ Backport from trunk
+ PR fortran/57023
+ * gfortran.dg/internal_pack_15.f90: New test.
+
+2015-01-24 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/60922
+ * gfortran.dg/class_allocate_17.f90: New.
+
+2015-01-20 Marek Polacek <polacek@redhat.com>
+
+ Backport from mainline
+ 2014-06-23 Marek Polacek <polacek@redhat.com>
+
+ PR c/61553
+ * c-c++-common/pr61553.c: New test.
+
+2015-01-16 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * c-c++-common/tsan/tsan_barrier.h: New.
+ * c-c++-common/tsan/atomic_stack.c: Reworked to not depend on sleep.
+ * c-c++-common/tsan/fd_pipe_race.c: Likewise.
+ * c-c++-common/tsan/mutexset1.c: Likewise.
+ * c-c++-common/tsan/race_on_barrier.c: Likewise.
+ * c-c++-common/tsan/race_on_mutex.c: Likewise.
+ * c-c++-common/tsan/race_on_mutex2.c: Likewise.
+ * c-c++-common/tsan/simple_race.c: Likewise.
+ * c-c++-common/tsan/simple_stack.c: Likewise.
+ * c-c++-common/tsan/sleep_sync.c: Likewise.
+ * c-c++-common/tsan/tiny_race.c: Likewise.
+ * c-c++-common/tsan/tls_race.c: Likewise.
+ * c-c++-common/tsan/write_in_reader_lock.c: Likewise.
+ * g++.dg/tsan/atomic_free.C: Likewise.
+ * g++.dg/tsan/atomic_free2.C: Likewise.
+ * g++.dg/tsan/cond_race.C: Likewise.
+ * g++.dg/tsan/tsan_barrier.h: Copied from c-c++-common/tsan.
+
+2015-01-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt47.adb: New test.
+
+2015-01-14 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2015-01-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/64513
+ * gcc.target/i386/pr64513.c: New test.
+
+ 2015-01-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/64286
+ * gcc.target/i386/avx2-pr64286.c: New test.
+
+ PR fortran/64528
+ * gfortran.dg/pr64528.f90: New test.
+
+ 2015-01-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/64563
+ * gcc.dg/pr64563.c: New test.
+
+2015-01-14 Marek Polacek <polacek@redhat.com>
+
+ Backport from mainline
+ 2015-01-13 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/64391
+ * gcc.dg/tm/pr64391.c: New test.
+
+2015-01-13 Marc Glisse <marc.glisse@inria.fr>
+
+ PR c++/54442
+ * g++.dg/pr54442.C: New file.
+
+2015-01-13 Renlin Li <renlin.li@arm.com>
+
+ Backported from mainline
+ 2014-11-19 Renlin Li <renlin.li@arm.com>
+
+ PR target/63424
+ * gcc.target/aarch64/pr63424.c: New Test.
+
+2015-01-12 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/63733
+ * gfortran.dg/typebound_operator_20.f90: New.
+
+2015-01-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/64536
+ * gcc.dg/pr64536.c: New test.
+
+2015-01-09 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Backport from mainline:
+ 2015-01-06 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/64505
+ * gcc.target/powerpc/pr64505.c: New file to test -m32 -mpowerpc64
+ fix is correct.
+
+2014-01-08 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/56867
+ * gfortran.dg/dependency_45.f90: New test.
+
+2015-01-08 Christian Bruel <christian.bruel@st.com>
+
+ PR target/64507
+ * gcc.target/sh/pr64507.c: New test.
+
+2015-01-05 Ian Lance Taylor <iant@google.com>
+
+ Backport from mainline:
+ 2014-11-21 Lynn Boger <laboger@linux.vnet.ibm.com>
+
+ * go.test/go-test.exp (go-set-goarch): Add case for ppc64le goarch
+ value for go testing.
+
+2014-12-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline:
+ 2014-12-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/pr57003.c: Skip on x32.
+ * gcc.target/i386/pr59927.c: Likewise.
+ * gcc.target/i386/pr60516.c: Likewise.
+
+2014-12-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline:
+ 2014-12-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/64409
+ * gcc.target/i386/pr64409.c: New test.
+
+2014-12-23 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/64244
+ * gfortran.dg/typebound_call_26.f90: New.
+
+2014-12-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/60955
+ * g++.dg/warn/register-parm-1.C: New.
+
+2014-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/63551
+ * gcc.dg/ipa/pr63551.c (fn2): Use 4294967286U instead of
+ 4294967286 to avoid warnings.
+
+2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR rtl-optimization/64037
+ * g++.dg/pr64037.C: New test.
+
+2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2014-12-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/64200
+ * gcc.target/i386/memcpy-strategy-4.c: New test.
+
+2014-12-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2014-12-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/64269
+ * gcc.c-torture/compile/pr64269.c: New test.
+
2014-12-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
diff --git a/gcc/testsuite/ChangeLog.meissner b/gcc/testsuite/ChangeLog.meissner
index 614b8976196..a79d0da9920 100644
--- a/gcc/testsuite/ChangeLog.meissner
+++ b/gcc/testsuite/ChangeLog.meissner
@@ -1,3 +1,7 @@
+2015-02-06 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Merge up to ibm/gcc-4_9-branch, subversion id 220484.
+
2014-12-11 Michael Meissner <meissner@linux.vnet.ibm.com>
Merge up to ibm/gcc-4_9-branch, subversion id 218646.
diff --git a/gcc/testsuite/c-c++-common/pr61553.c b/gcc/testsuite/c-c++-common/pr61553.c
new file mode 100644
index 00000000000..8a3b699ee70
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr61553.c
@@ -0,0 +1,8 @@
+/* PR c/61553 */
+/* { dg-do compile } */
+
+void
+foo (char *s)
+{
+ __atomic_store (s, (void *) 0, __ATOMIC_SEQ_CST); /* { dg-error "size mismatch" } */
+}
diff --git a/gcc/testsuite/c-c++-common/tsan/atomic_stack.c b/gcc/testsuite/c-c++-common/tsan/atomic_stack.c
index 6a379512010..746afa7b466 100644
--- a/gcc/testsuite/c-c++-common/tsan/atomic_stack.c
+++ b/gcc/testsuite/c-c++-common/tsan/atomic_stack.c
@@ -1,22 +1,26 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
int Global;
void *Thread1(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
__atomic_fetch_add(&Global, 1, __ATOMIC_RELAXED);
return NULL;
}
void *Thread2(void *x) {
Global++;
+ barrier_wait(&barrier);
return NULL;
}
int main() {
+ barrier_init(&barrier, 2);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
pthread_create(&t[1], NULL, Thread2, NULL);
diff --git a/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c b/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c
index 28cd630d2c1..e2176da4b62 100644
--- a/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c
+++ b/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c
@@ -1,30 +1,35 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <stdio.h>
#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
int fds[2];
void *Thread1(void *x) {
write(fds[1], "a", 1);
+ barrier_wait(&barrier);
return NULL;
}
void *Thread2(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
close(fds[0]);
close(fds[1]);
return NULL;
}
int main() {
+ barrier_init(&barrier, 2);
pipe(fds);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
pthread_create(&t[1], NULL, Thread2, NULL);
pthread_join(t[0], NULL);
pthread_join(t[1], NULL);
+ return 0;
}
/* { dg-output "WARNING: ThreadSanitizer: data race.*\n" } */
diff --git a/gcc/testsuite/c-c++-common/tsan/mutexset1.c b/gcc/testsuite/c-c++-common/tsan/mutexset1.c
index 7c32a8524b4..084f5141dea 100644
--- a/gcc/testsuite/c-c++-common/tsan/mutexset1.c
+++ b/gcc/testsuite/c-c++-common/tsan/mutexset1.c
@@ -1,14 +1,15 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
int Global;
pthread_mutex_t mtx;
void *Thread1(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
pthread_mutex_lock(&mtx);
Global++;
pthread_mutex_unlock(&mtx);
@@ -17,11 +18,13 @@ void *Thread1(void *x) {
void *Thread2(void *x) {
Global--;
+ barrier_wait(&barrier);
return NULL;/* { dg-output ".*" } */
}
int main() {
+ barrier_init(&barrier, 2);
pthread_mutex_init(&mtx, 0);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
diff --git a/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c b/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c
index 0a0e5faba02..3de3ff2257f 100644
--- a/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c
+++ b/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c
@@ -1,26 +1,28 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
pthread_barrier_t B;
int Global;
void *Thread1(void *x) {
pthread_barrier_init(&B, 0, 2);
+ barrier_wait(&barrier);
pthread_barrier_wait(&B);
return NULL;
}
void *Thread2(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
pthread_barrier_wait(&B);
return NULL;
}
int main() {
+ barrier_init(&barrier, 2);
pthread_t t;
pthread_create(&t, NULL, Thread1, NULL);
Thread2(0);
diff --git a/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c b/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
index 5dad345d85b..ae30d053c92 100644
--- a/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
+++ b/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
@@ -1,10 +1,10 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
pthread_mutex_t Mtx;
int Global;
@@ -13,11 +13,12 @@ void *Thread1(void *x) {
pthread_mutex_lock(&Mtx);
Global = 42;
pthread_mutex_unlock(&Mtx);
+ barrier_wait(&barrier);
return NULL;
}
void *Thread2(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
pthread_mutex_lock(&Mtx);
Global = 43;
pthread_mutex_unlock(&Mtx);
@@ -25,6 +26,7 @@ void *Thread2(void *x) {
}
int main() {
+ barrier_init(&barrier, 2);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
pthread_create(&t[1], NULL, Thread2, NULL);
@@ -37,7 +39,7 @@ int main() {
/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
/* { dg-output " Atomic read of size 1 at .* by thread T2:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_mutex_lock.*" } */
-/* { dg-output " #1 Thread2.* .*(race_on_mutex.c:21|\\?{2}:0) (.*)" } */
+/* { dg-output " #1 Thread2.* .*(race_on_mutex.c:22|\\?{2}:0) (.*)" } */
/* { dg-output " Previous write of size 1 at .* by thread T1:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_mutex_init .* (.)*" } */
/* { dg-output " #1 Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */
diff --git a/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c b/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c
index 80a6fb6c0eb..57d7e21e76a 100644
--- a/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c
+++ b/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c
@@ -1,22 +1,25 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+
+static pthread_barrier_t barrier;
void *Thread(void *x) {
pthread_mutex_lock((pthread_mutex_t*)x);
pthread_mutex_unlock((pthread_mutex_t*)x);
+ barrier_wait(&barrier);
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
pthread_mutex_t Mtx;
pthread_mutex_init(&Mtx, 0);
pthread_t t;
pthread_create(&t, 0, Thread, &Mtx);
- sleep(1);
+ barrier_wait(&barrier);
pthread_mutex_destroy(&Mtx);
pthread_join(t, 0);
return 0;
diff --git a/gcc/testsuite/c-c++-common/tsan/simple_race.c b/gcc/testsuite/c-c++-common/tsan/simple_race.c
index a40accd40a2..c1a369b4590 100644
--- a/gcc/testsuite/c-c++-common/tsan/simple_race.c
+++ b/gcc/testsuite/c-c++-common/tsan/simple_race.c
@@ -1,13 +1,15 @@
/* { dg-set-target-env-var TSAN_OPTIONS "halt_on_error=1" } */
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <stdio.h>
#include <unistd.h>
+#include "tsan_barrier.h"
-#define MAX_ITERATIONS_NUMBER 100
-#define SLEEP_STEP 128000
+#define MAX_ITERATIONS_NUMBER 1
+#define SLEEP_STEP 128000
+static pthread_barrier_t barrier;
unsigned int delay_time = 1000;
static inline void delay () {
@@ -17,6 +19,7 @@ static inline void delay () {
extern int main_1();
int main() {
+ barrier_init(&barrier, 2);
int i;
for (i = 0; i < MAX_ITERATIONS_NUMBER; i++) {
main_1();
@@ -28,6 +31,7 @@ int main() {
int Global;
void *Thread1(void *x) {
+ barrier_wait(&barrier);
delay();
Global = 42;
return NULL;
@@ -35,6 +39,7 @@ void *Thread1(void *x) {
void *Thread2(void *x) {
Global = 43;
+ barrier_wait(&barrier);
return NULL;
}
diff --git a/gcc/testsuite/c-c++-common/tsan/simple_stack.c b/gcc/testsuite/c-c++-common/tsan/simple_stack.c
index b66a67085ca..a4d0aba6928 100644
--- a/gcc/testsuite/c-c++-common/tsan/simple_stack.c
+++ b/gcc/testsuite/c-c++-common/tsan/simple_stack.c
@@ -1,9 +1,10 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
int Global;
void __attribute__((noinline)) foo1() {
@@ -25,13 +26,14 @@ void __attribute__((noinline)) bar2() {
}
void *Thread1(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
bar1();
return NULL;
}
void *Thread2(void *x) {
bar2();
+ barrier_wait(&barrier);
return NULL;
}
@@ -40,6 +42,7 @@ void StartThread(pthread_t *t, void *(*f)(void*)) {
}
int main() {
+ barrier_init(&barrier, 2);
pthread_t t[2];
StartThread(&t[0], Thread1);
StartThread(&t[1], Thread2);
@@ -50,16 +53,16 @@ int main() {
/* { dg-output "WARNING: ThreadSanitizer: data race.*" } */
/* { dg-output " Write of size 4 at .* by thread T1:(\n|\r\n|\r)" } */
-/* { dg-output " #0 foo1.* .*(simple_stack.c:10|\\?{2}:0) (.*)" } */
-/* { dg-output " #1 bar1.* .*(simple_stack.c:15|\\?{2}:0) (.*)" } */
-/* { dg-output " #2 Thread1.* .*(simple_stack.c:29|\\?{2}:0) (.*)" } */
+/* { dg-output " #0 foo1.* .*(simple_stack.c:11|\\?{2}:0) (.*)" } */
+/* { dg-output " #1 bar1.* .*(simple_stack.c:16|\\?{2}:0) (.*)" } */
+/* { dg-output " #2 Thread1.* .*(simple_stack.c:30|\\?{2}:0) (.*)" } */
/* { dg-output " Previous read of size 4 at .* by thread T2:(\n|\r\n|\r)" } */
-/* { dg-output " #0 foo2.* .*(simple_stack.c:19|\\?{2}:0) (.*)" } */
-/* { dg-output " #1 bar2.* .*(simple_stack.c:24|\\?{2}:0) (.*)" } */
-/* { dg-output " #2 Thread2.* .*(simple_stack.c:34|\\?{2}:0) (.*)" } */
+/* { dg-output " #0 foo2.* .*(simple_stack.c:20|\\?{2}:0) (.*)" } */
+/* { dg-output " #1 bar2.* .*(simple_stack.c:25|\\?{2}:0) (.*)" } */
+/* { dg-output " #2 Thread2.* .*(simple_stack.c:35|\\?{2}:0) (.*)" } */
/* { dg-output " Thread T1 \\(tid=.*, running\\) created by main thread at:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_create .* (.*)" } */
-/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */
+/* { dg-output " #1 StartThread.* .*(simple_stack.c:41|\\?{2}:0) (.*)" } */
/* { dg-output " Thread T2 (.*) created by main thread at:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_create .* (.*)" } */
-/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */
+/* { dg-output " #1 StartThread.* .*(simple_stack.c:41|\\?{2}:0) (.*)" } */
diff --git a/gcc/testsuite/c-c++-common/tsan/sleep_sync.c b/gcc/testsuite/c-c++-common/tsan/sleep_sync.c
index 44d44554c2e..c681dcef1bf 100644
--- a/gcc/testsuite/c-c++-common/tsan/sleep_sync.c
+++ b/gcc/testsuite/c-c++-common/tsan/sleep_sync.c
@@ -1,8 +1,11 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
int X = 0;
void MySleep() {
@@ -10,15 +13,18 @@ void MySleep() {
}
void *Thread(void *p) {
+ barrier_wait(&barrier);
MySleep(); // Assume the main thread has done the write.
X = 42;
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
pthread_t t;
pthread_create(&t, 0, Thread, 0);
X = 43;
+ barrier_wait(&barrier);
pthread_join(t, 0);
return 0;
}
diff --git a/gcc/testsuite/c-c++-common/tsan/tiny_race.c b/gcc/testsuite/c-c++-common/tsan/tiny_race.c
index 962497b2821..10a3feb9b33 100644
--- a/gcc/testsuite/c-c++-common/tsan/tiny_race.c
+++ b/gcc/testsuite/c-c++-common/tsan/tiny_race.c
@@ -1,20 +1,24 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
int Global;
void *Thread1(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
Global = 42;
return x;
}
int main() {
+ barrier_init(&barrier, 2);
pthread_t t;
pthread_create(&t, 0, Thread1, 0);
Global = 43;
+ barrier_wait(&barrier);
pthread_join(t, 0);
return Global;
}
diff --git a/gcc/testsuite/c-c++-common/tsan/tls_race.c b/gcc/testsuite/c-c++-common/tsan/tls_race.c
index 423867e382d..4dd6506043e 100644
--- a/gcc/testsuite/c-c++-common/tsan/tls_race.c
+++ b/gcc/testsuite/c-c++-common/tsan/tls_race.c
@@ -1,18 +1,24 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <stddef.h>
+#include "tsan_barrier.h"
+
+static pthread_barrier_t barrier;
void *Thread(void *a) {
+ barrier_wait(&barrier);
*(int*)a = 43;
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
static __thread int Var = 42;
pthread_t t;
pthread_create(&t, 0, Thread, &Var);
Var = 43;
+ barrier_wait(&barrier);
pthread_join(t, 0);
}
diff --git a/gcc/testsuite/c-c++-common/tsan/tsan_barrier.h b/gcc/testsuite/c-c++-common/tsan/tsan_barrier.h
new file mode 100644
index 00000000000..5d37a647585
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/tsan/tsan_barrier.h
@@ -0,0 +1,14 @@
+/* TSAN-invisible barriers. Link with -ldl. */
+#include <pthread.h>
+#include <dlfcn.h>
+
+static __typeof(pthread_barrier_wait) *barrier_wait;
+
+static
+void barrier_init (pthread_barrier_t *barrier, unsigned count)
+{
+ void *h = dlopen ("libpthread.so.0", RTLD_LAZY);
+ barrier_wait = (__typeof (pthread_barrier_wait) *)
+ dlsym (h, "pthread_barrier_wait");
+ pthread_barrier_init (barrier, NULL, count);
+}
diff --git a/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c b/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c
index 898d23d50b7..df32632bfea 100644
--- a/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c
+++ b/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c
@@ -1,8 +1,10 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+static pthread_barrier_t barrier;
pthread_rwlock_t rwlock;
int GLOB;
@@ -10,13 +12,14 @@ void *Thread1(void *p) {
(void)p;
pthread_rwlock_rdlock(&rwlock);
// Write under reader lock.
- sleep(1);
+ barrier_wait(&barrier);
GLOB++;
pthread_rwlock_unlock(&rwlock);
return 0;
}
int main(int argc, char *argv[]) {
+ barrier_init(&barrier, 2);
pthread_rwlock_init(&rwlock, NULL);
pthread_rwlock_rdlock(&rwlock);
pthread_t t;
@@ -24,6 +27,7 @@ int main(int argc, char *argv[]) {
volatile int x = GLOB;
(void)x;
pthread_rwlock_unlock(&rwlock);
+ barrier_wait(&barrier);
pthread_join(t, 0);
pthread_rwlock_destroy(&rwlock);
return 0;
diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted9.C b/gcc/testsuite/g++.dg/cpp0x/deleted9.C
new file mode 100644
index 00000000000..af97be7c35e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/deleted9.C
@@ -0,0 +1,31 @@
+// PR c++/64352
+// { dg-do compile { target c++11 } }
+
+template<bool B> struct bool_type
+{ static constexpr bool value = B; };
+
+using true_type = bool_type<true>;
+using false_type = bool_type<false>;
+
+template<typename T> T&& declval();
+
+template<typename...> struct void_ { using type = void; };
+template<typename... I> using void_t = typename void_<I...>::type;
+
+template<typename _Tp, typename = void>
+struct _Has_addressof_free: false_type { };
+
+template<typename _Tp>
+struct _Has_addressof_free
+<_Tp, void_t<decltype( operator&(declval<const _Tp&>()) )>>
+: true_type { };
+
+struct foo {};
+void operator&(foo) = delete;
+
+int main()
+{
+ static_assert( !_Has_addressof_free<int>::value, "" );
+ // error: use of deleted function 'void operator&(foo)'
+ static_assert( !_Has_addressof_free<foo>::value, "" );
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist89.C b/gcc/testsuite/g++.dg/cpp0x/initlist89.C
new file mode 100644
index 00000000000..e221664e30f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist89.C
@@ -0,0 +1,4 @@
+// PR c++/64029
+// { dg-do compile { target c++11 } }
+
+const int (&in)[]{1,2,3,4,5};
diff --git a/gcc/testsuite/g++.dg/cpp0x/override1.C b/gcc/testsuite/g++.dg/cpp0x/override1.C
index e05693fc590..77f6034b835 100644
--- a/gcc/testsuite/g++.dg/cpp0x/override1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/override1.C
@@ -4,8 +4,11 @@ struct B
virtual void f() final {}
virtual void g() {}
virtual void x() const {}
+ virtual void y() final;
};
+void B::y() {} // { dg-error "overriding" }
+
struct B2
{
virtual void h() {}
@@ -14,6 +17,7 @@ struct B2
struct D : B
{
virtual void g() override final {} // { dg-error "overriding" }
+ virtual void y() override final {} // { dg-error "virtual" }
};
template <class T> struct D2 : T
diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
new file mode 100644
index 00000000000..1d7650bb61b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
@@ -0,0 +1,12 @@
+// PR c++/64297
+// { dg-do compile { target c++11 } }
+
+struct A {
+ typedef int X;
+ template <int> X m_fn1() const;
+};
+template <typename> struct is_function {};
+is_function<int() const &> i;
+struct D {
+ template <typename Y, typename = is_function<Y>> D(Y);
+} b(&A::m_fn1<0>);
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic165.C b/gcc/testsuite/g++.dg/cpp0x/variadic165.C
new file mode 100644
index 00000000000..862931f6619
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic165.C
@@ -0,0 +1,17 @@
+// PR c++/64514
+// { dg-do compile { target c++11 } }
+
+template<typename... T>
+struct Functor
+{
+ template <T...>
+ struct Inner
+ {};
+};
+
+template struct Functor<>::Inner<>;
+
+int main()
+{
+
+}
diff --git a/gcc/testsuite/g++.dg/ipa/pr64068.C b/gcc/testsuite/g++.dg/ipa/pr64068.C
new file mode 100644
index 00000000000..95288836c36
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr64068.C
@@ -0,0 +1,49 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef int PROV_ENUMALGS_EX, PCCRYPT_OID_INFO;
+class A {
+ int m_fn2();
+ virtual bool m_fn1(PCCRYPT_OID_INFO);
+};
+int fn1();
+void fn2();
+int A::m_fn2() { m_fn1(0); }
+
+bool fn3() {
+ for (;;) {
+ if (fn1()) {
+ if (fn1() != 259)
+ fn2();
+ break;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+class B {
+public:
+ B() { fn3(); }
+};
+class C : A {
+ bool m_fn1(PCCRYPT_OID_INFO) { m_fn3(); }
+ int isSupportedByProvider_algId;
+ PROV_ENUMALGS_EX isSupportedByProvider_outEnumAlgs;
+ PROV_ENUMALGS_EX isSupportedByProvider_enumAlgs;
+ bool m_fn3() {
+ while (1) {
+ if (fn1()) {
+ if (fn1() != 259)
+ fn2();
+ break;
+ }
+ if (isSupportedByProvider_algId)
+ isSupportedByProvider_outEnumAlgs = isSupportedByProvider_enumAlgs;
+ return 1;
+ }
+ return 0;
+ }
+};
+
+void fn4() { B(); }
diff --git a/gcc/testsuite/g++.dg/pr54442.C b/gcc/testsuite/g++.dg/pr54442.C
new file mode 100644
index 00000000000..a489565616e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr54442.C
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+struct S
+{
+ void s (int) const throw ();
+ void s (int) throw ();
+};
+
+typedef int index_t;
+
+void (S::*f) (index_t) = &S::s;
+void (S::*g) (index_t) const = &S::s;
diff --git a/gcc/testsuite/g++.dg/pr64037.C b/gcc/testsuite/g++.dg/pr64037.C
new file mode 100644
index 00000000000..e5cd0e2ee17
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr64037.C
@@ -0,0 +1,27 @@
+// { dg-do run { target i?86-*-* x86_64-*-* } }
+// { dg-options "-std=c++11 -Os" }
+
+enum class X : unsigned char {
+ V = 2,
+};
+
+static void
+__attribute__((noinline,noclone))
+foo(unsigned &out, unsigned a, X b)
+{
+ out = static_cast<unsigned>(b);
+}
+
+int main()
+{
+ unsigned deadbeef = 0xDEADBEEF;
+ asm volatile ("" : "+d" (deadbeef), "+c" (deadbeef));
+
+ unsigned out;
+ foo(out, 2, X::V);
+
+ if (out != 2)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/template/non-dependent14.C b/gcc/testsuite/g++.dg/template/non-dependent14.C
new file mode 100644
index 00000000000..b257d9baf1a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/non-dependent14.C
@@ -0,0 +1,7 @@
+// PR c++/64251
+
+class DictionaryValue {};
+template <typename T> void CreateValue(T) {
+ DictionaryValue(0);
+ CreateValue(0);
+}
diff --git a/gcc/testsuite/g++.dg/template/offsetof3.C b/gcc/testsuite/g++.dg/template/offsetof3.C
new file mode 100644
index 00000000000..b17374645b2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/offsetof3.C
@@ -0,0 +1,18 @@
+// PR c++/64487
+
+struct foo {
+ int member;
+};
+
+template < int N>
+struct bar {};
+
+template <int N>
+struct qux {
+ static bar<N+__builtin_offsetof(foo,member)> static_member;
+};
+
+template <int N>
+bar<N+__builtin_offsetof(foo,member)> qux<N>::static_member;
+
+int main() { }
diff --git a/gcc/testsuite/g++.dg/template/ref9.C b/gcc/testsuite/g++.dg/template/ref9.C
new file mode 100644
index 00000000000..983f627887f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ref9.C
@@ -0,0 +1,15 @@
+// PR c++/63658
+
+struct Descriptor {};
+
+template <Descriptor & D>
+struct foo
+{
+ void size ();
+};
+
+Descriptor g_descriptor = {};
+
+template<> void foo<g_descriptor>::size()
+{
+}
diff --git a/gcc/testsuite/g++.dg/template/repo11.C b/gcc/testsuite/g++.dg/template/repo11.C
new file mode 100644
index 00000000000..5cabfd452ed
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/repo11.C
@@ -0,0 +1,31 @@
+// PR c++/64521
+// { dg-options "-frepo -std=c++11" }
+// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
+// { dg-final cleanup-repo-files }
+
+template <typename H> struct J { J(H) {} };
+template <unsigned long, typename...> struct K;
+template <unsigned long I> struct K<I> {};
+template <unsigned long I, typename H, typename... T>
+struct K<I, H, T...> : K<I + 1, T...>, J<H> {
+ K(const H &p1, const T &... p2) : K<I + 1, T...>(p2...), J<H>(p1) {}
+};
+template <typename... E> struct C : K<0, E...> {
+ C(const E &... p1) : K<0, E...>(p1...) {}
+};
+template <typename> struct A {
+ A() = default;
+};
+struct M;
+template <typename> struct L {
+ struct B {
+ template <typename> static M *__test(...);
+ typedef A<int> _Del;
+ typedef decltype(__test<_Del>()) type;
+ };
+ C<typename B::type, A<M>> _M_t;
+ L(typename B::type) : _M_t(0, A<M>()) {}
+};
+struct M {};
+int main() { L<int>(new M); }
diff --git a/gcc/testsuite/g++.dg/tsan/atomic_free.C b/gcc/testsuite/g++.dg/tsan/atomic_free.C
index 26d01ae3fdd..20429f159b8 100644
--- a/gcc/testsuite/g++.dg/tsan/atomic_free.C
+++ b/gcc/testsuite/g++.dg/tsan/atomic_free.C
@@ -1,18 +1,23 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+
+static pthread_barrier_t barrier;
void *Thread(void *a) {
__atomic_fetch_add((int*)a, 1, __ATOMIC_SEQ_CST);
+ barrier_wait(&barrier);
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
int *a = new int(0);
pthread_t t;
pthread_create(&t, 0, Thread, a);
- sleep(1);
+ barrier_wait(&barrier);
delete a;
pthread_join(t, 0);
}
diff --git a/gcc/testsuite/g++.dg/tsan/atomic_free2.C b/gcc/testsuite/g++.dg/tsan/atomic_free2.C
index 1fe512cde93..3b6a8e3af99 100644
--- a/gcc/testsuite/g++.dg/tsan/atomic_free2.C
+++ b/gcc/testsuite/g++.dg/tsan/atomic_free2.C
@@ -1,19 +1,24 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
#include <pthread.h>
-#include <unistd.h>
+#include "tsan_barrier.h"
+
+static pthread_barrier_t barrier;
void *Thread(void *a) {
- sleep(1);
+ barrier_wait(&barrier);
__atomic_fetch_add((int*)a, 1, __ATOMIC_SEQ_CST);
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
int *a = new int(0);
pthread_t t;
pthread_create(&t, 0, Thread, a);
delete a;
+ barrier_wait(&barrier);
pthread_join(t, 0);
}
diff --git a/gcc/testsuite/g++.dg/tsan/cond_race.C b/gcc/testsuite/g++.dg/tsan/cond_race.C
index a9376147763..d72d0fb54f6 100644
--- a/gcc/testsuite/g++.dg/tsan/cond_race.C
+++ b/gcc/testsuite/g++.dg/tsan/cond_race.C
@@ -1,10 +1,12 @@
/* { dg-shouldfail "tsan" } */
+/* { dg-additional-options "-ldl" } */
/* { dg-output "ThreadSanitizer: data race.*" } */
/* { dg-output "pthread_cond_signal.*" } */
-#include <stdio.h>
-#include <stdlib.h>
#include <pthread.h>
+#include "tsan_barrier.h"
+
+static pthread_barrier_t barrier;
struct Ctx {
pthread_mutex_t m;
@@ -18,10 +20,12 @@ void *thr(void *p) {
c->done = true;
pthread_mutex_unlock(&c->m);
pthread_cond_signal(&c->c);
+ barrier_wait(&barrier);
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
Ctx *c = new Ctx();
pthread_mutex_init(&c->m, 0);
pthread_cond_init(&c->c, 0);
@@ -31,6 +35,7 @@ int main() {
while (!c->done)
pthread_cond_wait(&c->c, &c->m);
pthread_mutex_unlock(&c->m);
+ barrier_wait(&barrier);
delete c;
pthread_join(th, 0);
}
diff --git a/gcc/testsuite/g++.dg/tsan/tsan_barrier.h b/gcc/testsuite/g++.dg/tsan/tsan_barrier.h
new file mode 100644
index 00000000000..5d37a647585
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tsan/tsan_barrier.h
@@ -0,0 +1,14 @@
+/* TSAN-invisible barriers. Link with -ldl. */
+#include <pthread.h>
+#include <dlfcn.h>
+
+static __typeof(pthread_barrier_wait) *barrier_wait;
+
+static
+void barrier_init (pthread_barrier_t *barrier, unsigned count)
+{
+ void *h = dlopen ("libpthread.so.0", RTLD_LAZY);
+ barrier_wait = (__typeof (pthread_barrier_wait) *)
+ dlsym (h, "pthread_barrier_wait");
+ pthread_barrier_init (barrier, NULL, count);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-22.C b/gcc/testsuite/g++.dg/warn/Wunused-var-22.C
new file mode 100644
index 00000000000..8ae46c17f82
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-22.C
@@ -0,0 +1,12 @@
+// PR c++/63657
+// { dg-options "-Wunused-variable" }
+
+class Bar
+{
+ virtual ~Bar() {}
+};
+Bar& getbar();
+void bar()
+{
+ Bar& b = getbar(); // { dg-warning "unused" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/register-parm-1.C b/gcc/testsuite/g++.dg/warn/register-parm-1.C
new file mode 100644
index 00000000000..44232d3cf41
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/register-parm-1.C
@@ -0,0 +1,9 @@
+// PR c++/60955
+// { dg-options "-Wextra" }
+
+unsigned int erroneous_warning(register int a) {
+ if ((a) & 0xff) return 1; else return 0;
+}
+unsigned int no_erroneous_warning(register int a) {
+ if (a & 0xff) return 1; else return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr64269.c b/gcc/testsuite/gcc.c-torture/compile/pr64269.c
new file mode 100644
index 00000000000..640758d3fef
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr64269.c
@@ -0,0 +1,9 @@
+/* PR tree-optimization/64269 */
+
+void
+foo (char *p)
+{
+ __SIZE_TYPE__ s = ~(__SIZE_TYPE__)0;
+ *p = 0;
+ __builtin_memset (p + 1, 0, s);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/PR64559.c b/gcc/testsuite/gcc.dg/ipa/PR64559.c
new file mode 100644
index 00000000000..463afdc2630
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/PR64559.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+
+int a, b, c, d;
+
+struct S
+{
+ int f0;
+};
+
+static int
+fn1 (int p)
+{
+ return p == 0 || a;
+}
+
+static int
+fn2 ()
+{
+ d = fn1 (c);
+ return 0;
+}
+
+static int
+fn3 (struct S p)
+{
+ p.f0 || fn2 ();
+ if (fn1 (1))
+ b = 0;
+ return 0;
+}
+
+int
+main ()
+{
+ struct S e = { 1 };
+ fn3 (e);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr63551.c b/gcc/testsuite/gcc.dg/ipa/pr63551.c
index 676c2c2c3d3..48b020aee40 100644
--- a/gcc/testsuite/gcc.dg/ipa/pr63551.c
+++ b/gcc/testsuite/gcc.dg/ipa/pr63551.c
@@ -21,7 +21,7 @@ void
fn2 ()
{
d = 0;
- union U b = { 4294967286 };
+ union U b = { 4294967286U };
fn1 (b);
}
diff --git a/gcc/testsuite/gcc.dg/pr61058.c b/gcc/testsuite/gcc.dg/pr61058.c
new file mode 100644
index 00000000000..6f840f418fe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr61058.c
@@ -0,0 +1,10 @@
+/* PR rtl-optimization/61058 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-additional-options "-fno-asynchronous-unwind-tables -mtune=atom" { target i?86-*-* x86_64-*-* } } */
+
+void
+foo (void)
+{
+ __builtin_unreachable ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr63637-1.c b/gcc/testsuite/gcc.dg/pr63637-1.c
new file mode 100644
index 00000000000..7a716f98c5f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr63637-1.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c;
+ asm ("# Magic instruction" : "=r" (a));
+ asm ("# Magic instruction" : "=r" (b));
+ asm ("# Magic instruction" : "=r" (c));
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 1 } } */
diff --git a/gcc/testsuite/gcc.dg/pr63637-2.c b/gcc/testsuite/gcc.dg/pr63637-2.c
new file mode 100644
index 00000000000..44e9d7c96ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr63637-2.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c;
+ asm ("# Magic instruction" : "=r" (a) : "r" (0));
+ asm ("# Magic instruction" : "=r" (b) : "r" (0));
+ asm ("# Magic instruction" : "=r" (c) : "r" (0));
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 1 } } */
diff --git a/gcc/testsuite/gcc.dg/pr63637-3.c b/gcc/testsuite/gcc.dg/pr63637-3.c
new file mode 100644
index 00000000000..51a2ff707e4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr63637-3.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c;
+ asm ("# Magic instruction" : "=r" (a) : : "memory");
+ asm ("# Magic instruction" : "=r" (b) : : "memory");
+ asm ("# Magic instruction" : "=r" (c) : : "memory");
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
diff --git a/gcc/testsuite/gcc.dg/pr63637-4.c b/gcc/testsuite/gcc.dg/pr63637-4.c
new file mode 100644
index 00000000000..1a914830c1e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr63637-4.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c;
+ asm ("# Magic instruction" : "=r" (a) : "r" (0) : "memory");
+ asm ("# Magic instruction" : "=r" (b) : "r" (0) : "memory");
+ asm ("# Magic instruction" : "=r" (c) : "r" (0) : "memory");
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
diff --git a/gcc/testsuite/gcc.dg/pr63637-5.c b/gcc/testsuite/gcc.dg/pr63637-5.c
new file mode 100644
index 00000000000..fce8593adb4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr63637-5.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c, d, e, f;
+ asm ("# Magic instruction" : "=r" (a), "=r" (d));
+ asm ("# Magic instruction" : "=r" (b), "=r" (e));
+ asm ("# Magic instruction" : "=r" (c), "=r" (f));
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
diff --git a/gcc/testsuite/gcc.dg/pr63637-6.c b/gcc/testsuite/gcc.dg/pr63637-6.c
new file mode 100644
index 00000000000..1b997c43049
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr63637-6.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c, d, e, f;
+ asm ("# Magic instruction" : "=r" (a), "=r" (d) : "r" (0));
+ asm ("# Magic instruction" : "=r" (b), "=r" (e) : "r" (0));
+ asm ("# Magic instruction" : "=r" (c), "=r" (f) : "r" (0));
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
diff --git a/gcc/testsuite/gcc.dg/pr64536.c b/gcc/testsuite/gcc.dg/pr64536.c
new file mode 100644
index 00000000000..9a798299787
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64536.c
@@ -0,0 +1,67 @@
+/* PR rtl-optimization/64536 */
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-fPIC" { target fpic } } */
+
+struct S { long q; } *h;
+long a, b, g, j, k, *c, *d, *e, *f, *i;
+long *baz (void)
+{
+ asm volatile ("" : : : "memory");
+ return e;
+}
+
+void
+bar (int x)
+{
+ int y;
+ for (y = 0; y < x; y++)
+ {
+ switch (b)
+ {
+ case 0:
+ case 2:
+ a++;
+ break;
+ case 3:
+ a++;
+ break;
+ case 1:
+ a++;
+ }
+ if (d)
+ {
+ f = baz ();
+ g = k++;
+ if (&h->q)
+ {
+ j = *f;
+ h->q = *f;
+ }
+ else
+ i = (long *) (h->q = *f);
+ *c++ = (long) f;
+ e += 6;
+ }
+ else
+ {
+ f = baz ();
+ g = k++;
+ if (&h->q)
+ {
+ j = *f;
+ h->q = *f;
+ }
+ else
+ i = (long *) (h->q = *f);
+ *c++ = (long) f;
+ e += 6;
+ }
+ }
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr64563.c b/gcc/testsuite/gcc.dg/pr64563.c
new file mode 100644
index 00000000000..7223349c41f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64563.c
@@ -0,0 +1,14 @@
+/* PR tree-optimization/64563 */
+/* { dg-do compile } */
+/* { dg-options "-Os -Wtype-limits" } */
+
+int a, b, c, d, f;
+unsigned int e;
+
+void
+foo (void)
+{
+ d = b = (a != (e | 4294967288UL));
+ if (!d)
+ c = f || b;
+}
diff --git a/gcc/testsuite/gcc.dg/pr64663.c b/gcc/testsuite/gcc.dg/pr64663.c
new file mode 100644
index 00000000000..9a0bf0d2330
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64663.c
@@ -0,0 +1,17 @@
+/* PR debug/64663 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g -w" } */
+
+void
+foo (void)
+{
+ int a[9];
+ a[-8] = 0;
+}
+
+void
+bar (void)
+{
+ int a[9];
+ a[-9] = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr64766.c b/gcc/testsuite/gcc.dg/pr64766.c
new file mode 100644
index 00000000000..bf6fb2d5905
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64766.c
@@ -0,0 +1,9 @@
+/* PR c/64766 */
+/* { dg-do compile } */
+
+void
+foo ()
+{
+}
+
+void foo () = 0; /* { dg-error "is initialized like a variable|invalid initializer" } */
diff --git a/gcc/testsuite/gcc.dg/pr64778.c b/gcc/testsuite/gcc.dg/pr64778.c
new file mode 100644
index 00000000000..71a2607e79c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64778.c
@@ -0,0 +1,10 @@
+/* PR c/64778 */
+/* { dg-do compile } */
+
+int
+foo (int p)
+{
+ int a;
+ a ^= foo (,); /* { dg-error "expected expression before|too many arguments" } */
+ return a;
+}
diff --git a/gcc/testsuite/gcc.dg/tm/pr64391.c b/gcc/testsuite/gcc.dg/tm/pr64391.c
new file mode 100644
index 00000000000..235118aa363
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pr64391.c
@@ -0,0 +1,10 @@
+/* PR middle-end/64391 */
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void
+foo (void)
+{
+#pragma GCC ivdep
+ while (1);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr64421.c b/gcc/testsuite/gcc.dg/vect/pr64421.c
new file mode 100644
index 00000000000..7e48a8bea47
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr64421.c
@@ -0,0 +1,36 @@
+/* PR middle-end/64421 */
+/* { dg-require-effective-target vect_simd_clones } */
+/* { dg-additional-options "-fopenmp-simd" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+#include "tree-vect.h"
+
+#pragma omp declare simd linear (y) notinbranch
+int foo (int x, int y) __asm ("bar");
+
+#pragma omp declare simd linear (y) notinbranch
+int
+foo (int x, int y)
+{
+ return x + y;
+}
+
+int a[1024] = { 1, 2 };
+
+int
+main ()
+{
+ int i;
+ check_vect ();
+ #pragma omp simd
+ for (i = 0; i < 1024; i++)
+ a[i] = foo (a[i], i);
+ if (a[0] != 1 || a[1] != 3)
+ abort ();
+ for (i = 2; i < 1024; i++)
+ if (a[i] != i)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr63424.c b/gcc/testsuite/gcc.target/aarch64/pr63424.c
new file mode 100644
index 00000000000..c6bd7626f82
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr63424.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <stdint.h>
+
+uint32_t
+truncate_int (const unsigned long long value)
+{
+ if ( value < 0 )
+ {
+ return 0;
+ }
+ else if ( value > UINT32_MAX )
+ {
+ return UINT32_MAX;
+ }
+ else
+ return (uint32_t)value;
+}
+
+uint32_t
+mul (const unsigned long long x, const unsigned long long y)
+{
+ uint32_t value = truncate_int (x * y);
+ return value;
+}
+
+uint32_t *
+test(unsigned size, uint32_t *a, uint32_t s)
+{
+ unsigned i;
+
+ for (i = 0; i < size; i++)
+ {
+ a[i] = mul (a[i], s);
+ }
+
+ return a;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr64286.c b/gcc/testsuite/gcc.target/i386/avx2-pr64286.c
new file mode 100644
index 00000000000..2edb3210c4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-pr64286.c
@@ -0,0 +1,37 @@
+/* PR rtl-optimization/64286 */
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx2" } */
+/* { dg-require-effective-target avx2 } */
+
+#include <string.h>
+#include <stdlib.h>
+#include <x86intrin.h>
+#include "avx2-check.h"
+
+__m128i v;
+__m256i w;
+
+__attribute__((noinline, noclone)) void
+foo (__m128i *p, __m128i *q)
+{
+ __m128i a = _mm_loadu_si128 (p);
+ __m128i b = _mm_xor_si128 (a, v);
+ w = _mm256_cvtepu8_epi16 (a);
+ *q = b;
+}
+
+static void
+avx2_test (void)
+{
+ v = _mm_set1_epi8 (0x40);
+ __m128i c = _mm_set_epi8 (16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
+ __m128i d;
+ foo (&c, &d);
+ __m128i e = _mm_set_epi8 (0x50, 0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49,
+ 0x48, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41);
+ __m256i f = _mm256_set_epi16 (16, 15, 14, 13, 12, 11, 10, 9,
+ 8, 7, 6, 5, 4, 3, 2, 1);
+ if (memcmp (&w, &f, sizeof (w)) != 0
+ || memcmp (&d, &e, sizeof (d)) != 0)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/builtin_target.c b/gcc/testsuite/gcc.target/i386/builtin_target.c
index c40983e6b3c..af733380cee 100644
--- a/gcc/testsuite/gcc.target/i386/builtin_target.c
+++ b/gcc/testsuite/gcc.target/i386/builtin_target.c
@@ -30,6 +30,14 @@ check_intel_cpu_model (unsigned int family, unsigned int model,
/* Atom. */
assert (__builtin_cpu_is ("atom"));
break;
+ case 0x37:
+ case 0x4a:
+ case 0x4d:
+ case 0x5a:
+ case 0x5d:
+ /* Silvermont. */
+ assert (__builtin_cpu_is ("silvermont"));
+ break;
case 0x1a:
case 0x1e:
case 0x1f:
@@ -46,10 +54,32 @@ check_intel_cpu_model (unsigned int family, unsigned int model,
assert (__builtin_cpu_is ("westmere"));
break;
case 0x2a:
+ case 0x2d:
/* Sandy Bridge. */
assert (__builtin_cpu_is ("corei7"));
assert (__builtin_cpu_is ("sandybridge"));
break;
+ case 0x3a:
+ case 0x3e:
+ /* Ivy Bridge. */
+ assert (__builtin_cpu_is ("corei7"));
+ assert (__builtin_cpu_is ("ivybridge"));
+ break;
+ case 0x3c:
+ case 0x3f:
+ case 0x45:
+ case 0x46:
+ /* Haswell. */
+ assert (__builtin_cpu_is ("corei7"));
+ assert (__builtin_cpu_is ("haswell"));
+ break;
+ case 0x3d:
+ case 0x4f:
+ case 0x56:
+ /* Broadwell. */
+ assert (__builtin_cpu_is ("corei7"));
+ assert (__builtin_cpu_is ("broadwell"));
+ break;
case 0x17:
case 0x1d:
/* Penryn. */
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c
new file mode 100644
index 00000000000..5c51248b5c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c
@@ -0,0 +1,21 @@
+/* PR target/64200 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=atom -mmemcpy-strategy=libcall:-1:align -minline-stringops-dynamically" } */
+
+#include <stdarg.h>
+
+extern void bar(char *x);
+
+void foo (int size, ...)
+{
+ struct
+ {
+ char x[size];
+ } d;
+
+ va_list ap;
+ va_start(ap, size);
+ d = va_arg(ap, typeof (d));
+ va_end(ap);
+ bar(d.x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr57003.c b/gcc/testsuite/gcc.target/i386/pr57003.c
index dfa6b8b5095..08a743ddaf2 100644
--- a/gcc/testsuite/gcc.target/i386/pr57003.c
+++ b/gcc/testsuite/gcc.target/i386/pr57003.c
@@ -1,5 +1,5 @@
/* PR rtl-optimization/57003 */
-/* { dg-do run } */
+/* { dg-do run { target { ! x32 } } } */
/* { dg-options "-O2" } */
#define N 2001
diff --git a/gcc/testsuite/gcc.target/i386/pr59927.c b/gcc/testsuite/gcc.target/i386/pr59927.c
index 693c7659513..afb53069bcf 100644
--- a/gcc/testsuite/gcc.target/i386/pr59927.c
+++ b/gcc/testsuite/gcc.target/i386/pr59927.c
@@ -1,5 +1,5 @@
/* PR target/59927 */
-/* { dg-do compile } */
+/* { dg-do compile { target { ! x32 } } } */
/* { dg-options "-O2 -g" } */
extern void baz (int) __attribute__ ((__ms_abi__));
diff --git a/gcc/testsuite/gcc.target/i386/pr60516.c b/gcc/testsuite/gcc.target/i386/pr60516.c
index 575c8b61d1e..d7e11161c49 100644
--- a/gcc/testsuite/gcc.target/i386/pr60516.c
+++ b/gcc/testsuite/gcc.target/i386/pr60516.c
@@ -1,5 +1,5 @@
/* PR target/60516 */
-/* { dg-do compile } */
+/* { dg-do compile { target { ! x32 } } } */
/* { dg-options "-O2" } */
struct S { char c[65536]; };
diff --git a/gcc/testsuite/gcc.target/i386/pr63637-1.c b/gcc/testsuite/gcc.target/i386/pr63637-1.c
new file mode 100644
index 00000000000..9cc9750dd13
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63637-1.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c;
+ asm ("# Magic instruction" : "=r" (a) : : "eax");
+ asm ("# Magic instruction" : "=r" (b) : : "edx");
+ asm ("# Magic instruction" : "=r" (c) : : "ecx");
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr63637-2.c b/gcc/testsuite/gcc.target/i386/pr63637-2.c
new file mode 100644
index 00000000000..fc549000e8e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63637-2.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c;
+ asm ("# Magic instruction" : "=r" (a) : "r" (0) : "eax");
+ asm ("# Magic instruction" : "=r" (b) : "r" (0) : "edx");
+ asm ("# Magic instruction" : "=r" (c) : "r" (0) : "ecx");
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr63637-3.c b/gcc/testsuite/gcc.target/i386/pr63637-3.c
new file mode 100644
index 00000000000..4b631ce0f81
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63637-3.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c;
+ asm ("# Magic instruction" : "=r" (a) : : "eax", "memory");
+ asm ("# Magic instruction" : "=r" (b) : : "edx", "memory");
+ asm ("# Magic instruction" : "=r" (c) : : "ecx", "memory");
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr63637-4.c b/gcc/testsuite/gcc.target/i386/pr63637-4.c
new file mode 100644
index 00000000000..7b36690bbcf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63637-4.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c;
+ asm ("# Magic instruction" : "=r" (a) : "r" (0) : "eax", "memory");
+ asm ("# Magic instruction" : "=r" (b) : "r" (0) : "edx", "memory");
+ asm ("# Magic instruction" : "=r" (c) : "r" (0) : "ecx", "memory");
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr63637-5.c b/gcc/testsuite/gcc.target/i386/pr63637-5.c
new file mode 100644
index 00000000000..f0c79b76d0a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63637-5.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c, d, e, f;
+ asm ("# Magic instruction" : "=r" (a), "=r" (d) : : "eax");
+ asm ("# Magic instruction" : "=r" (b), "=r" (e) : : "edx");
+ asm ("# Magic instruction" : "=r" (c), "=r" (f) : : "ecx");
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr63637-6.c b/gcc/testsuite/gcc.target/i386/pr63637-6.c
new file mode 100644
index 00000000000..4b0b3ba5f4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63637-6.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/63637 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+ int a, b, c, d, e, f;
+ asm ("# Magic instruction" : "=r" (a), "=r" (d) : "r" (0) : "eax");
+ asm ("# Magic instruction" : "=r" (b), "=r" (e) : "r" (0) : "edx");
+ asm ("# Magic instruction" : "=r" (c), "=r" (f) : "r" (0) : "ecx");
+ return a + b + c;
+}
+
+/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr64409.c b/gcc/testsuite/gcc.target/i386/pr64409.c
new file mode 100644
index 00000000000..6a64b5961de
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr64409.c
@@ -0,0 +1,6 @@
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-require-effective-target maybe_x32 } */
+/* { dg-options "-O0 -mx32" } */
+
+int a;
+int* __attribute__ ((ms_abi)) fn1 () { return &a; } /* { dg-error "X32 does not support ms_abi attribute" } */
diff --git a/gcc/testsuite/gcc.target/i386/pr64513.c b/gcc/testsuite/gcc.target/i386/pr64513.c
new file mode 100644
index 00000000000..02364960999
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr64513.c
@@ -0,0 +1,17 @@
+/* PR target/64513 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mstack-arg-probe" } */
+
+struct A {};
+struct B { struct A y; };
+int foo (struct A);
+
+int
+bar (int x)
+{
+ struct B b;
+ int c;
+ while (x--)
+ c = foo (b.y);
+ return c;
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c
index d9a5feddaea..ca0745e5232 100644
--- a/gcc/testsuite/gcc.target/i386/sse-14.c
+++ b/gcc/testsuite/gcc.target/i386/sse-14.c
@@ -600,6 +600,8 @@ test_2 (_mm_alignr_pi8, __m64, __m64, __m64, 1)
/* emmintrin.h */
test_2 (_mm_shuffle_pd, __m128d, __m128d, __m128d, 1)
+test_1 (_mm_bsrli_si128, __m128i, __m128i, 1)
+test_1 (_mm_bslli_si128, __m128i, __m128i, 1)
test_1 (_mm_srli_si128, __m128i, __m128i, 1)
test_1 (_mm_slli_si128, __m128i, __m128i, 1)
test_1 (_mm_extract_epi16, int, __m128i, 1)
diff --git a/gcc/testsuite/gcc.target/i386/sse-22.c b/gcc/testsuite/gcc.target/i386/sse-22.c
index e9f227a2a81..e6a1d31e46d 100644
--- a/gcc/testsuite/gcc.target/i386/sse-22.c
+++ b/gcc/testsuite/gcc.target/i386/sse-22.c
@@ -137,6 +137,8 @@ test_1 (_mm_prefetch, void, void *, _MM_HINT_NTA)
#endif
#include <emmintrin.h>
test_2 (_mm_shuffle_pd, __m128d, __m128d, __m128d, 1)
+test_1 (_mm_bsrli_si128, __m128i, __m128i, 1)
+test_1 (_mm_bslli_si128, __m128i, __m128i, 1)
test_1 (_mm_srli_si128, __m128i, __m128i, 1)
test_1 (_mm_slli_si128, __m128i, __m128i, 1)
test_1 (_mm_extract_epi16, int, __m128i, 1)
@@ -268,6 +270,8 @@ test_2 ( _mm256_blend_epi16, __m256i, __m256i, __m256i, 1)
test_1 ( _mm256_shuffle_epi32, __m256i, __m256i, 1)
test_1 ( _mm256_shufflehi_epi16, __m256i, __m256i, 1)
test_1 ( _mm256_shufflelo_epi16, __m256i, __m256i, 1)
+test_1 ( _mm256_bslli_epi128, __m256i, __m256i, 8)
+test_1 ( _mm256_bsrli_epi128, __m256i, __m256i, 8)
test_1 ( _mm256_slli_si256, __m256i, __m256i, 8)
test_1 ( _mm256_srli_si256, __m256i, __m256i, 8)
test_2 ( _mm_blend_epi32, __m128i, __m128i, __m128i, 1)
diff --git a/gcc/testsuite/gcc.target/powerpc/pr64505.c b/gcc/testsuite/gcc.target/powerpc/pr64505.c
new file mode 100644
index 00000000000..99916216aee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr64505.c
@@ -0,0 +1,231 @@
+/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
+/* { dg-options "-O2 -mpowerpc64" } */
+
+/*
+ * (below is inlined and simplified from previously included headers)
+ */
+
+struct fltcom_st {
+ short fltbuf[950];
+} fltcom_ __attribute__((common)) ;
+#define CM_PLIBOR (*(((double *)&fltcom_ + 1)))
+#define CM_QMRG (*(((double *)&fltcom_ + 2)))
+
+struct fltcom2_st {
+ short fltbuf2[56];
+} fltcom2_ __attribute__((common)) ;
+#define CM_FLPRV ((short *)&fltcom2_ + 17)
+#define CM_FLNXT ((short *)&fltcom2_ + 20)
+#define CM_FLCPN (*(((double *)&fltcom2_)))
+#define CM_FLCNT (*(((short *)&fltcom2_ + 12)))
+
+struct aidatcm_st {
+ double cm_aid, cm_ext, cm_basis;
+ short cm_aiday, cm_exday, cm_dperd, cm_aiexf, cm_aidex, cm_aiok,
+ cm_aigdo, cm_aildo, cm_prev[3], cm_next[3], cm_aid_pad[2];
+ double cm_rvgfact, cm_ai1st, cm_ai2nd;
+ int cm_aieurok;
+} aidatcm_ __attribute__((common)) ;
+#define CM_EXDAY aidatcm_.cm_exday
+#define CM_BASIS aidatcm_.cm_basis
+#define CM_PREV aidatcm_.cm_prev
+
+struct cshfcm_st {
+ short bufff[10862];
+} cshfcm_ __attribute__((common)) ;
+#define CM_FNUM (*(((short *)&cshfcm_ + 9038)))
+#define CM_FIFLX ((double *)&cshfcm_ + 1)
+#define CM_FEXTX ((double *)&cshfcm_ + 1201)
+#define CM_FSHDT ((short *)&cshfcm_ + 7230)
+
+struct calctsdb_st {
+ short calctsdbbuff[115];
+} calctsdb_ __attribute__((common)) ;
+#define CM_CTUP_GOOD_TO_GO (*(((short *)&calctsdb_ + 16)))
+#define CM_PAYMENT_FREQUENCY (*(((short *)&calctsdb_ + 61)))
+#define CM_DISCOUNTING_DAYTYP (*(((short *)&calctsdb_ + 59)))
+
+struct cf600cm_st {
+ short bufcf[14404];
+} cf600cm_ __attribute__((common)) ;
+#define CM_FLT_RFIXRATES ((double *)&cf600cm_ + 600)
+
+typedef struct { int id; int type; const char *name; } bregdb_bitinfo_t;
+
+int
+bregdb_eval_bbitcxt_bool_rv(const bregdb_bitinfo_t * const bbit,
+ const int bbit_default,
+ const void * const bregucxt);
+
+static const bregdb_bitinfo_t bbit_calc_dr_d33 =
+ { 160667, 5, "bbit_calc_dr_d33" };
+#define bbit_calc_dr_d33__value() \
+ bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d33, 0, 0)
+static const bregdb_bitinfo_t bbit_calc_sx_b24 =
+ { 158854, 5, "bbit_calc_sx_b24" };
+#define bbit_calc_sx_b24__value() \
+ bregdb_eval_bbitcxt_bool_rv(&bbit_calc_sx_b24, 0, 0)
+static const bregdb_bitinfo_t bbit_calc_dr_d36 =
+ { 161244, 5, "bbit_calc_dr_d36" };
+#define bbit_calc_dr_d36__value() \
+ bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d36, 0, 0)
+static const bregdb_bitinfo_t bbit_calc_dr_d37 =
+ { 161315, 5, "bbit_calc_dr_d37" };
+#define bbit_calc_dr_d37__value() \
+ bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d37, 0, 0)
+static const bregdb_bitinfo_t bbit_calc_dr_d47 =
+ { 163259, 5, "bbit_calc_dr_d47" };
+#define bbit_calc_dr_d47__value() \
+ bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d47, 0, 0)
+static const bregdb_bitinfo_t bbit_calc_dr_d46 =
+ { 163239, 5, "bbit_calc_dr_d46" };
+#define bbit_calc_dr_d46__value() \
+ bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d46, 0, 0)
+static const bregdb_bitinfo_t bbit_calc_dr_d62 =
+ { 166603, 5, "bbit_calc_dr_d62" };
+#define bbit_calc_dr_d62__value() \
+ bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d62, 0, 0)
+
+
+
+int dtyp_is_actact_(short *daytyp);
+double rnd_trunc_numb(double in, short num_digits, short rnd_or_trunc);
+void datetrn_(const short* dt, short* dt2);
+short difday_(short* daytyp_in, short* srtdti, short* enddti, short* ercode);
+
+
+double pow(double x, double y);
+
+
+/*
+ * (above is inlined and simplified from previously included headers)
+ */
+
+
+void calc_1566(
+ short sCalcType,
+ short sDayType,
+ short sFreq,
+ short asSettleDt[3],
+ short asMtyDt[3],
+ short asIssueDt[3],
+ short asFCpnDt[3],
+ double dCpn,
+ short *psNoPer,
+ double *pdExt,
+ double *pdAI,
+ double *pdAI2,
+ double *pdFCpn,
+ short *psRcode)
+{
+
+ short ercode = 0;
+ int isactact;
+ short days_to_next_cpn = 0;
+ const short discDaytype = CM_DISCOUNTING_DAYTYP;
+ int j;
+
+ if(bbit_calc_sx_b24__value())
+ isactact = (dtyp_is_actact_(&sDayType) != 0);
+ else
+ isactact = (sDayType == 1 || sDayType == 10);
+
+ short days_in_current_period = difday_(&sDayType,CM_FLPRV,CM_FLNXT,&ercode);
+ const short sfreq1 = (CM_CTUP_GOOD_TO_GO == 1 && CM_PAYMENT_FREQUENCY == 1);
+
+ for (j = 0; j < CM_FNUM; j++) {
+
+ if(j == 0) {
+ days_to_next_cpn = difday_(&sDayType,asSettleDt,CM_FLNXT,&ercode);
+
+ if(isactact) {
+ CM_FIFLX[j] = CM_FLCPN / sFreq;
+ CM_FEXTX[j] = (double)days_to_next_cpn / (double)days_in_current_period;
+ }
+ else {
+ CM_FIFLX[j] = CM_FLCPN * days_in_current_period;
+ CM_FEXTX[j] = (double)days_to_next_cpn / (double)(1/sfreq1);
+ }
+
+ if(CM_FNUM == 1) {
+ CM_FEXTX[j] = (double)days_to_next_cpn / ((double)1/sfreq1);
+ }
+ }
+ else {
+
+ short days_from_settle, days_in_period;
+
+ if(bbit_calc_dr_d46__value()){
+ days_from_settle = difday_(&sDayType,asSettleDt,
+ &CM_FSHDT[j*3],&ercode);
+ days_in_period = difday_(&sDayType,&CM_FSHDT[(j-1)*3],
+ &CM_FSHDT[j*3],&ercode);
+ }
+
+ double cpn_rate = CM_PLIBOR;
+
+ if(bbit_calc_dr_d62__value()) {
+ if(j < CM_FLCNT && CM_FLT_RFIXRATES[j] != 0) cpn_rate = CM_FLT_RFIXRATES[j];
+ }
+ else {
+ if(j < CM_FLCNT ) cpn_rate = CM_FLT_RFIXRATES[j];
+ }
+
+ if(bbit_calc_dr_d37__value()&& j >= CM_FLCNT && sCalcType == 1570) {
+ cpn_rate = CM_PLIBOR + CM_QMRG;
+
+ if(bbit_calc_dr_d36__value()){
+ double projected_rate = pow((1 + CM_PLIBOR/100.0),
+ (days_in_period)) - 1;
+
+ projected_rate = projected_rate + CM_QMRG/100.0 * days_in_period;
+ cpn_rate = 100 * projected_rate * (1/days_in_period);
+ }
+ }
+
+
+ if(isactact) {
+ CM_FIFLX[j] = cpn_rate / sFreq;
+ CM_FEXTX[j] = CM_FEXTX[j-1] + 1;
+
+ if(bbit_calc_dr_d46__value() && discDaytype != 0) {
+ CM_FEXTX[j] = (double)days_from_settle / (double)(1/sfreq1);
+ }
+ }
+ else {
+ if(!bbit_calc_dr_d46__value()){
+ days_from_settle = difday_(&sDayType,asSettleDt,
+ &CM_FSHDT[j*3],&ercode);
+ days_in_period = difday_(&sDayType,&CM_FSHDT[(j-1)*3],
+ &CM_FSHDT[j*3],&ercode);
+
+ }
+
+ CM_FIFLX[j] = cpn_rate * days_in_period;
+ CM_FEXTX[j] = (double)days_from_settle / (double)(1/sfreq1);
+ }
+
+ }
+
+ if(bbit_calc_dr_d33__value() && CM_CTUP_GOOD_TO_GO != 0) {
+ CM_FIFLX[j] = rnd_trunc_numb (CM_FIFLX[j], 0, 0);
+ }
+
+ }
+
+
+ short accrued_days = difday_(&sDayType,CM_FLPRV,asSettleDt,&ercode);
+
+ if(!bbit_calc_dr_d47__value()) {
+ if(isactact) {
+ *pdAI = (CM_FLCPN / sFreq)* accrued_days / ((double)days_in_current_period);
+ }
+ else{
+ *pdAI = (CM_FLCPN / sFreq)* accrued_days / ((double)1/sFreq);
+ }
+ }
+
+ CM_EXDAY = days_to_next_cpn;
+ CM_BASIS = days_in_current_period;
+ datetrn_(CM_FLPRV,CM_PREV);
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr64507.c b/gcc/testsuite/gcc.target/sh/pr64507.c
new file mode 100644
index 00000000000..d3d93849bd3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr64507.c
@@ -0,0 +1,25 @@
+/* Check that the __builtin_strnlen returns 0 with with
+ non-constant 0 length. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern int snprintf(char *, int, const char *, ...);
+extern void abort (void);
+
+int main()
+ {
+ int i;
+ int cmp = 0;
+ char buffer[1024];
+ const char* s = "the string";
+
+ snprintf(buffer, 4, "%s", s);
+
+ for (i = 1; i < 4; i++)
+ cmp += __builtin_strncmp(buffer, s, i - 1);
+
+ if (cmp)
+ abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_mold_1.f90 b/gcc/testsuite/gfortran.dg/allocate_with_mold_1.f90
new file mode 100644
index 00000000000..2ea6d22b452
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_with_mold_1.f90
@@ -0,0 +1,47 @@
+! { dg-do run }
+!
+! Fixes a bug that emerged from the fix of PR62044 - see the PR. When
+! there was no default initializer, code-expr3 was set null and so the
+! vpointer was set to the vtable of the declared type, rather than that
+! of the MOLD expression.
+!
+! Contributed by but based on the original PR62044 testcase by
+! Paul Thomas <pault@gcc.gnu.org>
+!
+module GridImageSilo_Template
+ implicit none
+ type, public, abstract :: GridImageSiloTemplate
+ end type GridImageSiloTemplate
+end module GridImageSilo_Template
+
+module UnstructuredGridImageSilo_Form
+ use GridImageSilo_Template
+ implicit none
+ type, public, extends ( GridImageSiloTemplate ) :: &
+ UnstructuredGridImageSiloForm
+ end type UnstructuredGridImageSiloForm
+end module UnstructuredGridImageSilo_Form
+
+module UnstructuredGridImages
+ use UnstructuredGridImageSilo_Form
+! 5.0 branch contains UnstructuredGridImageForm => UnstructuredGridImageSiloForm
+contains
+ subroutine foo
+ class (GridImageSiloTemplate), allocatable :: a
+ type (UnstructuredGridImageSiloForm) :: b
+ integer :: i = 0
+ allocate (a, mold = b)
+ select type (a)
+ type is (UnstructuredGridImageSiloForm)
+ i = 1
+ class default
+ i = 2
+ end select
+ if (i .ne. 1) call abort
+ end subroutine
+end module UnstructuredGridImages
+
+ use UnstructuredGridImages
+ call foo
+end
+
diff --git a/gcc/testsuite/gfortran.dg/class_allocate_17.f90 b/gcc/testsuite/gfortran.dg/class_allocate_17.f90
new file mode 100644
index 00000000000..639ba80ea60
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_allocate_17.f90
@@ -0,0 +1,32 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! PR 60922: [4.9/5 regression] Memory leak with allocatable CLASS components
+!
+! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
+
+program test_leak
+ implicit none
+
+ type d_base_vect_type
+ end type
+
+ type d_vect_type
+ class(d_base_vect_type), allocatable :: v
+ end type
+
+ call test()
+
+contains
+
+ subroutine test()
+ class(d_vect_type), allocatable :: x
+ allocate(x)
+ allocate(x%v)
+ print *,"allocated!"
+ end subroutine
+
+end
+
+! { dg-final { scan-tree-dump-times "fini_coarray" 1 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/class_allocate_18.f90 b/gcc/testsuite/gfortran.dg/class_allocate_18.f90
new file mode 100644
index 00000000000..ad3f76c3083
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_allocate_18.f90
@@ -0,0 +1,21 @@
+! { dg-do run }
+!
+! PR 64230: [4.9/5 Regression] Invalid memory reference in a compiler-generated finalizer for allocatable component
+!
+! Contributed by Mat Cross <mathewc@nag.co.uk>
+
+Program main
+ Implicit None
+ Type :: t1
+ End Type
+ Type, Extends (t1) :: t2
+ Integer, Allocatable :: i
+ End Type
+ Type, Extends (t2) :: t3
+ Integer, Allocatable :: j
+ End Type
+ Class (t1), Allocatable :: t
+ Allocate (t3 :: t)
+ print *,"allocated!"
+ Deallocate (t)
+End
diff --git a/gcc/testsuite/gfortran.dg/coarray_36.f b/gcc/testsuite/gfortran.dg/coarray_36.f
new file mode 100644
index 00000000000..d06a01ec6bc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_36.f
@@ -0,0 +1,347 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+!
+! PR fortran/64771
+!
+! Contributed by Alessandro Fanfarill
+!
+! Reduced version of the full NAS CG benchmark
+!
+
+!-------------------------------------------------------------------------!
+! !
+! N A S P A R A L L E L B E N C H M A R K S 3.3 !
+! !
+! C G !
+! !
+!-------------------------------------------------------------------------!
+! !
+! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. !
+! It is described in NAS Technical Reports 95-020 and 02-007 !
+! !
+! Permission to use, copy, distribute and modify this software !
+! for any purpose with or without fee is hereby granted. We !
+! request, however, that all derived work reference the NAS !
+! Parallel Benchmarks 3.3. This software is provided "as is" !
+! without express or implied warranty. !
+! !
+! Information on NPB 3.3, including the technical report, the !
+! original specifications, source code, results and information !
+! on how to submit new results, is available at: !
+! !
+! http://www.nas.nasa.gov/Software/NPB/ !
+! !
+! Send comments or suggestions to npb@nas.nasa.gov !
+! !
+! NAS Parallel Benchmarks Group !
+! NASA Ames Research Center !
+! Mail Stop: T27A-1 !
+! Moffett Field, CA 94035-1000 !
+! !
+! E-mail: npb@nas.nasa.gov !
+! Fax: (650) 604-3957 !
+! !
+!-------------------------------------------------------------------------!
+
+
+c---------------------------------------------------------------------
+c
+c Authors: M. Yarrow
+c C. Kuszmaul
+c R. F. Van der Wijngaart
+c H. Jin
+c
+c---------------------------------------------------------------------
+
+
+c---------------------------------------------------------------------
+c---------------------------------------------------------------------
+ program cg
+c---------------------------------------------------------------------
+c---------------------------------------------------------------------
+ implicit none
+
+ integer na, nonzer, niter
+ double precision shift, rcond
+ parameter( na=75000,
+ > nonzer=13,
+ > niter=75,
+ > shift=60.,
+ > rcond=1.0d-1 )
+
+
+
+ integer num_proc_rows, num_proc_cols
+ parameter( num_proc_rows = 2, num_proc_cols = 2)
+ integer num_procs
+ parameter( num_procs = num_proc_cols * num_proc_rows )
+
+ integer nz
+ parameter( nz = na*(nonzer+1)/num_procs*(nonzer+1)+nonzer
+ > + na*(nonzer+2+num_procs/256)/num_proc_cols )
+
+ common / partit_size / naa, nzz,
+ > npcols, nprows,
+ > proc_col, proc_row,
+ > firstrow,
+ > lastrow,
+ > firstcol,
+ > lastcol,
+ > exch_proc,
+ > exch_recv_length,
+ > send_start,
+ > send_len
+ integer naa, nzz,
+ > npcols, nprows,
+ > proc_col, proc_row,
+ > firstrow,
+ > lastrow,
+ > firstcol,
+ > lastcol,
+ > exch_proc,
+ > exch_recv_length,
+ > send_start,
+ > send_len
+
+
+ common / main_int_mem / colidx, rowstr,
+ > iv, arow, acol
+ integer colidx(nz), rowstr(na+1),
+ > iv(2*na+1), arow(nz), acol(nz)
+
+
+c---------------------------------
+c Coarray Decalarations
+c---------------------------------
+ double precision v(na+1)[0:*], aelt(nz)[0:*], a(nz)[0:*],
+ > x(na/num_proc_rows+2)[0:*],
+ > z(na/num_proc_rows+2)[0:*],
+ > p(na/num_proc_rows+2)[0:*],
+ > q(na/num_proc_rows+2)[0:*],
+ > r(na/num_proc_rows+2)[0:*],
+ > w(na/num_proc_rows+2)[0:*]
+
+
+ common /urando/ amult, tran
+ double precision amult, tran
+
+
+
+ integer l2npcols
+ integer reduce_exch_proc(num_proc_cols)
+ integer reduce_send_starts(num_proc_cols)
+ integer reduce_send_lengths(num_proc_cols)
+ integer reduce_recv_lengths(num_proc_cols)
+ integer reduce_rrecv_starts(num_proc_cols)
+c---------------------------------
+c Coarray Decalarations
+c---------------------------------
+ integer reduce_recv_starts(num_proc_cols)[0:*]
+
+ integer i, j, k, it, me, nprocs, root
+
+ double precision zeta, randlc
+ external randlc
+ double precision rnorm
+c---------------------------------
+c Coarray Decalarations
+c---------------------------------
+ double precision norm_temp1(2)[0:*], norm_temp2(2)[0:*]
+
+ double precision t, tmax, mflops
+ double precision u(1), umax(1)
+ external timer_read
+ double precision timer_read
+ character class
+ logical verified
+ double precision zeta_verify_value, epsilon, err
+
+c---------------------------------------------------------------------
+c Explicit interface for conj_grad, due to coarray args
+c---------------------------------------------------------------------
+ interface
+
+ subroutine conj_grad ( colidx,
+ > rowstr,
+ > x,
+ > z,
+ > a,
+ > p,
+ > q,
+ > r,
+ > w,
+ > rnorm,
+ > l2npcols,
+ > reduce_exch_proc,
+ > reduce_send_starts,
+ > reduce_send_lengths,
+ > reduce_recv_starts,
+ > reduce_recv_lengths,
+ > reduce_rrecv_starts )
+
+ common / partit_size / naa, nzz,
+ > npcols, nprows,
+ > proc_col, proc_row,
+ > firstrow,
+ > lastrow,
+ > firstcol,
+ > lastcol,
+ > exch_proc,
+ > exch_recv_length,
+ > send_start,
+ > send_len
+
+ integer naa, nzz,
+ > npcols, nprows,
+ > proc_col, proc_row,
+ > firstrow,
+ > lastrow,
+ > firstcol,
+ > lastcol,
+ > exch_proc,
+ > exch_recv_length,
+ > send_start,
+ > send_len
+
+ double precision x(*),
+ > z(*),
+ > a(nzz)
+ integer colidx(nzz), rowstr(naa+1)
+
+ double precision p(*),
+ > q(*)[0:*],
+ > r(*)[0:*],
+ > w(*)[0:*] ! used as work temporary
+
+ integer l2npcols
+ integer reduce_exch_proc(l2npcols)
+ integer reduce_send_starts(l2npcols)
+ integer reduce_send_lengths(l2npcols)
+ integer reduce_recv_starts(l2npcols)[0:*]
+ integer reduce_recv_lengths(l2npcols)
+ integer reduce_rrecv_starts(l2npcols)
+
+ double precision rnorm
+
+ end subroutine
+
+ end interface
+
+c---------------------------------------------------------------------
+c The call to the conjugate gradient routine:
+c---------------------------------------------------------------------
+ call conj_grad ( colidx,
+ > rowstr,
+ > x,
+ > z,
+ > a,
+ > p,
+ > q,
+ > r,
+ > w,
+ > rnorm,
+ > l2npcols,
+ > reduce_exch_proc,
+ > reduce_send_starts,
+ > reduce_send_lengths,
+ > reduce_recv_starts,
+ > reduce_recv_lengths,
+ > reduce_rrecv_starts )
+
+
+ sync all
+
+ end ! end main
+
+c---------------------------------------------------------------------
+c---------------------------------------------------------------------
+ subroutine conj_grad ( colidx,
+ > rowstr,
+ > x,
+ > z,
+ > a,
+ > p,
+ > q,
+ > r,
+ > w,
+ > rnorm,
+ > l2npcols,
+ > reduce_exch_proc,
+ > reduce_send_starts,
+ > reduce_send_lengths,
+ > reduce_recv_starts,
+ > reduce_recv_lengths,
+ > reduce_rrecv_starts )
+c---------------------------------------------------------------------
+c---------------------------------------------------------------------
+
+c---------------------------------------------------------------------
+c Floaging point arrays here are named as in NPB1 spec discussion of
+c CG algorithm
+c---------------------------------------------------------------------
+
+ implicit none
+
+c include 'cafnpb.h'
+
+ common / partit_size / naa, nzz,
+ > npcols, nprows,
+ > proc_col, proc_row,
+ > firstrow,
+ > lastrow,
+ > firstcol,
+ > lastcol,
+ > exch_proc,
+ > exch_recv_length,
+ > send_start,
+ > send_len
+ integer naa, nzz,
+ > npcols, nprows,
+ > proc_col, proc_row,
+ > firstrow,
+ > lastrow,
+ > firstcol,
+ > lastcol,
+ > exch_proc,
+ > exch_recv_length,
+ > send_start,
+ > send_len
+
+
+
+ double precision x(*),
+ > z(*),
+ > a(nzz)
+ integer colidx(nzz), rowstr(naa+1)
+
+ double precision p(*),
+ > q(*)[0:*],
+ > r(*)[0:*],
+ > w(*)[0:*] ! used as work temporary
+
+ integer l2npcols
+ integer reduce_exch_proc(l2npcols)
+ integer reduce_send_starts(l2npcols)
+ integer reduce_send_lengths(l2npcols)
+ integer reduce_recv_starts(l2npcols)[0:*]
+ integer reduce_recv_lengths(l2npcols)
+ integer reduce_rrecv_starts(l2npcols)
+
+ integer recv_start_idx, recv_end_idx, send_start_idx,
+ > send_end_idx, recv_length
+
+ integer i, j, k, ierr
+ integer cgit, cgitmax
+
+ double precision, save :: d[0:*], rho[0:*]
+ double precision sum, rho0, alpha, beta, rnorm
+
+ external timer_read
+ double precision timer_read
+
+ data cgitmax / 25 /
+
+
+ return
+ end ! end of routine conj_grad
+
diff --git a/gcc/testsuite/gfortran.dg/coarray_37.f90 b/gcc/testsuite/gfortran.dg/coarray_37.f90
new file mode 100644
index 00000000000..6f56c323d2e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_37.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+ program cg
+ implicit none
+ integer reduce_recv_starts(2)[1,0:*]
+ interface
+ subroutine conj_grad (reduce_recv_starts) ! { dg-warning "Interface mismatch in global procedure 'conj_grad' at \\(1\\): Corank mismatch in argument 'reduce_recv_starts' \\(2/1\\)" }
+ integer reduce_recv_starts(2)[2, 2:*]
+ end subroutine
+ end interface
+ call conj_grad (reduce_recv_starts) ! Corank mismatch is okay
+ end
+
+ subroutine conj_grad (reduce_recv_starts)
+ implicit none
+ integer reduce_recv_starts(2)[2:*]
+ end
diff --git a/gcc/testsuite/gfortran.dg/dependency_45.f90 b/gcc/testsuite/gfortran.dg/dependency_45.f90
new file mode 100644
index 00000000000..8b43f7507b6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dependency_45.f90
@@ -0,0 +1,12 @@
+! { dg-do run }
+! { dg-options "-Warray-temporaries" }
+! PR 56867 - substrings were not checked for dependency.
+program main
+ character(len=4) :: a
+ character(len=4) :: c(3)
+ c(1) = 'abcd'
+ c(2) = '1234'
+ c(3) = 'wxyz'
+ c(:)(1:2) = c(2)(2:3) ! { dg-warning "array temporary" }
+ if (c(3) .ne. '23yz') call abort
+end program main
diff --git a/gcc/testsuite/gfortran.dg/internal_pack_15.f90 b/gcc/testsuite/gfortran.dg/internal_pack_15.f90
new file mode 100644
index 00000000000..13e33047e48
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/internal_pack_15.f90
@@ -0,0 +1,77 @@
+! { dg-do run }
+! { dg-options "-Warray-temporaries" }
+! PR 57023
+! This used to cause wrong packing because a(1:n,1:n) was
+! assumed to be a full array.
+module mymod
+ implicit none
+contains
+ subroutine foo1(a,n)
+ integer, dimension(n,n), intent(inout) :: a
+ integer :: n
+ n = n - 1
+ call baz(a(1:n,1:n),n) ! { dg-warning "array temporary" }
+ end subroutine foo1
+
+ subroutine foo2(a,n)
+ integer, dimension(n,n), intent(inout) :: a
+ integer :: n
+ call decrement(n)
+ call baz(a(1:n,1:n),n) ! { dg-warning "array temporary" }
+ end subroutine foo2
+
+ subroutine foo3(a,n)
+ integer, dimension(n,n), intent(inout) :: a
+ integer :: n, m
+ m = n - 1
+ call baz(a(1:m,1:m),m) ! { dg-warning "array temporary" }
+ end subroutine foo3
+
+ subroutine foo4(a,n)
+ integer, dimension(n,n), intent(inout) :: a
+ integer, intent(in) :: n
+ a(1:n,1:n) = 1
+ end subroutine foo4
+
+ subroutine baz(a,n)
+ integer, dimension(n,n), intent(inout) :: a
+ integer, intent(in) :: n
+ a = 1
+ end subroutine baz
+
+ subroutine decrement(n)
+ integer, intent(inout) :: n
+ n = n - 1
+ end subroutine decrement
+
+end module mymod
+
+program main
+ use mymod
+ implicit none
+ integer, dimension(5,5) :: a, b
+ integer :: n
+
+ b = 0
+ b(1:4,1:4) = 1
+
+ n = 5
+ a = 0
+ call foo1(a,n)
+ if (any(a /= b)) call abort
+
+ n = 5
+ a = 0
+ call foo2(a,n)
+ if (any(a /= b)) call abort
+
+ n = 5
+ a = 0
+ call foo3(a,n)
+ if (any(a /= b)) call abort
+
+ n = 5
+ a = 0
+ call foo4(a,n)
+ if (any(a /= 1)) call abort
+end program main
diff --git a/gcc/testsuite/gfortran.dg/pr64528.f90 b/gcc/testsuite/gfortran.dg/pr64528.f90
new file mode 100644
index 00000000000..f6cca4f73e0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr64528.f90
@@ -0,0 +1,20 @@
+! PR fortran/64528
+! { dg-do compile }
+! { dg-options "-O -fno-tree-dce -fno-tree-ccp" }
+
+program pr64528
+ interface
+ subroutine foo(x)
+ integer, value :: x
+ end subroutine foo
+ end interface
+ integer :: x
+ x = 10
+ call foo(x)
+ if(x .ne. 10) then
+ endif
+end program pr64528
+subroutine foo(x)
+ integer, value :: x
+ x = 11
+end subroutine foo
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_26.f90 b/gcc/testsuite/gfortran.dg/typebound_call_26.f90
new file mode 100644
index 00000000000..dffbf93e786
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_call_26.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+!
+! PR 64244: [4.8/4.9/5 Regression] ICE at class.c:236 when using non_overridable
+!
+! Contributed by Ondřej Čertík <ondrej.certik@gmail.com>
+
+module m
+ implicit none
+
+ type :: A
+ contains
+ generic :: f => g
+ procedure, non_overridable :: g
+ end type
+
+contains
+
+ subroutine g(this)
+ class(A), intent(in) :: this
+ end subroutine
+
+end module
+
+
+program test_non_overridable
+ use m, only: A
+ implicit none
+ class(A), allocatable :: h
+ call h%f()
+end
diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 b/gcc/testsuite/gfortran.dg/typebound_operator_20.f90
new file mode 100644
index 00000000000..26c49a188eb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_operator_20.f90
@@ -0,0 +1,53 @@
+! { dg-do run }
+!
+! PR 63733: [4.8/4.9/5 Regression] [OOP] wrong resolution for OPERATOR generics
+!
+! Original test case from Alberto F. Martín Huertas <amartin@cimne.upc.edu>
+! Slightly modified by Salvatore Filippone <sfilippone@uniroma2.it>
+! Further modified by Janus Weil <janus@gcc.gnu.org>
+
+module overwrite
+ type parent
+ contains
+ procedure :: sum => sum_parent
+ generic :: operator(+) => sum
+ end type
+
+ type, extends(parent) :: child
+ contains
+ procedure :: sum => sum_child
+ end type
+
+contains
+
+ integer function sum_parent(op1,op2)
+ implicit none
+ class(parent), intent(in) :: op1, op2
+ sum_parent = 0
+ end function
+
+ integer function sum_child(op1,op2)
+ implicit none
+ class(child) , intent(in) :: op1
+ class(parent), intent(in) :: op2
+ sum_child = 1
+ end function
+
+end module
+
+program drive
+ use overwrite
+ implicit none
+
+ type(parent) :: m1, m2
+ class(parent), pointer :: mres
+ type(child) :: h1, h2
+ class(parent), pointer :: hres
+
+ if (m1 + m2 /= 0) call abort()
+ if (h1 + m2 /= 1) call abort()
+ if (h1%sum(h2) /= 1) call abort()
+
+end
+
+! { dg-final { cleanup-modules "overwrite" } }
diff --git a/gcc/testsuite/gnat.dg/opt47.adb b/gcc/testsuite/gnat.dg/opt47.adb
new file mode 100644
index 00000000000..cfe44eb1e65
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt47.adb
@@ -0,0 +1,31 @@
+-- { dg-do run { target i?86-*-* x86_64-*-* alpha*-*-* ia64-*-* } }
+-- { dg-options "-O2" }
+
+with Ada.Characters.Handling; use Ada.Characters.Handling;
+with Interfaces; use Interfaces;
+with Ada.Unchecked_Conversion;
+
+procedure Opt47 is
+
+ subtype String4 is String (1 .. 4);
+ function To_String4 is new Ada.Unchecked_Conversion (Unsigned_32, String4);
+ type Arr is array (Integer range <>) of Unsigned_32;
+ Leaf : Arr (1 .. 4) := (1349478766, 1948272498, 1702436946, 1702061409);
+ Value : Unsigned_32;
+ Result : String (1 .. 32);
+ Last : Integer := 0;
+
+begin
+ for I in 1 .. 4 loop
+ Value := Leaf (I);
+ for J in reverse String4'Range loop
+ if Is_Graphic (To_String4 (Value)(J)) then
+ Last := Last + 1;
+ Result (Last) := To_String4 (Value)(J);
+ end if;
+ end loop;
+ end loop;
+ if Result (1) /= 'P' then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/unchecked_convert1.adb b/gcc/testsuite/gnat.dg/unchecked_convert1.adb
index eb63d59a884..1a02c195b7c 100644
--- a/gcc/testsuite/gnat.dg/unchecked_convert1.adb
+++ b/gcc/testsuite/gnat.dg/unchecked_convert1.adb
@@ -4,6 +4,7 @@
with Ada.Unchecked_Conversion;
procedure Unchecked_Convert1 is
+
type Byte is mod 2**8;
type Stream is array (Natural range <>) of Byte;
@@ -24,9 +25,10 @@ procedure Unchecked_Convert1 is
return Do_Sum (To_Chunk (S(S'First .. S'First + Rec'Size / 8 - 1)));
end;
- A : Stream (1..9);
+ A : Stream (1..9) := (others => 0);
I : Integer;
begin
+ A (9) := 1;
I := Sum (A(1..8));
end;
diff --git a/gcc/testsuite/go.test/go-test.exp b/gcc/testsuite/go.test/go-test.exp
index 1bbbd8742e2..25e38f08c06 100644
--- a/gcc/testsuite/go.test/go-test.exp
+++ b/gcc/testsuite/go.test/go-test.exp
@@ -241,7 +241,11 @@ proc go-set-goarch { } {
if [check_effective_target_ilp32] {
set goarch "ppc"
} else {
- set goarch "ppc64"
+ if [istarget "powerpc64le-*-*"] {
+ set goarch "ppc64le"
+ } else {
+ set goarch "ppc64"
+ }
}
}
"sparc*-*-*" {
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index fe6dc2886d6..73afb2384ea 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -164,6 +164,9 @@ static void *expand_regions (struct tm_region *,
static tree
get_attrs_for (const_tree x)
{
+ if (x == NULL_TREE)
+ return NULL_TREE;
+
switch (TREE_CODE (x))
{
case FUNCTION_DECL:
@@ -172,16 +175,16 @@ get_attrs_for (const_tree x)
default:
if (TYPE_P (x))
- return NULL;
+ return NULL_TREE;
x = TREE_TYPE (x);
if (TREE_CODE (x) != POINTER_TYPE)
- return NULL;
+ return NULL_TREE;
/* FALLTHRU */
case POINTER_TYPE:
x = TREE_TYPE (x);
if (TREE_CODE (x) != FUNCTION_TYPE && TREE_CODE (x) != METHOD_TYPE)
- return NULL;
+ return NULL_TREE;
/* FALLTHRU */
case FUNCTION_TYPE:
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 70567131d73..99c3d0f3eb9 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1534,7 +1534,8 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
use_operand_p use_p;
if (!tree_fits_shwi_p (val2)
- || !tree_fits_uhwi_p (len2))
+ || !tree_fits_uhwi_p (len2)
+ || compare_tree_int (len2, 1024) == 1)
break;
if (is_gimple_call (stmt1))
{
@@ -1600,7 +1601,8 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
is not constant, or is bigger than memcpy length, bail out. */
if (diff == NULL
|| !tree_fits_uhwi_p (diff)
- || tree_int_cst_lt (len1, diff))
+ || tree_int_cst_lt (len1, diff)
+ || compare_tree_int (diff, 1024) == 1)
break;
/* Use maximum of difference plus memset length and memcpy length
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 57a58b152db..2f93c7e9593 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -7172,7 +7172,7 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt)
tree type = TREE_TYPE (op0);
value_range_t *vr0 = get_value_range (op0);
- if (vr0->type != VR_VARYING
+ if (vr0->type == VR_RANGE
&& INTEGRAL_TYPE_P (type)
&& vrp_val_is_min (vr0->min)
&& vrp_val_is_max (vr0->max)
diff --git a/gcc/tree.c b/gcc/tree.c
index 5ce8e902b33..293b29f8e6f 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -6215,8 +6215,11 @@ build_qualified_type (tree type, int type_quals)
else if (TYPE_CANONICAL (type) != type)
/* Build the underlying canonical type, since it is different
from TYPE. */
- TYPE_CANONICAL (t) = build_qualified_type (TYPE_CANONICAL (type),
- type_quals);
+ {
+ tree c = build_qualified_type (TYPE_CANONICAL (type),
+ type_quals);
+ TYPE_CANONICAL (t) = TYPE_CANONICAL (c);
+ }
else
/* T is its own canonical type. */
TYPE_CANONICAL (t) = t;
diff --git a/gcc/tsan.c b/gcc/tsan.c
index 2e32cd2b32f..dbda9c81ed2 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -651,25 +651,24 @@ instrument_memory_accesses (void)
static void
instrument_func_entry (void)
{
- basic_block succ_bb;
- gimple_stmt_iterator gsi;
tree ret_addr, builtin_decl;
gimple g;
-
- succ_bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
- gsi = gsi_after_labels (succ_bb);
+ gimple_seq seq = NULL;
builtin_decl = builtin_decl_implicit (BUILT_IN_RETURN_ADDRESS);
g = gimple_build_call (builtin_decl, 1, integer_zero_node);
ret_addr = make_ssa_name (ptr_type_node, NULL);
gimple_call_set_lhs (g, ret_addr);
gimple_set_location (g, cfun->function_start_locus);
- gsi_insert_before (&gsi, g, GSI_SAME_STMT);
+ gimple_seq_add_stmt_without_update (&seq, g);
- builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_FUNC_ENTRY);
+ builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_FUNC_ENTRY);
g = gimple_build_call (builtin_decl, 1, ret_addr);
gimple_set_location (g, cfun->function_start_locus);
- gsi_insert_before (&gsi, g, GSI_SAME_STMT);
+ gimple_seq_add_stmt_without_update (&seq, g);
+
+ edge e = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun));
+ gsi_insert_seq_on_edge_immediate (e, seq);
}
/* Instruments function exits. */
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 6be97eaa556..de4c8f519fa 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-21 Andrew Waterman <waterman@cs.berkeley.edu>
+
+ * fop_n.c (libat_fetch_op): Align address to word boundary.
+ (libat_op_fetch): Likewise.
+
2014-10-30 Release Manager
* GCC 4.9.2 released.
diff --git a/libatomic/fop_n.c b/libatomic/fop_n.c
index 4a18da97cc5..9739b9cf4b3 100644
--- a/libatomic/fop_n.c
+++ b/libatomic/fop_n.c
@@ -112,9 +112,9 @@ SIZE(C2(libat_fetch_,NAME)) (UTYPE *mptr, UTYPE opval, int smodel)
pre_barrier (smodel);
- wptr = (UWORD *)mptr;
- shift = 0;
- mask = -1;
+ wptr = (UWORD *)((uintptr_t)mptr & -WORDSIZE);
+ shift = (((uintptr_t)mptr % WORDSIZE) * CHAR_BIT) ^ SIZE(INVERT_MASK);
+ mask = SIZE(MASK) << shift;
wopval = (UWORD)opval << shift;
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
@@ -136,9 +136,9 @@ SIZE(C3(libat_,NAME,_fetch)) (UTYPE *mptr, UTYPE opval, int smodel)
pre_barrier (smodel);
- wptr = (UWORD *)mptr;
- shift = 0;
- mask = -1;
+ wptr = (UWORD *)((uintptr_t)mptr & -WORDSIZE);
+ shift = (((uintptr_t)mptr % WORDSIZE) * CHAR_BIT) ^ SIZE(INVERT_MASK);
+ mask = SIZE(MASK) << shift;
wopval = (UWORD)opval << shift;
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index f73ab03b73d..90826b5b4d6 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-26 Matthias Klose <doko@ubuntu.com>
+
+ * configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
+ * configure: Regenerate.
+
2014-10-30 Release Manager
* GCC 4.9.2 released.
diff --git a/libbacktrace/configure b/libbacktrace/configure
index f4f9d058ec8..57a0f940f34 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -614,7 +614,6 @@ PIC_FLAG
WARN_FLAGS
EXTRA_FLAGS
BACKTRACE_FILE
-multi_basedir
OTOOL64
OTOOL
LIPO
@@ -680,6 +679,7 @@ build_os
build_vendor
build_cpu
build
+multi_basedir
target_alias
host_alias
build_alias
@@ -721,6 +721,7 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
+enable_multilib
enable_maintainer_mode
with_target_subdir
enable_shared
@@ -729,7 +730,6 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
-enable_multilib
with_system_libunwind
enable_host_shared
'
@@ -1362,6 +1362,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-multilib build many library versions (default)
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
--enable-shared[=PKGS] build shared libraries [default=no]
@@ -1369,7 +1370,6 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
- --enable-multilib build many library versions (default)
--enable-host-shared build host code as shared libraries
Optional Packages:
@@ -2453,6 +2453,46 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h"
+if test -n "${with_target_subdir}"; then
+ # Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+ enableval=$enable_multilib; case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop.."
+ fi
+else
+ multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+fi
+
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
for ac_t in install-sh install.sh shtool; do
@@ -11089,7 +11129,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11092 "configure"
+#line 11132 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11195,7 +11235,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11198 "configure"
+#line 11238 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11439,43 +11479,6 @@ backtrace_supported=yes
if test -n "${with_target_subdir}"; then
# We are compiling a GCC library. We can assume that the unwind
# library exists.
- # Default to --enable-multilib
-# Check whether --enable-multilib was given.
-if test "${enable_multilib+set}" = set; then :
- enableval=$enable_multilib; case "$enableval" in
- yes) multilib=yes ;;
- no) multilib=no ;;
- *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
- esac
-else
- multilib=yes
-fi
-
-
-# We may get other options which we leave undocumented:
-# --with-target-subdir, --with-multisrctop, --with-multisubdir
-# See config-ml.in if you want the gory details.
-
-if test "$srcdir" = "."; then
- if test "$with_target_subdir" != "."; then
- multi_basedir="$srcdir/$with_multisrctop../.."
- else
- multi_basedir="$srcdir/$with_multisrctop.."
- fi
-else
- multi_basedir="$srcdir/.."
-fi
-
-
-# Even if the default multilib is not a cross compilation,
-# it may be that some of the other multilibs are.
-if test $cross_compiling = no && test $multilib = yes \
- && test "x${with_multisubdir}" != x ; then
- cross_compiling=maybe
-fi
-
-ac_config_commands="$ac_config_commands default-1"
-
BACKTRACE_FILE="backtrace.lo simple.lo"
else
ac_fn_c_check_header_mongrel "$LINENO" "unwind.h" "ac_cv_header_unwind_h" "$ac_includes_default"
@@ -13174,6 +13177,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# INIT-COMMANDS
#
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
+
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
@@ -13434,20 +13451,6 @@ fi
-srcdir="$srcdir"
-host="$host"
-target="$target"
-with_multisubdir="$with_multisubdir"
-with_multisrctop="$with_multisrctop"
-with_target_subdir="$with_target_subdir"
-ac_configure_args="${multilib_arg} ${ac_configure_args}"
-multi_basedir="$multi_basedir"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-CC="$CC"
-CXX="$CXX"
-GFORTRAN="$GFORTRAN"
-GCJ="$GCJ"
-
GCC="$GCC"
CC="$CC"
acx_cv_header_stdint="$acx_cv_header_stdint"
@@ -13480,8 +13483,8 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
- "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"backtrace-supported.h") CONFIG_FILES="$CONFIG_FILES backtrace-supported.h" ;;
@@ -14070,6 +14073,14 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
"libtool":C)
# See if we are running on zsh, and set the options which allow our
@@ -14709,14 +14720,6 @@ _LT_EOF
chmod +x "$ofile"
;;
- "default-1":C)
-# Only add multilib support code if we just rebuilt the top-level
-# Makefile.
-case " $CONFIG_FILES " in
- *" Makefile "*)
- ac_file=Makefile . ${multi_basedir}/config-ml.in
- ;;
-esac ;;
"gstdint.h":C)
if test "$GCC" = yes; then
echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 878bd2c1580..40b4d547c96 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -34,6 +34,10 @@ AC_INIT(package-unused, version-unused,, libbacktrace)
AC_CONFIG_SRCDIR(backtrace.h)
AC_CONFIG_HEADER(config.h)
+if test -n "${with_target_subdir}"; then
+ AM_ENABLE_MULTILIB(, ..)
+fi
+
AC_CANONICAL_SYSTEM
target_alias=${target_alias-$host_alias}
@@ -83,7 +87,6 @@ backtrace_supported=yes
if test -n "${with_target_subdir}"; then
# We are compiling a GCC library. We can assume that the unwind
# library exists.
- AM_ENABLE_MULTILIB(, ..)
BACKTRACE_FILE="backtrace.lo simple.lo"
else
AC_CHECK_HEADER([unwind.h],
diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog
index 2b7bc436797..375085cb345 100644
--- a/libcilkrts/ChangeLog
+++ b/libcilkrts/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-26 Matthias Klose <doko@ubuntu.com>
+
+ * configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
+ * configure: Regenerate.
+
2014-10-30 Release Manager
* GCC 4.9.2 released.
diff --git a/libcilkrts/configure b/libcilkrts/configure
index 0dadbbda035..31f848ec46c 100644
--- a/libcilkrts/configure
+++ b/libcilkrts/configure
@@ -634,7 +634,6 @@ EGREP
GREP
CPP
ALLOCA
-multi_basedir
am__fastdepCXX_FALSE
am__fastdepCXX_TRUE
CXXDEPMODE
@@ -657,6 +656,7 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
+multi_basedir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -737,8 +737,8 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_maintainer_mode
-enable_dependency_tracking
enable_multilib
+enable_dependency_tracking
enable_version_specific_runtime_libs
enable_shared
enable_static
@@ -1383,9 +1383,9 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
+ --enable-multilib build many library versions (default)
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
- --enable-multilib build many library versions (default)
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
in a compi ler-specific directory
@@ -2873,6 +2873,44 @@ fi
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+ enableval=$enable_multilib; case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop.."
+ fi
+else
+ multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
# Build a DLL on Windows
# AC_LIBTOOL_WIN32_DLL
ac_ext=c
@@ -4217,43 +4255,6 @@ fi
# AC_CONFIG_MACRO_DIR([..])
ac_config_files="$ac_config_files Makefile libcilkrts.spec"
-# Default to --enable-multilib
-# Check whether --enable-multilib was given.
-if test "${enable_multilib+set}" = set; then :
- enableval=$enable_multilib; case "$enableval" in
- yes) multilib=yes ;;
- no) multilib=no ;;
- *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
- esac
-else
- multilib=yes
-fi
-
-
-# We may get other options which we leave undocumented:
-# --with-target-subdir, --with-multisrctop, --with-multisubdir
-# See config-ml.in if you want the gory details.
-
-if test "$srcdir" = "."; then
- if test "$with_target_subdir" != "."; then
- multi_basedir="$srcdir/$with_multisrctop../.."
- else
- multi_basedir="$srcdir/$with_multisrctop.."
- fi
-else
- multi_basedir="$srcdir/.."
-fi
-
-
-# Even if the default multilib is not a cross compilation,
-# it may be that some of the other multilibs are.
-if test $cross_compiling = no && test $multilib = yes \
- && test "x${with_multisubdir}" != x ; then
- cross_compiling=maybe
-fi
-
-ac_config_commands="$ac_config_commands default-1"
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -11057,7 +11058,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11060 "configure"
+#line 11061 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11163,7 +11164,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11166 "configure"
+#line 11167 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15232,7 +15233,6 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
srcdir="$srcdir"
host="$host"
@@ -15247,6 +15247,7 @@ CC="$CC"
CXX="$CXX"
GFORTRAN="$GFORTRAN"
GCJ="$GCJ"
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
# The HP-UX ksh and POSIX shell print the target directory to stdout
@@ -15616,10 +15617,10 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"libcilkrts.spec") CONFIG_FILES="$CONFIG_FILES libcilkrts.spec" ;;
- "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -16039,6 +16040,14 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
"depfiles":C) test x"$AMDEP_TRUE" != x"" || {
# Autoconf 2.62 quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
@@ -16134,14 +16143,6 @@ $as_echo X"$file" |
done
}
;;
- "default-1":C)
-# Only add multilib support code if we just rebuilt the top-level
-# Makefile.
-case " $CONFIG_FILES " in
- *" Makefile "*)
- ac_file=Makefile . ${multi_basedir}/config-ml.in
- ;;
-esac ;;
"libtool":C)
# See if we are running on zsh, and set the options which allow our
diff --git a/libcilkrts/configure.ac b/libcilkrts/configure.ac
index fb215052dd6..369d94ab2f0 100644
--- a/libcilkrts/configure.ac
+++ b/libcilkrts/configure.ac
@@ -43,6 +43,8 @@ AM_INIT_AUTOMAKE(foreign no-dist)
AM_MAINTAINER_MODE
+AM_ENABLE_MULTILIB(, ..)
+
# Build a DLL on Windows
# AC_LIBTOOL_WIN32_DLL
AC_PROG_CC
@@ -50,7 +52,6 @@ AC_PROG_CXX
# AC_PROG_LIBTOOL
# AC_CONFIG_MACRO_DIR([..])
AC_CONFIG_FILES([Makefile libcilkrts.spec])
-AM_ENABLE_MULTILIB(, ..)
AC_FUNC_ALLOCA
# Check whether the target supports protected visibility.
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index d729ccbc761..1a02eb4322e 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,33 @@
+2015-02-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2015-01-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/cpuinfo.c (processor_subtypes): Add
+ INTEL_COREI7_BROADWELL.
+ (get_intel_cpu): Support new Silvermont, Haswell and Broadwell
+ model numbers.
+
+2015-01-31 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/linux-atomic.c (__kernel_cmpxchg2): Change declaration of
+ oldval and newval to const void *. Fix typo.
+ (FETCH_AND_OP_2): Use __atomic_load_n to load value.
+ (FETCH_AND_OP_WORD): Likewise.
+ (OP_AND_FETCH_WORD): Likewise.
+ (COMPARE_AND_SWAP_2): Likewise.
+ (__sync_val_compare_and_swap_4): Likewise.
+ (__sync_lock_test_and_set_4): Likewise.
+ (SYNC_LOCK_RELEASE_2): Likewise.
+ Remove support for long long atomic operations.
+
+2015-01-20 Chung-Lin Tang <cltang@codesourcery.com>
+
+ Backport from mainline
+ * config/nios2/linux-unwind.h (nios2_fallback_frame_state):
+ Update rt_sigframe format and address for current Nios II
+ Linux conventions.
+
2014-12-09 John David Anglin <danglin@gcc.gnu.org>
Backport from mainline
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 6ff7502bb9a..7972cedaa11 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -75,6 +75,7 @@ enum processor_subtypes
AMDFAM15H_BDVER4,
INTEL_COREI7_IVYBRIDGE,
INTEL_COREI7_HASWELL,
+ INTEL_COREI7_BROADWELL,
CPU_SUBTYPE_MAX
};
@@ -184,7 +185,10 @@ get_intel_cpu (unsigned int family, unsigned int model, unsigned int brand_id)
__cpu_model.__cpu_type = INTEL_BONNELL;
break;
case 0x37:
+ case 0x4a:
case 0x4d:
+ case 0x5a:
+ case 0x5d:
/* Silvermont. */
__cpu_model.__cpu_type = INTEL_SILVERMONT;
break;
@@ -216,12 +220,20 @@ get_intel_cpu (unsigned int family, unsigned int model, unsigned int brand_id)
__cpu_model.__cpu_subtype = INTEL_COREI7_IVYBRIDGE;
break;
case 0x3c:
+ case 0x3f:
case 0x45:
case 0x46:
/* Haswell. */
__cpu_model.__cpu_type = INTEL_COREI7;
__cpu_model.__cpu_subtype = INTEL_COREI7_HASWELL;
break;
+ case 0x3d:
+ case 0x4f:
+ case 0x56:
+ /* Broadwell. */
+ __cpu_model.__cpu_type = INTEL_COREI7;
+ __cpu_model.__cpu_subtype = INTEL_COREI7_BROADWELL;
+ break;
case 0x17:
case 0x1d:
/* Penryn. */
diff --git a/libgcc/config/nios2/linux-unwind.h b/libgcc/config/nios2/linux-unwind.h
index 92ff1f62982..ba4bd801dee 100644
--- a/libgcc/config/nios2/linux-unwind.h
+++ b/libgcc/config/nios2/linux-unwind.h
@@ -67,10 +67,9 @@ nios2_fallback_frame_state (struct _Unwind_Context *context,
if (pc[0] == (0x00800004 | (__NR_rt_sigreturn << 6)))
{
struct rt_sigframe {
- char retcode[12];
siginfo_t info;
struct nios2_ucontext uc;
- } *rt_ = context->ra;
+ } *rt_ = context->cfa;
struct nios2_mcontext *regs = &rt_->uc.uc_mcontext;
int i;
diff --git a/libgcc/config/pa/linux-atomic.c b/libgcc/config/pa/linux-atomic.c
index 19e37b6f3c4..2554f4607eb 100644
--- a/libgcc/config/pa/linux-atomic.c
+++ b/libgcc/config/pa/linux-atomic.c
@@ -73,7 +73,8 @@ __kernel_cmpxchg (int oldval, int newval, int *mem)
}
static inline long
-__kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
+__kernel_cmpxchg2 (const void *oldval, const void *newval, void *mem,
+ int val_size)
{
register unsigned long lws_mem asm("r26") = (unsigned long) (mem);
register long lws_ret asm("r28");
@@ -90,7 +91,7 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
if (__builtin_expect (lws_errno == -EFAULT || lws_errno == -ENOSYS, 0))
__builtin_trap ();
- /* If the kernel LWS call fails, retrun EBUSY */
+ /* If the kernel LWS call fails, return EBUSY */
if (!lws_errno && lws_ret)
lws_errno = -EBUSY;
@@ -113,7 +114,7 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
int failure; \
\
do { \
- tmp = *ptr; \
+ tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
newval = PFX_OP (tmp INF_OP val); \
failure = __kernel_cmpxchg2 (&tmp, &newval, ptr, INDEX); \
} while (failure != 0); \
@@ -121,13 +122,6 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
return tmp; \
}
-FETCH_AND_OP_2 (add, , +, long long, 8, 3)
-FETCH_AND_OP_2 (sub, , -, long long, 8, 3)
-FETCH_AND_OP_2 (or, , |, long long, 8, 3)
-FETCH_AND_OP_2 (and, , &, long long, 8, 3)
-FETCH_AND_OP_2 (xor, , ^, long long, 8, 3)
-FETCH_AND_OP_2 (nand, ~, &, long long, 8, 3)
-
FETCH_AND_OP_2 (add, , +, short, 2, 1)
FETCH_AND_OP_2 (sub, , -, short, 2, 1)
FETCH_AND_OP_2 (or, , |, short, 2, 1)
@@ -150,7 +144,7 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0)
int failure; \
\
do { \
- tmp = *ptr; \
+ tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
newval = PFX_OP (tmp INF_OP val); \
failure = __kernel_cmpxchg2 (&tmp, &newval, ptr, INDEX); \
} while (failure != 0); \
@@ -158,13 +152,6 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0)
return PFX_OP (tmp INF_OP val); \
}
-OP_AND_FETCH_2 (add, , +, long long, 8, 3)
-OP_AND_FETCH_2 (sub, , -, long long, 8, 3)
-OP_AND_FETCH_2 (or, , |, long long, 8, 3)
-OP_AND_FETCH_2 (and, , &, long long, 8, 3)
-OP_AND_FETCH_2 (xor, , ^, long long, 8, 3)
-OP_AND_FETCH_2 (nand, ~, &, long long, 8, 3)
-
OP_AND_FETCH_2 (add, , +, short, 2, 1)
OP_AND_FETCH_2 (sub, , -, short, 2, 1)
OP_AND_FETCH_2 (or, , |, short, 2, 1)
@@ -186,7 +173,7 @@ OP_AND_FETCH_2 (nand, ~, &, signed char, 1, 0)
int failure, tmp; \
\
do { \
- tmp = *ptr; \
+ tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
} while (failure != 0); \
\
@@ -207,7 +194,7 @@ FETCH_AND_OP_WORD (nand, ~, &)
int tmp, failure; \
\
do { \
- tmp = *ptr; \
+ tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
} while (failure != 0); \
\
@@ -233,7 +220,7 @@ typedef unsigned char bool;
\
while (1) \
{ \
- actual_oldval = *ptr; \
+ actual_oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
\
if (__builtin_expect (oldval != actual_oldval, 0)) \
return actual_oldval; \
@@ -242,7 +229,7 @@ typedef unsigned char bool;
\
if (__builtin_expect (!fail, 1)) \
return actual_oldval; \
- } \
+ } \
} \
\
bool HIDDEN \
@@ -253,7 +240,6 @@ typedef unsigned char bool;
return (failure != 0); \
}
-COMPARE_AND_SWAP_2 (long long, 8, 3)
COMPARE_AND_SWAP_2 (short, 2, 1)
COMPARE_AND_SWAP_2 (char, 1, 0)
@@ -264,7 +250,7 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
while (1)
{
- actual_oldval = *ptr;
+ actual_oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
if (__builtin_expect (oldval != actual_oldval, 0))
return actual_oldval;
@@ -291,14 +277,13 @@ TYPE HIDDEN \
int failure; \
\
do { \
- oldval = *ptr; \
+ oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
failure = __kernel_cmpxchg2 (&oldval, &val, ptr, INDEX); \
} while (failure != 0); \
\
return oldval; \
}
-SYNC_LOCK_TEST_AND_SET_2 (long long, 8, 3)
SYNC_LOCK_TEST_AND_SET_2 (short, 2, 1)
SYNC_LOCK_TEST_AND_SET_2 (signed char, 1, 0)
@@ -308,7 +293,7 @@ __sync_lock_test_and_set_4 (int *ptr, int val)
int failure, oldval;
do {
- oldval = *ptr;
+ oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
failure = __kernel_cmpxchg (oldval, val, ptr);
} while (failure != 0);
@@ -322,12 +307,11 @@ __sync_lock_test_and_set_4 (int *ptr, int val)
TYPE failure, oldval, zero = 0; \
\
do { \
- oldval = *ptr; \
+ oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
failure = __kernel_cmpxchg2 (&oldval, &zero, ptr, INDEX); \
} while (failure != 0); \
}
-SYNC_LOCK_RELEASE_2 (long long, 8, 3)
SYNC_LOCK_RELEASE_2 (short, 2, 1)
SYNC_LOCK_RELEASE_2 (signed char, 1, 0)
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 4f09bc30bf6..5326c0989c9 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -925,11 +925,25 @@ go_reflect_makefunc_file = \
go_reflect_makefunc_s_file = \
go/reflect/makefunc_386.S
else
+if LIBGO_IS_PPC64
+go_reflect_makefunc_file = \
+ go/reflect/makefuncgo_ppc.go
+go_reflect_makefunc_s_file = \
+ go/reflect/makefunc_ppc.c
+else
+if LIBGO_IS_PPC64LE
+go_reflect_makefunc_file = \
+ go/reflect/makefuncgo_ppc.go
+go_reflect_makefunc_s_file = \
+ go/reflect/makefunc_ppc.c
+else
go_reflect_makefunc_file =
go_reflect_makefunc_s_file = \
go/reflect/makefunc_dummy.c
endif
endif
+endif
+endif
go_reflect_files = \
go/reflect/deepequal.go \
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index cf93938379b..48966653130 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -1097,15 +1097,27 @@ go_path_files = \
go/path/match.go \
go/path/path.go
-@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file =
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64LE_FALSE@@LIBGO_IS_PPC64_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file =
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64LE_TRUE@@LIBGO_IS_PPC64_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file = \
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64LE_TRUE@@LIBGO_IS_PPC64_FALSE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefuncgo_ppc.go
+
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64_TRUE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file = \
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64_TRUE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefuncgo_ppc.go
+
@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file = \
@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefuncgo_386.go
@LIBGO_IS_X86_64_TRUE@go_reflect_makefunc_file = \
@LIBGO_IS_X86_64_TRUE@ go/reflect/makefuncgo_amd64.go
-@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \
-@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_dummy.c
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64LE_FALSE@@LIBGO_IS_PPC64_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64LE_FALSE@@LIBGO_IS_PPC64_FALSE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_dummy.c
+
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64LE_TRUE@@LIBGO_IS_PPC64_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64LE_TRUE@@LIBGO_IS_PPC64_FALSE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_ppc.c
+
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64_TRUE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \
+@LIBGO_IS_386_FALSE@@LIBGO_IS_PPC64_TRUE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_ppc.c
@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \
@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_386.S
diff --git a/libgo/configure b/libgo/configure
index 1223204a250..64654034366 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -631,6 +631,8 @@ LIBGO_IS_SPARC64_FALSE
LIBGO_IS_SPARC64_TRUE
LIBGO_IS_SPARC_FALSE
LIBGO_IS_SPARC_TRUE
+LIBGO_IS_PPC64LE_FALSE
+LIBGO_IS_PPC64LE_TRUE
LIBGO_IS_PPC64_FALSE
LIBGO_IS_PPC64_TRUE
LIBGO_IS_PPC_FALSE
@@ -11115,7 +11117,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11118 "configure"
+#line 11120 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11221,7 +11223,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11224 "configure"
+#line 11226 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13599,6 +13601,7 @@ is_m68k=no
mips_abi=unknown
is_ppc=no
is_ppc64=no
+is_ppc64le=no
is_sparc=no
is_sparc64=no
is_x86_64=no
@@ -13709,13 +13712,27 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
is_ppc=yes
else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
+#error 64be
+#endif
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ is_ppc64le=yes
+else
is_ppc64=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "$is_ppc" = "yes"; then
GOARCH=ppc
- else
+ elif test "$is_ppc64" = "yes"; then
GOARCH=ppc64
+ else
+ GOARCH=ppc64le
fi
;;
sparc*-*-*)
@@ -13835,6 +13852,14 @@ else
LIBGO_IS_PPC64_FALSE=
fi
+ if test $is_ppc64le = yes; then
+ LIBGO_IS_PPC64LE_TRUE=
+ LIBGO_IS_PPC64LE_FALSE='#'
+else
+ LIBGO_IS_PPC64LE_TRUE='#'
+ LIBGO_IS_PPC64LE_FALSE=
+fi
+
if test $is_sparc = yes; then
LIBGO_IS_SPARC_TRUE=
LIBGO_IS_SPARC_FALSE='#'
@@ -15591,6 +15616,10 @@ if test -z "${LIBGO_IS_PPC64_TRUE}" && test -z "${LIBGO_IS_PPC64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_PPC64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${LIBGO_IS_PPC64LE_TRUE}" && test -z "${LIBGO_IS_PPC64LE_FALSE}"; then
+ as_fn_error "conditional \"LIBGO_IS_PPC64LE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${LIBGO_IS_SPARC_TRUE}" && test -z "${LIBGO_IS_SPARC_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_SPARC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 754e1906c6b..bf64fbd383a 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -179,6 +179,7 @@ is_m68k=no
mips_abi=unknown
is_ppc=no
is_ppc64=no
+is_ppc64le=no
is_sparc=no
is_sparc64=no
is_x86_64=no
@@ -249,11 +250,18 @@ changequote([,])dnl
#ifdef _ARCH_PPC64
#error 64-bit
#endif],
-[is_ppc=yes], [is_ppc64=yes])
+[is_ppc=yes],
+ [AC_COMPILE_IFELSE([
+#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
+#error 64be
+#endif],
+[is_ppc64le=yes],[is_ppc64=yes])])
if test "$is_ppc" = "yes"; then
GOARCH=ppc
- else
+ elif test "$is_ppc64" = "yes"; then
GOARCH=ppc64
+ else
+ GOARCH=ppc64le
fi
;;
sparc*-*-*)
@@ -281,6 +289,7 @@ AM_CONDITIONAL(LIBGO_IS_MIPSN64, test $mips_abi = n64)
AM_CONDITIONAL(LIBGO_IS_MIPSO64, test $mips_abi = o64)
AM_CONDITIONAL(LIBGO_IS_PPC, test $is_ppc = yes)
AM_CONDITIONAL(LIBGO_IS_PPC64, test $is_ppc64 = yes)
+AM_CONDITIONAL(LIBGO_IS_PPC64LE, test $is_ppc64le = yes)
AM_CONDITIONAL(LIBGO_IS_SPARC, test $is_sparc = yes)
AM_CONDITIONAL(LIBGO_IS_SPARC64, test $is_sparc64 = yes)
AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
diff --git a/libgo/go/debug/elf/elf.go b/libgo/go/debug/elf/elf.go
index 6d6433d1ca1..d4c4b636c90 100644
--- a/libgo/go/debug/elf/elf.go
+++ b/libgo/go/debug/elf/elf.go
@@ -1246,6 +1246,242 @@ var r386Strings = []intName{
func (i R_386) String() string { return stringName(uint32(i), r386Strings, false) }
func (i R_386) GoString() string { return stringName(uint32(i), r386Strings, true) }
+// Relocation types for ppc64.
+type R_PPC64 int
+
+const (
+ R_PPC64_NONE R_PPC64 = 0 /* No relocation. */
+ R_PPC64_ADDR32 R_PPC64 = 1
+ R_PPC64_ADDR24 R_PPC64 = 2
+ R_PPC64_ADDR16 R_PPC64 = 3
+ R_PPC64_ADDR16_LO R_PPC64 = 4
+ R_PPC64_ADDR16_HI R_PPC64 = 5
+ R_PPC64_ADDR16_HA R_PPC64 = 6
+ R_PPC64_ADDR14 R_PPC64 = 7
+ R_PPC64_ADDR14_BRTAKEN R_PPC64 = 8
+ R_PPC64_ADDR14_BRNTAKEN R_PPC64 = 9
+ R_PPC64_REL24 R_PPC64 = 10
+ R_PPC64_REL14 R_PPC64 = 11
+ R_PPC64_REL14_BRTAKEN R_PPC64 = 12
+ R_PPC64_REL14_BRNTAKEN R_PPC64 = 13
+ R_PPC64_GOT16 R_PPC64 = 14
+ R_PPC64_GOT16_LO R_PPC64 = 15
+ R_PPC64_GOT16_HI R_PPC64 = 16
+ R_PPC64_GOT16_HA R_PPC64 = 17
+
+ R_PPC64_COPY R_PPC64 = 19
+ R_PPC64_GLOB_DAT R_PPC64 = 20
+ R_PPC64_JMP_SLOT R_PPC64 = 21
+ R_PPC64_RELATIVE R_PPC64 = 22
+
+ R_PPC64_UADDR32 R_PPC64 = 24
+ R_PPC64_UADDR16 R_PPC64 = 25
+ R_PPC64_REL32 R_PPC64 = 26
+ R_PPC64_PLT32 R_PPC64 = 27
+ R_PPC64_PLTREL32 R_PPC64 = 28
+ R_PPC64_PLT16_LO R_PPC64 = 29
+ R_PPC64_PLT16_HI R_PPC64 = 30
+ R_PPC64_PLT16_HA R_PPC64 = 31
+
+ R_PPC64_SECTOFF R_PPC64 = 33
+ R_PPC64_SECTOFF_LO R_PPC64 = 34
+ R_PPC64_SECTOFF_HI R_PPC64 = 35
+ R_PPC64_SECTOFF_HA R_PPC64 = 36
+ R_PPC64_REL30 R_PPC64 = 37
+ R_PPC64_ADDR64 R_PPC64 = 38
+ R_PPC64_ADDR16_HIGHER R_PPC64 = 39
+ R_PPC64_ADDR16_HIGHERA R_PPC64 = 40
+ R_PPC64_ADDR16_HIGHEST R_PPC64 = 41
+ R_PPC64_ADDR16_HIGHESTA R_PPC64 = 42
+ R_PPC64_UADDR64 R_PPC64 = 43
+ R_PPC64_REL64 R_PPC64 = 44
+ R_PPC64_PLT64 R_PPC64 = 45
+ R_PPC64_PLTREL64 R_PPC64 = 46
+ R_PPC64_TOC16 R_PPC64 = 47
+ R_PPC64_TOC16_LO R_PPC64 = 48
+ R_PPC64_TOC16_HI R_PPC64 = 49
+ R_PPC64_TOC16_HA R_PPC64 = 50
+ R_PPC64_TOC R_PPC64 = 51
+ R_PPC64_PLTGOT16 R_PPC64 = 52
+ R_PPC64_PLTGOT16_LO R_PPC64 = 53
+ R_PPC64_PLTGOT16_HI R_PPC64 = 54
+ R_PPC64_PLTGOT16_HA R_PPC64 = 55
+
+ R_PPC64_ADDR16_DS R_PPC64 = 56
+ R_PPC64_ADDR16_LO_DS R_PPC64 = 57
+ R_PPC64_GOT16_DS R_PPC64 = 58
+ R_PPC64_GOT16_LO_DS R_PPC64 = 59
+ R_PPC64_PLT16_LO_DS R_PPC64 = 60
+ R_PPC64_SECTOFF_DS R_PPC64 = 61
+ R_PPC64_SECTOFF_LO_DS R_PPC64 = 62
+ R_PPC64_TOC16_DS R_PPC64 = 63
+ R_PPC64_TOC16_LO_DS R_PPC64 = 64
+ R_PPC64_PLTGOT16_DS R_PPC64 = 65
+ R_PPC64_PLTGOT16_LO_DS R_PPC64 = 66
+
+ R_PPC64_TLS R_PPC64 = 67
+ R_PPC64_DTPMOD64 R_PPC64 = 68
+ R_PPC64_TPREL16 R_PPC64 = 69
+ R_PPC64_TPREL16_LO R_PPC64 = 70
+ R_PPC64_TPREL16_HI R_PPC64 = 71
+ R_PPC64_TPREL16_HA R_PPC64 = 72
+ R_PPC64_TPREL64 R_PPC64 = 73
+ R_PPC64_DTPREL16 R_PPC64 = 74
+ R_PPC64_DTPREL16_LO R_PPC64 = 75
+ R_PPC64_DTPREL16_HI R_PPC64 = 76
+ R_PPC64_DTPREL16_HA R_PPC64 = 77
+ R_PPC64_DTPREL64 R_PPC64 = 78
+ R_PPC64_GOT_TLSGD16 R_PPC64 = 79
+ R_PPC64_GOT_TLSGD16_LO R_PPC64 = 80
+ R_PPC64_GOT_TLSGD16_HI R_PPC64 = 81
+ R_PPC64_GOT_TLSGD16_HA R_PPC64 = 82
+ R_PPC64_GOT_TLSLD16 R_PPC64 = 83
+ R_PPC64_GOT_TLSLD16_LO R_PPC64 = 84
+ R_PPC64_GOT_TLSLD16_HI R_PPC64 = 85
+ R_PPC64_GOT_TLSLD16_HA R_PPC64 = 86
+ R_PPC64_GOT_TPREL16_DS R_PPC64 = 87
+ R_PPC64_GOT_TPREL16_LO_DS R_PPC64 = 88
+ R_PPC64_GOT_TPREL16_HI R_PPC64 = 89
+ R_PPC64_GOT_TPREL16_HA R_PPC64 = 90
+ R_PPC64_GOT_DTPREL16_DS R_PPC64 = 91
+ R_PPC64_GOT_DTPREL16_LO_DS R_PPC64 = 92
+ R_PPC64_GOT_DTPREL16_HI R_PPC64 = 93
+ R_PPC64_GOT_DTPREL16_HA R_PPC64 = 94
+ R_PPC64_TPREL16_DS R_PPC64 = 95
+ R_PPC64_TPREL16_LO_DS R_PPC64 = 96
+ R_PPC64_TPREL16_HIGHER R_PPC64 = 97
+ R_PPC64_TPREL16_HIGHERA R_PPC64 = 98
+ R_PPC64_TPREL16_HIGHEST R_PPC64 = 99
+ R_PPC64_TPREL16_HIGHESTA R_PPC64 = 100
+ R_PPC64_DTPREL16_DS R_PPC64 = 101
+ R_PPC64_DTPREL16_LO_DS R_PPC64 = 102
+ R_PPC64_DTPREL16_HIGHER R_PPC64 = 103
+ R_PPC64_DTPREL16_HIGHERA R_PPC64 = 104
+ R_PPC64_DTPREL16_HIGHEST R_PPC64 = 105
+ R_PPC64_DTPREL16_HIGHESTA R_PPC64 = 106
+
+ R_PPC64_GNU_VTINHERIT R_PPC64 = 253
+ R_PPC64_GNU_VTENTRY R_PPC64 = 254
+)
+
+var rppc64Strings = []intName{
+ {0, "R_PPC64_NONE"},
+ {1, "R_PPC64_ADDR32"},
+ {2, "R_PPC64_ADDR24"},
+ {3, "R_PPC64_ADDR16"},
+ {4, "R_PPC64_ADDR16_LO"},
+ {5, "R_PPC64_ADDR16_HI"},
+ {6, "R_PPC64_ADDR16_HA"},
+ {7, "R_PPC64_ADDR14"},
+ {8, "R_PPC64_ADDR14_BRTAKEN"},
+ {9, "R_PPC64_ADDR14_BRNTAKEN"},
+ {10, "R_PPC64_REL24"},
+ {11, "R_PPC64_REL14"},
+ {12, "R_PPC64_REL14_BRTAKEN"},
+ {13, "R_PPC64_REL14_BRNTAKEN"},
+ {14, "R_PPC64_GOT16"},
+ {15, "R_PPC64_GOT16_LO"},
+ {16, "R_PPC64_GOT16_HI"},
+ {17, "R_PPC64_GOT16_HA"},
+
+ {19, "R_PPC64_COPY"},
+ {20, "R_PPC64_GLOB_DAT"},
+ {21, "R_PPC64_JMP_SLOT"},
+ {22, "R_PPC64_RELATIVE"},
+
+ {24, "R_PPC64_UADDR32"},
+ {25, "R_PPC64_UADDR16"},
+ {26, "R_PPC64_REL32"},
+ {27, "R_PPC64_PLT32"},
+ {28, "R_PPC64_PLTREL32"},
+ {29, "R_PPC64_PLT16_LO"},
+ {30, "R_PPC64_PLT16_HI"},
+ {31, "R_PPC64_PLT16_HA"},
+
+ {33, "R_PPC64_SECTOFF"},
+ {34, "R_PPC64_SECTOFF_LO"},
+ {35, "R_PPC64_SECTOFF_HI"},
+ {36, "R_PPC64_SECTOFF_HA"},
+ {37, "R_PPC64_REL30"},
+ {38, "R_PPC64_ADDR64"},
+ {39, "R_PPC64_ADDR16_HIGHER"},
+ {40, "R_PPC64_ADDR16_HIGHERA"},
+ {41, "R_PPC64_ADDR16_HIGHEST"},
+ {42, "R_PPC64_ADDR16_HIGHESTA"},
+ {43, "R_PPC64_UADDR64"},
+ {44, "R_PPC64_REL64"},
+ {45, "R_PPC64_PLT64"},
+ {46, "R_PPC64_PLTREL64"},
+ {47, "R_PPC64_TOC16"},
+ {48, "R_PPC64_TOC16_LO"},
+ {49, "R_PPC64_TOC16_HI"},
+ {50, "R_PPC64_TOC16_HA"},
+ {51, "R_PPC64_TOC"},
+ {52, "R_PPC64_PLTGOT16"},
+ {53, "R_PPC64_PLTGOT16_LO"},
+ {54, "R_PPC64_PLTGOT16_HI"},
+ {55, "R_PPC64_PLTGOT16_HA"},
+
+ {56, "R_PPC64_ADDR16_DS"},
+ {57, "R_PPC64_ADDR16_LO_DS"},
+ {58, "R_PPC64_GOT16_DS"},
+ {59, "R_PPC64_GOT16_LO_DS"},
+ {60, "R_PPC64_PLT16_LO_DS"},
+ {61, "R_PPC64_SECTOFF_DS"},
+ {62, "R_PPC64_SECTOFF_LO_DS"},
+ {63, "R_PPC64_TOC16_DS"},
+ {64, "R_PPC64_TOC16_LO_DS"},
+ {65, "R_PPC64_PLTGOT16_DS"},
+ {66, "R_PPC64_PLTGOT16_LO_DS"},
+
+ {67, "R_PPC64_TLS"},
+ {68, "R_PPC64_DTPMOD64"},
+ {69, "R_PPC64_TPREL16"},
+ {70, "R_PPC64_TPREL16_LO"},
+ {71, "R_PPC64_TPREL16_HI"},
+ {72, "R_PPC64_TPREL16_HA"},
+ {73, "R_PPC64_TPREL64"},
+ {74, "R_PPC64_DTPREL16"},
+ {75, "R_PPC64_DTPREL16_LO"},
+ {76, "R_PPC64_DTPREL16_HI"},
+ {77, "R_PPC64_DTPREL16_HA"},
+ {78, "R_PPC64_DTPREL64"},
+ {79, "R_PPC64_GOT_TLSGD16"},
+ {80, "R_PPC64_GOT_TLSGD16_LO"},
+ {81, "R_PPC64_GOT_TLSGD16_HI"},
+ {82, "R_PPC64_GOT_TLSGD16_HA"},
+ {83, "R_PPC64_GOT_TLSLD16"},
+ {84, "R_PPC64_GOT_TLSLD16_LO"},
+ {85, "R_PPC64_GOT_TLSLD16_HI"},
+ {86, "R_PPC64_GOT_TLSLD16_HA"},
+ {87, "R_PPC64_GOT_TPREL16_DS"},
+ {88, "R_PPC64_GOT_TPREL16_LO_DS"},
+ {89, "R_PPC64_GOT_TPREL16_HI"},
+ {90, "R_PPC64_GOT_TPREL16_HA"},
+ {91, "R_PPC64_GOT_DTPREL16_DS"},
+ {92, "R_PPC64_GOT_DTPREL16_LO_DS"},
+ {93, "R_PPC64_GOT_DTPREL16_HI"},
+ {94, "R_PPC64_GOT_DTPREL16_HA"},
+ {95, "R_PPC64_TPREL16_DS"},
+ {96, "R_PPC64_TPREL16_LO_DS"},
+ {97, "R_PPC64_TPREL16_HIGHER"},
+ {98, "R_PPC64_TPREL16_HIGHERA"},
+ {99, "R_PPC64_TPREL16_HIGHEST"},
+ {100, "R_PPC64_TPREL16_HIGHESTA"},
+ {101, "R_PPC64_DTPREL16_DS"},
+ {102, "R_PPC64_DTPREL16_LO_DS"},
+ {103, "R_PPC64_DTPREL16_HIGHER"},
+ {104, "R_PPC64_DTPREL16_HIGHERA"},
+ {105, "R_PPC64_DTPREL16_HIGHEST"},
+ {106, "R_PPC64_DTPREL16_HIGHESTA"},
+
+ {253, "R_PPC64_GNU_VTINHERIT"},
+ {254, "R_PPC64_GNU_VTENTRY"},
+}
+
+func (i R_PPC64) String() string { return stringName(uint32(i), rppc64Strings, false) }
+func (i R_PPC64) GoString() string { return stringName(uint32(i), rppc64Strings, true) }
+
// Relocation types for PowerPC.
type R_PPC int
diff --git a/libgo/go/debug/elf/file.go b/libgo/go/debug/elf/file.go
index f6e7e31a8e7..6136595ade3 100644
--- a/libgo/go/debug/elf/file.go
+++ b/libgo/go/debug/elf/file.go
@@ -519,6 +519,9 @@ func (f *File) applyRelocations(dst []byte, rels []byte) error {
if f.Class == ELFCLASS64 && f.Machine == EM_X86_64 {
return f.applyRelocationsAMD64(dst, rels)
}
+ if f.Class == ELFCLASS64 && f.Machine == EM_PPC64 {
+ return f.applyRelocationsPPC64(dst, rels)
+ }
if f.Class == ELFCLASS64 && f.Machine == EM_AARCH64 {
return f.applyRelocationsARM64(dst, rels)
}
@@ -615,6 +618,47 @@ func (f *File) applyRelocationsARM64(dst []byte, rels []byte) error {
return nil
}
+func (f *File) applyRelocationsPPC64(dst []byte, rels []byte) error {
+ // 24 is the size of Rela64.
+ if len(rels)%24 != 0 {
+ return errors.New("length of relocation section is not a multiple of Sym64Size")
+ }
+
+ symbols, _, err := f.getSymbols(SHT_SYMTAB)
+ if err != nil {
+ return err
+ }
+
+ b := bytes.NewBuffer(rels)
+ var rela Rela64
+
+ for b.Len() > 0 {
+ binary.Read(b, f.ByteOrder, &rela)
+ symNo := rela.Info >> 32
+ t := R_PPC64(rela.Info & 0xffff)
+
+ if symNo == 0 || symNo > uint64(len(symbols)) {
+ continue
+ }
+ sym := &symbols[symNo-1]
+
+ switch t {
+ case R_PPC64_ADDR64:
+ if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 {
+ continue
+ }
+ f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend) + uint64(sym.Value))
+ case R_PPC64_ADDR32:
+ if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 {
+ continue
+ }
+ f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend) + uint32(sym.Value))
+ }
+ }
+
+ return nil
+}
+
func (f *File) DWARF() (*dwarf.Data, error) {
// There are many other DWARF sections, but these
// are the required ones, and the debug/dwarf package
@@ -637,7 +681,7 @@ func (f *File) DWARF() (*dwarf.Data, error) {
// If there's a relocation table for .debug_info, we have to process it
// now otherwise the data in .debug_info is invalid for x86-64 objects.
rela := f.Section(".rela.debug_info")
- if rela != nil && rela.Type == SHT_RELA && (f.Machine == EM_X86_64 || f.Machine == EM_AARCH64) {
+ if rela != nil && rela.Type == SHT_RELA && (f.Machine == EM_X86_64 || f.Machine == EM_AARCH64 || f.Machine == EM_PPC64) {
data, err := rela.Data()
if err != nil {
return nil, err
diff --git a/libgo/go/debug/elf/file_test.go b/libgo/go/debug/elf/file_test.go
index 38b5f9e7075..9140e14fe7f 100644
--- a/libgo/go/debug/elf/file_test.go
+++ b/libgo/go/debug/elf/file_test.go
@@ -261,6 +261,12 @@ var relocationTests = []relocationTest{
},
},
{
+ "testdata/go-relocation-test-gcc447-ppc64.obj",
+ []relocationTestEntry{
+ {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C 4.4.7 20120313 (Red Hat 4.4.7-4)"}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(1)}, dwarf.Field{Attr: dwarf.AttrName, Val: "t.c"}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp"}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: uint64(0x24)}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0)}}}},
+ },
+ },
+ {
"testdata/gcc-amd64-openbsd-debug-with-rela.obj",
[]relocationTestEntry{
{203, &dwarf.Entry{Offset: 0xc62, Tag: dwarf.TagMember, Children: false, Field: []dwarf.Field{{Attr: dwarf.AttrName, Val: "it_interval"}, {Attr: dwarf.AttrDeclFile, Val: int64(7)}, {Attr: dwarf.AttrDeclLine, Val: int64(236)}, {Attr: dwarf.AttrType, Val: dwarf.Offset(0xb7f)}, {Attr: dwarf.AttrDataMemberLoc, Val: []byte{0x23, 0x0}}}}},
diff --git a/libgo/go/debug/elf/testdata/go-relocation-test-gcc447-ppc64.obj b/libgo/go/debug/elf/testdata/go-relocation-test-gcc447-ppc64.obj
new file mode 100644
index 00000000000..8b68eef7a12
--- /dev/null
+++ b/libgo/go/debug/elf/testdata/go-relocation-test-gcc447-ppc64.obj
Binary files differ
diff --git a/libgo/go/go/build/syslist.go b/libgo/go/go/build/syslist.go
index 3580d823b08..17153f2433b 100644
--- a/libgo/go/go/build/syslist.go
+++ b/libgo/go/go/build/syslist.go
@@ -5,4 +5,4 @@
package build
const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 windows solaris "
-const goarchList = "386 amd64 arm arm64 alpha m68k mipso32 mipsn32 mipsn64 mipso64 ppc ppc64 sparc sparc64 "
+const goarchList = "386 amd64 arm arm64 alpha m68k mipso32 mipsn32 mipsn64 mipso64 ppc ppc64 ppc64le sparc sparc64 "
diff --git a/libgo/go/reflect/all_test.go b/libgo/go/reflect/all_test.go
index f9700ce2fb5..1ce31902c0b 100644
--- a/libgo/go/reflect/all_test.go
+++ b/libgo/go/reflect/all_test.go
@@ -1476,7 +1476,7 @@ func TestCallWithStruct(t *testing.T) {
func TestMakeFunc(t *testing.T) {
switch runtime.GOARCH {
- case "amd64", "386":
+ case "amd64", "386", "ppc64", "ppc64le":
default:
t.Skip("MakeFunc not implemented for " + runtime.GOARCH)
}
@@ -1500,7 +1500,7 @@ func TestMakeFunc(t *testing.T) {
func TestMakeFuncInterface(t *testing.T) {
switch runtime.GOARCH {
- case "amd64", "386":
+ case "amd64", "386", "ppc64", "ppc64le":
default:
t.Skip("MakeFunc not implemented for " + runtime.GOARCH)
}
@@ -1633,7 +1633,7 @@ func TestMethod(t *testing.T) {
func TestMethodValue(t *testing.T) {
switch runtime.GOARCH {
- case "amd64", "386":
+ case "amd64", "386", "ppc64", "ppc64le":
default:
t.Skip("reflect method values not implemented for " + runtime.GOARCH)
}
@@ -1810,7 +1810,7 @@ func (t4 Tm4) M(x int, b byte) (byte, int) { return b, x + 40 }
func TestMethod5(t *testing.T) {
switch runtime.GOARCH {
- case "amd64", "386":
+ case "amd64", "386", "ppc64", "ppc64le":
default:
t.Skip("reflect method values not implemented for " + runtime.GOARCH)
}
diff --git a/libgo/go/reflect/makefunc.go b/libgo/go/reflect/makefunc.go
index 935a3d3be02..07089ac90fa 100644
--- a/libgo/go/reflect/makefunc.go
+++ b/libgo/go/reflect/makefunc.go
@@ -52,7 +52,7 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value {
}
switch runtime.GOARCH {
- case "amd64", "386":
+ case "amd64", "386", "ppc64", "ppc64le":
default:
panic("reflect.MakeFunc not implemented for " + runtime.GOARCH)
}
@@ -91,7 +91,7 @@ func makeMethodValue(op string, v Value) Value {
}
switch runtime.GOARCH {
- case "amd64", "386":
+ case "amd64", "386", "ppc64", "ppc64le":
default:
panic("reflect.makeMethodValue not implemented for " + runtime.GOARCH)
}
@@ -138,7 +138,7 @@ func makeValueMethod(v Value) Value {
}
switch runtime.GOARCH {
- case "amd64", "386":
+ case "amd64", "386", "ppc64", "ppc64le":
default:
panic("reflect.makeValueMethod not implemented for " + runtime.GOARCH)
}
diff --git a/libgo/go/reflect/makefunc_ppc.c b/libgo/go/reflect/makefunc_ppc.c
new file mode 100644
index 00000000000..deeec2d00bf
--- /dev/null
+++ b/libgo/go/reflect/makefunc_ppc.c
@@ -0,0 +1,95 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "runtime.h"
+#include "go-panic.h"
+
+extern void MakeFuncStubGo(void *, void *) asm ("reflect.MakeFuncStubGo");
+
+/* Structure to store all registers used for parameter passing. */
+typedef struct
+{
+ long r3;
+ long r4;
+ long r5;
+ long r6;
+ long r7;
+ long r8;
+ long r9;
+ long r10;
+ /* Pointer to non-register arguments on the stack. */
+ long stack_args;
+ double f1;
+ double f2;
+ double f3;
+ double f4;
+ double f5;
+ double f6;
+ double f7;
+ double f8;
+ double f9;
+ double f10;
+ double f11;
+ double f12;
+ double f13;
+} ppcRegs;
+
+void makeFuncStub(
+ long r3, long r4, long r5, long r6, long r7, long r8, long r9, long r10,
+ long stackargs,
+ double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8,
+ double f9, double f10, double f11, double f12, double f13)
+ asm ("reflect.makeFuncStub");
+
+void makeFuncStub(
+ long r3, long r4, long r5, long r6, long r7, long r8, long r9, long r10,
+ long stackargs,
+ double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8,
+ double f9, double f10, double f11, double f12, double f13)
+{
+ ppcRegs regs;
+ void *closure;
+
+ /* Store the registers in a structure that is passed on to the Go stub
+ function. */
+ regs.r3 = r3;
+ regs.r4 = r4;
+ regs.r5 = r5;
+ regs.r6 = r6;
+ regs.r7 = r7;
+ regs.r8 = r8;
+ regs.r9 = r9;
+ regs.r10 = r10;
+ regs.stack_args = (long)&stackargs;
+ regs.f1 = f1;
+ regs.f2 = f2;
+ regs.f3 = f3;
+ regs.f4 = f4;
+ regs.f5 = f5;
+ regs.f6 = f6;
+ regs.f7 = f7;
+ regs.f8 = f8;
+ regs.f9 = f9;
+ regs.f10 = f10;
+ regs.f11 = f11;
+ regs.f12 = f12;
+ regs.f13 = f13;
+
+ __go_makefunc_can_recover( __builtin_return_address (0));
+ /* Call the Go stub function. */
+ closure = __go_get_closure();
+ MakeFuncStubGo(&regs, closure);
+ /* MakeFunc functions can no longer call recover. */
+ __go_makefunc_returning();
+ /* Restore all possible return registers. */
+
+ asm volatile ("ld\t3,0(%0)" : : "a" (&regs.r3) : "r3" );
+ asm volatile ("ld\t4,0(%0)" : : "a" (&regs.r4) : "r4" );
+ asm volatile ("lfd\t1,0(%0)" : : "a" (&regs.f1) : "fr1" );
+ asm volatile ("lfd\t2,0(%0)" : : "a" (&regs.f2) : "fr2" );
+ asm volatile ("lfd\t3,0(%0)" : : "a" (&regs.f3) : "fr3" );
+ asm volatile ("lfd\t4,0(%0)" : : "a" (&regs.f4) : "fr4" );
+
+ return;
+}
diff --git a/libgo/go/reflect/makefuncgo_ppc.go b/libgo/go/reflect/makefuncgo_ppc.go
new file mode 100644
index 00000000000..fadcb767424
--- /dev/null
+++ b/libgo/go/reflect/makefuncgo_ppc.go
@@ -0,0 +1,621 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// MakeFunc ppc implementation.
+
+package reflect
+
+import (
+ "runtime"
+ "unsafe"
+)
+
+const ppc_arch_stack_slot_align uintptr = 8
+const ppc_num_gr = 8
+const ppc_num_fr = 13
+type ppc_arch_gr_t uint64
+type ppc_arch_fr_t uint64
+type ppc_arg_t int
+
+// The assembler stub will pass a pointer to this structure.
+// This will come in holding the register values and the
+// address of the parameters that might be on the stack.
+type ppc_regs struct {
+ r3 ppc_arch_gr_t
+ r4 ppc_arch_gr_t
+ r5 ppc_arch_gr_t
+ r6 ppc_arch_gr_t
+ r7 ppc_arch_gr_t
+ r8 ppc_arch_gr_t
+ r9 ppc_arch_gr_t
+ r10 ppc_arch_gr_t
+ // stack_args is the address of the first parameter that
+ // was stored on the stack.
+ stack_args ppc_arch_gr_t
+ f1 ppc_arch_fr_t
+ f2 ppc_arch_fr_t
+ f3 ppc_arch_fr_t
+ f4 ppc_arch_fr_t
+ f5 ppc_arch_fr_t
+ f6 ppc_arch_fr_t
+ f7 ppc_arch_fr_t
+ f8 ppc_arch_fr_t
+ f9 ppc_arch_fr_t
+ f10 ppc_arch_fr_t
+ f11 ppc_arch_fr_t
+ f12 ppc_arch_fr_t
+ f13 ppc_arch_fr_t
+}
+
+const (
+ ppc_general_reg ppc_arg_t = iota
+ ppc_general_reg_pair
+ ppc_float_reg
+ // Argument passed as a pointer to an in-memory value.
+ ppc_mem_ptr
+ ppc_slice
+ ppc_empty
+)
+
+// ppcClassifyParameter returns the register class needed to
+// pass the value of type TYP. ppc_empty means the register is
+// not used. The second and third return values are the offset of
+// an rtype parameter passed in a register (second) or stack slot
+// (third).
+func ppcClassifyParameter(typ *rtype) (ppc_arg_t, uintptr, uintptr) {
+ offset := uintptr(0)
+
+ // For big endian, the pointer points to the start of the
+ // slot so if the size of the parameter does not fill the slot,
+ // the offset must be adjusted to access the correct byte for a
+ // memcpy. For little endian this is not necessary.
+ if runtime.GOARCH != "ppc64le" && typ.Size() < ppc_arch_stack_slot_align {
+ offset = ppc_arch_stack_slot_align - typ.Size()
+ }
+
+ switch typ.Kind() {
+ default:
+ panic("internal error--unknown kind in ppcClassifyParameter")
+ case Bool, Int, Int8, Int16, Int32, Uint, Uint8, Uint16, Uint32:
+ return ppc_general_reg, offset, offset
+ case Int64, Uint64, Uintptr, Chan, Func, Map, Ptr, UnsafePointer:
+ return ppc_general_reg, 0, 0
+ case Float32, Float64:
+ return ppc_float_reg, 0, offset
+ case Complex64, Complex128:
+ // Complex numbers are passed by reference.
+ return ppc_mem_ptr, 0, 0
+ case Array, Struct:
+ var ityp *rtype
+ var length int
+
+ if typ.Size() == 0 {
+ return ppc_empty, 0, 0
+ }
+ switch typ.Size() {
+ default:
+ // Pointer to memory.
+ return ppc_mem_ptr, 0, 0
+ case 1, 2:
+ // Pass in an integer register.
+ return ppc_general_reg, offset, offset
+
+ case 4, 8, 16:
+ // An array of up to 16 bytes could be passed in
+ // registers. (Not sure about structures?)
+ }
+ if (typ.Kind() == Array) {
+ atyp := (*arrayType)(unsafe.Pointer(typ))
+ length = atyp.Len()
+ ityp = atyp.elem
+ } else {
+ styp := (*structType)(unsafe.Pointer(typ))
+ length = len(styp.fields)
+ ityp = styp.fields[0].typ
+ }
+ if length == 1 {
+ class, off_reg, off_slot := ppcClassifyParameter(ityp)
+ if class == ppc_float_reg {
+ return ppc_float_reg, off_reg, off_slot
+ }
+ }
+ // Otherwise pass in an integer register or register pair
+ switch typ.Size() {
+ case 4, 8:
+ return ppc_general_reg, 0, 0
+ case 16:
+ return ppc_general_reg_pair, 0, 0
+ default:
+ return ppc_general_reg, 0, 0
+ }
+ case Slice:
+ return ppc_slice, 0, 0
+ case Interface, String:
+ return ppc_mem_ptr, 0, 0
+ }
+}
+
+func ppcClassify(typ *rtype) (ppc_arg_t, ppc_arg_t) {
+ switch typ.Kind() {
+ default:
+ panic("internal error--unknown kind in ppcClassify")
+
+ case Bool, Int, Int8, Int16, Int32, Int64,
+ Uint, Uint8, Uint16, Uint32, Uint64,
+ Uintptr, Chan, Func, Map, Ptr, UnsafePointer:
+
+ return ppc_general_reg, ppc_empty
+
+ case Float32, Float64, Complex64:
+ return ppc_float_reg, ppc_empty
+
+ case Complex128:
+ return ppc_float_reg, ppc_float_reg
+
+ case Array:
+ if typ.size == 0 {
+ return ppc_empty, ppc_empty
+ } else if typ.size > 16 {
+ return ppc_mem_ptr, ppc_empty
+ }
+ atyp := (*arrayType)(unsafe.Pointer(typ))
+ eclass1, eclass2 := ppcClassify(atyp.elem)
+ if eclass1 == ppc_mem_ptr {
+ return ppc_mem_ptr, ppc_empty
+ }
+ if eclass2 == ppc_empty && typ.size > 8 {
+ eclass2 = eclass1
+ }
+ return eclass1, eclass2
+
+ case Interface:
+ return ppc_general_reg, ppc_general_reg
+
+ case Slice:
+ return ppc_mem_ptr, ppc_empty
+
+ case String:
+ return ppc_general_reg, ppc_general_reg
+
+ case Struct:
+ if typ.size == 0 {
+ return ppc_empty, ppc_empty
+ } else if typ.size > 16 {
+ return ppc_mem_ptr, ppc_empty
+ }
+ var first, second ppc_arg_t
+ f := ppc_empty
+ onFirst := true
+ styp := (*structType)(unsafe.Pointer(typ))
+ for _, field := range styp.fields {
+ if onFirst && field.offset >= 8 {
+ first = f
+ f = ppc_empty
+ onFirst = false
+ }
+ fclass1, fclass2 := ppcClassify(field.typ)
+ f = ppcMergeClasses(f, fclass1)
+ if fclass2 != ppc_empty {
+ if !onFirst {
+ panic("ppcClassify inconsistent")
+ }
+ first = f
+ f = fclass2
+ onFirst = false
+ }
+ }
+ if onFirst {
+ first = f
+ second = ppc_empty
+ } else {
+ second = f
+ }
+ if first == ppc_mem_ptr || second == ppc_mem_ptr {
+ return ppc_mem_ptr, ppc_empty
+ }
+ return first, second
+ }
+}
+
+
+// ppcMergeClasses merges two register classes as described in the
+// ppc64 ELF ABI.
+func ppcMergeClasses(c1, c2 ppc_arg_t) ppc_arg_t {
+ switch {
+ case c1 == c2:
+ return c1
+ case c1 == ppc_empty:
+ return c2
+ case c2 == ppc_empty:
+ return c1
+ case c1 == ppc_mem_ptr || c2 == ppc_mem_ptr:
+ return ppc_mem_ptr
+ case c1 == ppc_general_reg || c2 == ppc_general_reg:
+ return ppc_general_reg
+ default:
+ return ppc_general_reg
+ }
+}
+
+
+
+// Given a value of type *rtype left aligned in an iword, reload
+// the value so that it can be stored in a general or floating
+// point register. For general registers the value is sign extend
+// and right aligned.
+func ppcReloadForRegister(typ *rtype, w iword, offset uintptr) (iword) {
+ var do_sign_extend bool = false
+ var gr ppc_arch_gr_t
+
+ switch typ.Kind() {
+ case Int, Int8, Int16, Int32, Int64:
+ do_sign_extend = true
+ default:
+ // Handle all other cases in the next switch.
+ }
+ switch (typ.size) {
+ case 1:
+ if (do_sign_extend == true) {
+ se := int64(*(*int8)(unsafe.Pointer(&w)))
+ gr = *(*ppc_arch_gr_t)(unsafe.Pointer(&se))
+ } else {
+ e := int64(*(*uint8)(unsafe.Pointer(&w)))
+ gr = *(*ppc_arch_gr_t)(unsafe.Pointer(&e))
+ }
+ case 2:
+ if (do_sign_extend == true) {
+ se := int64(*(*int16)(unsafe.Pointer(&w)))
+ gr = *(*ppc_arch_gr_t)(unsafe.Pointer(&se))
+ } else {
+ e := int64(*(*uint16)(unsafe.Pointer(&w)))
+ gr = *(*ppc_arch_gr_t)(unsafe.Pointer(&e))
+ }
+ case 4:
+ if (do_sign_extend == true) {
+ se := int64(*(*int32)(unsafe.Pointer(&w)))
+ gr = *(*ppc_arch_gr_t)(unsafe.Pointer(&se))
+ } else {
+ e := int64(*(*uint32)(unsafe.Pointer(&w)))
+ gr = *(*ppc_arch_gr_t)(unsafe.Pointer(&e))
+ }
+ default:
+ panic("reflect: bad size in ppcReloadForRegister")
+ }
+
+ return *(*iword)(unsafe.Pointer(&gr))
+}
+
+// MakeFuncStubGo implements the ppc calling convention for
+// MakeFunc. This should not be called. It is exported so that
+// assembly code can call it.
+func MakeFuncStubGo(regs *ppc_regs, c *makeFuncImpl) {
+ ftyp := c.typ
+ gr := 0
+ fr := 0
+ ap := uintptr(regs.stack_args)
+
+ // See if the result requires a struct. If it does, the first
+ // parameter is a pointer to the struct.
+ var ret_class, ret_class_2, ret_class_dummy ppc_arg_t
+ var ret_off_reg uintptr
+ var ret_type *rtype
+
+ switch len(ftyp.out) {
+ case 0:
+ ret_type = nil
+ ret_class, ret_class_2, ret_off_reg = ppc_empty, ppc_empty, 0
+ case 1:
+ ret_type = ftyp.out[0]
+ ret_class, ret_class_2 = ppcClassify(ret_type)
+ case 2:
+ if runtime.GOARCH == "ppc64le" {
+ ret_class, ret_class_dummy = ppcClassify(ftyp.out[0])
+ ret_class_2, ret_class_dummy = ppcClassify(ftyp.out[1])
+ } else {
+ ret_class, ret_class_2, ret_off_reg = ppc_mem_ptr, ppc_empty, 0
+ }
+ default:
+ ret_type = nil
+ ret_class, ret_class_2, ret_off_reg = ppc_mem_ptr, ppc_empty, 0
+ }
+ in := make([]Value, 0, len(ftyp.in))
+ if ret_class == ppc_mem_ptr {
+ // We are returning a value in memory, which means
+ // that the first argument is a hidden parameter
+ // pointing to that return area.
+ gr++
+ }
+
+argloop:
+ for _, rt := range ftyp.in {
+ class, off_reg, off_slot := ppcClassifyParameter(rt)
+ fl := flag(rt.Kind()) << flagKindShift
+ switch class {
+ case ppc_empty:
+ v := Value{rt, nil, fl | flagIndir}
+ in = append(in, v)
+ continue argloop
+ case ppc_general_reg_pair:
+ if gr < ppc_num_gr {
+ var vals[2] uintptr
+ vals[0] = ppc_general_reg_val(regs, gr)
+ vals[1] = ppc_general_reg_val(regs, gr+1)
+ ix := uintptr(unsafe.Pointer(&vals[0]))
+ iw := unsafe.Pointer(ix)
+ fl |= flagIndir
+ v := Value{rt, iw, fl}
+ in = append(in, v)
+ gr += 2
+ } else {
+ in, ap = ppc_add_stackreg(
+ in, ap, rt, off_slot)
+ }
+ continue argloop
+ case ppc_general_reg:
+ // Values stored in a general register are right
+ // aligned.
+ if gr < ppc_num_gr {
+ val := ppc_general_reg_val(regs, gr)
+ iw := unsafe.Pointer(val)
+ k := rt.Kind()
+ if k != Ptr && k != UnsafePointer {
+ ix := uintptr(unsafe.Pointer(&val))
+ ix += off_reg
+ iw = unsafe.Pointer(ix)
+ fl |= flagIndir
+ }
+ v := Value{rt, iw, fl}
+ in = append(in, v)
+ gr++
+ } else {
+ in, ap = ppc_add_stackreg(
+ in, ap, rt, off_slot)
+ }
+ continue argloop
+ case ppc_float_reg:
+ // In a register, floats are left aligned, but in a
+ // stack slot they are right aligned.
+ if fr < ppc_num_fr {
+ val := ppc_float_reg_val(regs, fr)
+ ix := uintptr(unsafe.Pointer(&val))
+ if rt.Size() == 4 {
+ // For single precision float, the value was saved as a
+ // double precision bit pattern so must be first
+ // converted to double then cast as a single float.
+ var f32 float32 = float32(*(*float64)(unsafe.Pointer(&val)))
+ ix = uintptr(unsafe.Pointer(&f32))
+ }
+ v := Value {
+ rt, unsafe.Pointer(unsafe.Pointer(ix)),
+ fl | flagIndir,
+ }
+ in = append(in, v)
+ fr++
+ gr++
+ } else {
+ in, ap = ppc_add_stackreg(
+ in, ap, rt, off_slot)
+ }
+ continue argloop
+ case ppc_mem_ptr:
+ if gr < ppc_num_gr && unsafe.Pointer(ppc_general_reg_val(regs, gr)) != nil {
+ // Register holding a pointer to memory.
+ val := ppc_general_reg_val(regs, gr)
+ v := Value{
+ rt, unsafe.Pointer(val), fl | flagIndir}
+ in = append(in, v)
+ gr++
+ } else {
+ // Stack slot holding a pointer to memory.
+ in, ap = ppc_add_memarg(in, ap, rt)
+ }
+ continue argloop
+ case ppc_slice:
+ if gr < ppc_num_gr {
+ // Register holding a pointer to memory.
+ val := ppc_general_reg_val(regs, gr)
+ cnt := ppc_general_reg_val(regs, gr+1)
+ cap := ppc_general_reg_val(regs, gr+2)
+
+ s := SliceHeader{val, int(cnt), int(cap)}
+ v := Value{
+ rt, unsafe.Pointer(&s), fl | flagIndir}
+ in = append(in, v)
+ gr+=3
+ } else {
+ // Stack slot holding a pointer to memory.
+ in, ap = ppc_add_memarg(in, ap, rt)
+ }
+ continue argloop
+ }
+ panic("reflect: argtype not handled in MakeFunc:argloop")
+ }
+
+ // All the real arguments have been found and turned into
+ // Values. Call the real function.
+
+ out := c.call(in)
+
+ if len(out) != len(ftyp.out) {
+ panic("reflect: wrong return count from function created by MakeFunc")
+ }
+
+ for i, typ := range ftyp.out {
+ v := out[i]
+ if v.typ != typ {
+ panic(
+ "reflect: function created by MakeFunc using " +
+ funcName(c.fn) + " returned wrong type: have " +
+ out[i].typ.String() + " for " + typ.String())
+ }
+ if v.flag&flagRO != 0 {
+ panic(
+ "reflect: function created by MakeFunc using " +
+ funcName(c.fn) + " returned value obtained " +
+ "from unexported field")
+ }
+ }
+
+ switch (ret_class) {
+ case ppc_general_reg, ppc_float_reg:
+ // Single return value in a general or floating point register.
+ v := out[0]
+ if (ret_class_2 == ppc_general_reg) {
+ var buf [2]unsafe.Pointer
+ ptr := unsafe.Pointer(&buf[0])
+ off := uintptr(0)
+ for i, typ := range ftyp.out {
+ v := out[i]
+ off = align(off, uintptr(typ.fieldAlign))
+ addr := unsafe.Pointer(uintptr(ptr) + off)
+ if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) {
+ storeIword(addr, iword(v.val), typ.size)
+ } else {
+ memmove(addr, v.val, typ.size)
+ }
+ off += uintptr(typ.size)
+ }
+ regs.r3 = *(*ppc_arch_gr_t)(unsafe.Pointer(&buf[0]))
+ regs.r4 = *(*ppc_arch_gr_t)(unsafe.Pointer(&buf[1]))
+ } else {
+ w := v.iword()
+ if v.Kind() != Ptr && v.Kind() != UnsafePointer {
+ w = loadIword(unsafe.Pointer(w), v.typ.size)
+ if (ret_off_reg != 0) {
+ w = ppcReloadForRegister(ret_type, w, ret_off_reg)
+ }
+ }
+ if (ret_class == ppc_float_reg) {
+ regs.f1 = ppc_arch_fr_t(uintptr(w))
+ } else {
+ regs.r3 = ppc_arch_gr_t(uintptr(w))
+ }
+ }
+
+ case ppc_mem_ptr:
+ // The address of the memory area was passed as a hidden
+ // parameter in %r2. Multiple return values are always returned
+ // in an in-memory structure.
+ ptr := unsafe.Pointer(uintptr(regs.r3))
+ off := uintptr(0)
+ for i, typ := range ftyp.out {
+ v := out[i]
+ off = align(off, uintptr(typ.fieldAlign))
+ addr := unsafe.Pointer(uintptr(ptr) + off)
+ if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) {
+ storeIword(addr, iword(v.val), typ.size)
+ } else {
+ memmove(addr, v.val, typ.size)
+ }
+ off += typ.size
+ }
+
+ case ppc_empty:
+ }
+
+ return
+}
+
+// The ppc_add_stackreg function adds an argument passed on the
+// stack that could be passed in a register.
+func ppc_add_stackreg(
+ in []Value, ap uintptr, rt *rtype, offset uintptr) ([]Value, uintptr) {
+ // If we're not already at the beginning of a stack slot, round up to
+ // the beginning of the next one.
+ ap = align(ap, ppc_arch_stack_slot_align)
+ // If offset is > 0, the data is right aligned on the stack slot.
+ ap += offset
+
+ // We have to copy the argument onto the heap in case the
+ // function hangs onto the reflect.Value we pass it.
+ p := unsafe_New(rt)
+ memmove(p, unsafe.Pointer(ap), rt.size)
+
+ v := Value{rt, p, flag(rt.Kind()<<flagKindShift) | flagIndir}
+ in = append(in, v)
+ ap += rt.size
+ ap = align(ap, ppc_arch_stack_slot_align)
+
+ return in, ap
+}
+
+// The ppc_add_memarg function adds an argument passed in memory.
+func ppc_add_memarg(in []Value, ap uintptr, rt *rtype) ([]Value, uintptr) {
+ // If we're not already at the beginning of a stack slot,
+ // round up to the beginning of the next one.
+ ap = align(ap, ppc_arch_stack_slot_align)
+
+ // We have to copy the argument onto the heap in case the
+ // function hangs onto the reflect.Value we pass it.
+ p := unsafe_New(rt)
+ memmove(p, unsafe.Pointer(ap), rt.size)
+
+ v := Value{rt, p, flag(rt.Kind()<<flagKindShift) | flagIndir}
+ in = append(in, v)
+ ap += ppc_arch_stack_slot_align
+
+ return in, ap
+}
+
+// The ppc_general_reg_val function returns the value of integer register GR.
+func ppc_general_reg_val(regs *ppc_regs, gr int) uintptr {
+ var r ppc_arch_gr_t
+ switch gr {
+ case 0:
+ r = regs.r3
+ case 1:
+ r = regs.r4
+ case 2:
+ r = regs.r5
+ case 3:
+ r = regs.r6
+ case 4:
+ r = regs.r7
+ case 5:
+ r = regs.r8
+ case 6:
+ r = regs.r9
+ case 7:
+ r = regs.r10
+ default:
+ panic("ppc_general_reg_val: bad integer register")
+ }
+ return uintptr(r)
+}
+
+// The ppc_float_reg_val function returns the value of float register FR.
+func ppc_float_reg_val(regs *ppc_regs, fr int) uintptr {
+ var r ppc_arch_fr_t
+ switch fr {
+ case 0:
+ r = regs.f1
+ case 1:
+ r = regs.f2
+ case 2:
+ r = regs.f3
+ case 3:
+ r = regs.f4
+ case 4:
+ r = regs.f5
+ case 5:
+ r = regs.f6
+ case 6:
+ r = regs.f7
+ case 7:
+ r = regs.f8
+ case 8:
+ r = regs.f9
+ case 9:
+ r = regs.f10
+ case 10:
+ r = regs.f11
+ case 11:
+ r = regs.f12
+ case 12:
+ r = regs.f13
+ default:
+ panic("ppc_float_reg_val: bad floating point register")
+ }
+ return uintptr(r)
+}
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index bb6abfd04b0..1e4259df676 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -174,6 +174,9 @@ enum {
#ifdef TIOCGWINSZ
TIOCGWINSZ_val = TIOCGWINSZ,
#endif
+#ifdef TIOCSWINSZ
+ TIOCSWINSZ_val = TIOCSWINSZ,
+#endif
#ifdef TIOCNOTTY
TIOCNOTTY_val = TIOCNOTTY,
#endif
@@ -192,6 +195,12 @@ enum {
#ifdef TIOCSIG
TIOCSIG_val = TIOCSIG,
#endif
+#ifdef TCGETS
+ TCGETS_val = TCGETS,
+#endif
+#ifdef TCSETS
+ TCSETS_val = TCSETS,
+#endif
};
EOF
@@ -780,6 +789,11 @@ if ! grep '^const TIOCGWINSZ' ${OUT} >/dev/null 2>&1; then
echo 'const TIOCGWINSZ = _TIOCGWINSZ_val' >> ${OUT}
fi
fi
+if ! grep '^const TIOCSWINSZ' ${OUT} >/dev/null 2>&1; then
+ if grep '^const _TIOCSWINSZ_val' ${OUT} >/dev/null 2>&1; then
+ echo 'const TIOCSWINSZ = _TIOCSWINSZ_val' >> ${OUT}
+ fi
+fi
if ! grep '^const TIOCNOTTY' ${OUT} >/dev/null 2>&1; then
if grep '^const _TIOCNOTTY_val' ${OUT} >/dev/null 2>&1; then
echo 'const TIOCNOTTY = _TIOCNOTTY_val' >> ${OUT}
@@ -812,8 +826,18 @@ if ! grep '^const TIOCSIG' ${OUT} >/dev/null 2>&1; then
fi
# The ioctl flags for terminal control
-grep '^const _TC[GS]ET' gen-sysinfo.go | \
+grep '^const _TC[GS]ET' gen-sysinfo.go | grep -v _val | \
sed -e 's/^\(const \)_\(TC[GS]ET[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
+if ! grep '^const TCGETS' ${OUT} >/dev/null 2>&1; then
+ if grep '^const _TCGETS_val' ${OUT} >/dev/null 2>&1; then
+ echo 'const TCGETS = _TCGETS_val' >> ${OUT}
+ fi
+fi
+if ! grep '^const TCSETS' ${OUT} >/dev/null 2>&1; then
+ if grep '^const _TCSETS_val' ${OUT} >/dev/null 2>&1; then
+ echo 'const TCSETS = _TCSETS_val' >> ${OUT}
+ fi
+fi
# ioctl constants. Might fall back to 0 if TIOCNXCL is missing, too, but
# needs handling in syscalls.exec.go.
diff --git a/libgo/runtime/go-panic.h b/libgo/runtime/go-panic.h
index e7031d4040a..980d615dc0e 100644
--- a/libgo/runtime/go-panic.h
+++ b/libgo/runtime/go-panic.h
@@ -38,6 +38,10 @@ extern void __go_print_string (struct String);
extern struct __go_empty_interface __go_recover (void);
+extern void __go_makefunc_can_recover (const void *retaddr);
+
+extern void __go_makefunc_returning (void);
+
extern void __go_unwind_stack (void);
#endif /* !defined(LIBGO_GO_PANIC_H) */
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 0c5042774e9..81c62da380b 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/64734
+ * libgomp.c/pr64734.c: New test.
+
2014-12-03 Uros Bizjak <ubizjak@gmail.com>
* configure.tgt (x86_64-*-linux*): Tune -m32 multilib to generic.
diff --git a/libgomp/testsuite/libgomp.c/pr64734.c b/libgomp/testsuite/libgomp.c/pr64734.c
new file mode 100644
index 00000000000..457f481ae0b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr64734.c
@@ -0,0 +1,55 @@
+/* PR middle-end/64734 */
+
+#include <stdlib.h>
+
+void
+foo (int *x, int *y)
+{
+ #pragma omp target map (alloc:x[0]) map (alloc:y[0:8])
+ {
+ int i;
+ for (i = 0; i < 8; i++)
+ if (y[i] != 2 + i)
+ break;
+ if (i != 8 || *x != 1)
+ *x = 6;
+ else
+ {
+ *x = 8;
+ for (i = 0; i < 8; i++)
+ y[i] = 9 + i;
+ }
+ }
+ #pragma omp target update from (y[0:8]) from (x[0])
+}
+
+void
+bar (void)
+{
+ int x = 1, y[32] = { 0 };
+ #pragma omp target data map (to:y[0:32]) map (to:x)
+ ;
+}
+
+int
+main ()
+{
+ int x = 1, y[8] = { 2, 3, 4, 5, 6, 7, 8, 9 }, i;
+ #pragma omp target data map (to:y[0:8]) map (to:x)
+ ;
+ #pragma omp target data map (to:y[0:8]) map (to:x)
+ {
+ #pragma omp target update from (y[0:8]) from (x)
+ }
+
+ #pragma omp target data map (to:y[0:8]) map (to:x)
+ foo (&x, &y[0]);
+
+ if (x != 8)
+ abort ();
+ for (i = 0; i < 8; i++)
+ if (y[i] != 9 + i)
+ abort ();
+
+ return 0;
+}
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index 2722ed3fc34..a37072996c7 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-26 Matthias Klose <doko@ubuntu.com>
+
+ * configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
+ * configure: Regenerate.
+
2014-10-30 Release Manager
* GCC 4.9.2 released.
diff --git a/libquadmath/configure b/libquadmath/configure
index 907e0cf05cd..8b8ca499d7d 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -613,7 +613,6 @@ LIBQUAD_USE_SYMVER_FALSE
LIBQUAD_USE_SYMVER_TRUE
toolexeclibdir
toolexecdir
-multi_basedir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -682,6 +681,7 @@ am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
+multi_basedir
target_noncanonical
target_os
target_vendor
@@ -736,6 +736,7 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
+enable_multilib
enable_version_specific_runtime_libs
enable_dependency_tracking
with_bugurl
@@ -746,7 +747,6 @@ enable_fast_install
with_gnu_ld
enable_libtool_lock
enable_maintainer_mode
-enable_multilib
enable_symvers
enable_generated_files_in_srcdir
'
@@ -1379,6 +1379,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-multilib build many library versions (default)
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
@@ -1391,7 +1392,6 @@ Optional Features:
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
- --enable-multilib build many library versions (default)
--disable-symvers disable symbol versioning for libquadmath
--enable-generated-files-in-srcdir
put copies of generated files in source dir intended
@@ -2370,6 +2370,44 @@ esac
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+ enableval=$enable_multilib; case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop.."
+ fi
+else
+ multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
target_alias=${target_alias-$host_alias}
@@ -10527,7 +10565,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10530 "configure"
+#line 10568 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10633,7 +10671,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10636 "configure"
+#line 10674 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10918,43 +10956,6 @@ fi
MAINT=$MAINTAINER_MODE_TRUE
-# Default to --enable-multilib
-# Check whether --enable-multilib was given.
-if test "${enable_multilib+set}" = set; then :
- enableval=$enable_multilib; case "$enableval" in
- yes) multilib=yes ;;
- no) multilib=no ;;
- *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
- esac
-else
- multilib=yes
-fi
-
-
-# We may get other options which we leave undocumented:
-# --with-target-subdir, --with-multisrctop, --with-multisubdir
-# See config-ml.in if you want the gory details.
-
-if test "$srcdir" = "."; then
- if test "$with_target_subdir" != "."; then
- multi_basedir="$srcdir/$with_multisrctop../.."
- else
- multi_basedir="$srcdir/$with_multisrctop.."
- fi
-else
- multi_basedir="$srcdir/.."
-fi
-
-
-# Even if the default multilib is not a cross compilation,
-# it may be that some of the other multilibs are.
-if test $cross_compiling = no && test $multilib = yes \
- && test "x${with_multisubdir}" != x ; then
- cross_compiling=maybe
-fi
-
-ac_config_commands="$ac_config_commands default-1"
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -13644,6 +13645,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
+
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
@@ -13906,20 +13921,6 @@ fi
-srcdir="$srcdir"
-host="$host"
-target="$target"
-with_multisubdir="$with_multisubdir"
-with_multisrctop="$with_multisrctop"
-with_target_subdir="$with_target_subdir"
-ac_configure_args="${multilib_arg} ${ac_configure_args}"
-multi_basedir="$multi_basedir"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-CC="$CC"
-CXX="$CXX"
-GFORTRAN="$GFORTRAN"
-GCJ="$GCJ"
-
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -13929,9 +13930,9 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
- "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -14517,6 +14518,14 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
"depfiles":C) test x"$AMDEP_TRUE" != x"" || {
# Autoconf 2.62 quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
@@ -15251,14 +15260,6 @@ _LT_EOF
chmod +x "$ofile"
;;
- "default-1":C)
-# Only add multilib support code if we just rebuilt the top-level
-# Makefile.
-case " $CONFIG_FILES " in
- *" Makefile "*)
- ac_file=Makefile . ${multi_basedir}/config-ml.in
- ;;
-esac ;;
esac
done # for ac_tag
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index c547da8dc20..eb4fe8c8dfc 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -23,6 +23,8 @@ AC_CONFIG_HEADER(config.h)
AC_CANONICAL_SYSTEM
ACX_NONCANONICAL_TARGET
+AM_ENABLE_MULTILIB(, ..)
+
target_alias=${target_alias-$host_alias}
AC_SUBST(target_alias)
@@ -60,7 +62,6 @@ AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AM_MAINTAINER_MODE
-AM_ENABLE_MULTILIB(, ..)
AC_LANG_C
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 23bcabede45..ee4afbfa086 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-27 Matthias Klose <doko@ubuntu.com>
+
+ * configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
+ * configure: Regenerate.
+
2014-10-30 Release Manager
* GCC 4.9.2 released.
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 5e4840ffea4..c550ad61057 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -659,7 +659,6 @@ toolexecdir
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
-multi_basedir
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
@@ -717,6 +716,7 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
+multi_basedir
target_alias
host_alias
build_alias
@@ -758,9 +758,9 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
+enable_multilib
enable_version_specific_runtime_libs
enable_dependency_tracking
-enable_multilib
enable_maintainer_mode
enable_shared
enable_static
@@ -1404,10 +1404,10 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-multilib build many library versions (default)
--enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
- --enable-multilib build many library versions (default)
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
--enable-shared[=PKGS] build shared libraries [default=yes]
@@ -2625,6 +2625,44 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+ enableval=$enable_multilib; case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop.."
+ fi
+else
+ multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-version-specific-runtime-libs" >&5
$as_echo_n "checking for --enable-version-specific-runtime-libs... " >&6; }
# Check whether --enable-version-specific-runtime-libs was given.
@@ -4701,43 +4739,6 @@ fi
-# Default to --enable-multilib
-# Check whether --enable-multilib was given.
-if test "${enable_multilib+set}" = set; then :
- enableval=$enable_multilib; case "$enableval" in
- yes) multilib=yes ;;
- no) multilib=no ;;
- *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
- esac
-else
- multilib=yes
-fi
-
-
-# We may get other options which we leave undocumented:
-# --with-target-subdir, --with-multisrctop, --with-multisubdir
-# See config-ml.in if you want the gory details.
-
-if test "$srcdir" = "."; then
- if test "$with_target_subdir" != "."; then
- multi_basedir="$srcdir/$with_multisrctop../.."
- else
- multi_basedir="$srcdir/$with_multisrctop.."
- fi
-else
- multi_basedir="$srcdir/.."
-fi
-
-
-# Even if the default multilib is not a cross compilation,
-# it may be that some of the other multilibs are.
-if test $cross_compiling = no && test $multilib = yes \
- && test "x${with_multisubdir}" != x ; then
- cross_compiling=maybe
-fi
-
-ac_config_commands="$ac_config_commands default-1"
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
@@ -12019,7 +12020,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12022 "configure"
+#line 12023 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12125,7 +12126,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12128 "configure"
+#line 12129 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17090,7 +17091,6 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
srcdir="$srcdir"
host="$host"
@@ -17105,6 +17105,7 @@ CC="$CC"
CXX="$CXX"
GFORTRAN="$GFORTRAN"
GCJ="$GCJ"
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
# The HP-UX ksh and POSIX shell print the target directory to stdout
@@ -17492,8 +17493,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
- "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
@@ -18091,6 +18092,14 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
"depfiles":C) test x"$AMDEP_TRUE" != x"" || {
# Autoconf 2.62 quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
@@ -18186,14 +18195,6 @@ $as_echo X"$file" |
done
}
;;
- "default-1":C)
-# Only add multilib support code if we just rebuilt the top-level
-# Makefile.
-case " $CONFIG_FILES " in
- *" Makefile "*)
- ac_file=Makefile . ${multi_basedir}/config-ml.in
- ;;
-esac ;;
"libtool":C)
# See if we are running on zsh, and set the options which allow our
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index e6721312d0c..eb8b3ba0d41 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -5,6 +5,8 @@ AC_PREREQ([2.64])
AC_INIT(package-unused, version-unused, libsanitizer)
AC_CONFIG_SRCDIR([include/sanitizer/common_interface_defs.h])
+AM_ENABLE_MULTILIB(, ..)
+
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
AC_ARG_ENABLE(version-specific-runtime-libs,
[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
@@ -26,7 +28,6 @@ AC_SUBST(target_alias)
GCC_LIBSTDCXX_RAW_CXX_FLAGS
AM_INIT_AUTOMAKE(foreign no-dist)
-AM_ENABLE_MULTILIB(, ..)
AM_MAINTAINER_MODE
# Calculate toolexeclibdir
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f054f09722a..3c8b9e81263 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,105 @@
+2015-02-03 Tim Shen <timshen@google.com>
+
+ PR libstdc++/64680
+ Backported from mainline
+ 2015-01-22 Tim Shen <timshen@google.com>
+
+ * include/bits/regex.h (basic_regex<>::basic_regex,
+ basic_regex<>::operator=, basic_regex<>::imbue): Conform to the
+ standard interface.
+ * testsuite/28_regex/basic_regex/assign/char/cstring.cc: New testcase.
+
+2015-02-03 Tim Shen <timshen@google.com>
+
+ PR libstdc++/64649
+ Backported from mainline
+ 2015-01-22 Tim Shen <timshen@google.com>
+
+ * include/bits/regex.tcc (regex_traits<>::lookup_collatename,
+ regex_traits<>::lookup_classname): Correctly narrow input chars.
+ * testsuite/28_regex/traits/wchar_t/user_defined.cc: New testcase.
+
+2015-01-19 Tim Shen <timshen@google.com>
+
+ PR libstdc++/64649
+ Backported from mainline
+ 2015-01-19 Tim Shen <timshen@google.com>
+
+ * include/bits/regex.tcc (regex_traits<>::lookup_collatename,
+ regex_traits<>::lookup_classname): Support forward iterators.
+ * testsuite/28_regex/traits/char/lookup_classname.cc: New testcases.
+ * testsuite/28_regex/traits/char/lookup_collatename.cc: New testcase.
+
+2015-01-19 Tim Shen <timshen@google.com>
+
+ PR libstdc++/64584
+ PR libstdc++/64585
+ * include/bits/regex.h (basic_regex<>::basic_regex,
+ basic_regex<>::assign, basic_regex<>::imbue,
+ basic_regex<>::swap, basic_regex<>::mark_count): Drop NFA after
+ imbuing basic_regex; Make assign() transactional against exception.
+ * testsuite/28_regex/basic_regex/assign/char/string.cc: New testcase.
+ * testsuite/28_regex/basic_regex/imbue/string.cc: New testcase.
+
+2015-01-18 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/64646
+ * include/bits/stl_algo.h (__is_permutation): Also test for reaching
+ end of the second range.
+ * testsuite/25_algorithms/is_permutation/64646.cc: New.
+
+2015-01-09 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/64476
+ * include/bits/stl_uninitialized.h (uninitialized_copy): Fix
+ is_assignable arguments.
+ * testsuite/20_util/specialized_algorithms/uninitialized_copy/64476.cc:
+ New.
+
+2015-01-09 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/60966
+ * include/std/future (packaged_task::operator()): Increment the
+ reference count on the shared state until the function returns.
+
+2015-01-09 Tim Shen <timshen@google.com>
+
+ PR libstdc++/64239
+ Backported form mainline
+ 2015-01-09 Tim Shen <timshen@google.com>
+
+ * include/bits/regex.h (match_results<>::swap): Use std::swap
+ instead of swap.
+ * include/bits/regex_compiler.tcc (_Compiler<>::_M_quantifier):
+ Likewise.
+ * testsuite/28_regex/match_results/swap.cc: New testcase.
+
+2014-12-17 Tim Shen <timshen@google.com>
+
+ PR libstdc++/64302
+ PR libstdc++/64303
+ Backported form mainline
+ 2014-12-17 Tim Shen <timshen@google.com>
+
+ * include/bits/regex.h (match_results::cbegin, match_results::cend,
+ regex_token_iterator::regex_token_iterator,
+ regex_token_iterator::_M_normalize_result): Fix match_results cbegin
+ and cend and regex_token_iterator::_M_result invariant.
+ * include/bits/regex.tcc: Fix regex_token_iterator::_M_result invariant.
+ * testsuite/28_regex/iterators/regex_token_iterator/64303.cc: Testcase.
+
+2014-12-13 Tim Shen <timshen@google.com>
+
+ PR libstdc++/64239
+ * include/bits/regex.h (match_results<>::match_results,
+ match_results<>::operator=, match_results<>::position,
+ match_results<>::swap): Fix ctor/assign/swap.
+ * include/bits/regex.tcc: (__regex_algo_impl<>,
+ regex_iterator<>::operator++): Set match_results::_M_begin as
+ "start position".
+ * testsuite/28_regex/iterators/regex_iterator/char/
+ string_position_01.cc: Test cases.
+
2014-12-09 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/64203
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index fe10ceb96d3..ea706799ed6 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -449,7 +449,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
explicit
basic_regex(const _Ch_type* __p, flag_type __f = ECMAScript)
- : basic_regex(__p, __p + _Rx_traits::length(__p), __f)
+ : basic_regex(__p, __p + char_traits<_Ch_type>::length(__p), __f)
{ }
/**
@@ -476,7 +476,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
basic_regex(const basic_regex& __rhs)
: _M_flags(__rhs._M_flags), _M_original_str(__rhs._M_original_str)
- { this->imbue(__rhs.getloc()); }
+ {
+ _M_traits.imbue(__rhs.getloc());
+ this->assign(_M_original_str, _M_flags);
+ }
/**
* @brief Move-constructs a basic regular expression.
@@ -490,7 +493,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _M_flags(__rhs._M_flags),
_M_original_str(std::move(__rhs._M_original_str))
{
- this->imbue(__rhs.getloc());
+ _M_traits.imbue(__rhs.getloc());
+ this->assign(_M_original_str, _M_flags);
__rhs._M_automaton.reset();
}
@@ -580,7 +584,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
basic_regex&
operator=(const _Ch_type* __p)
- { return this->assign(__p, flags()); }
+ { return this->assign(__p); }
+
+ /**
+ * @brief Replaces a regular expression with a new one constructed from
+ * an initializer list.
+ *
+ * @param __l The initializer list.
+ *
+ * @throws regex_error if @p __l is not a valid regular expression.
+ */
+ basic_regex&
+ operator=(initializer_list<_Ch_type> __l)
+ { return this->assign(__l.begin(), __l.end()); }
/**
* @brief Replaces a regular expression with a new one constructed from
@@ -591,7 +607,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Ch_typeraits, typename _Alloc>
basic_regex&
operator=(const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s)
- { return this->assign(__s, flags()); }
+ { return this->assign(__s); }
// [7.8.3] assign
/**
@@ -604,7 +620,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
_M_flags = __rhs._M_flags;
_M_original_str = __rhs._M_original_str;
- this->imbue(__rhs.getloc());
+ _M_traits.imbue(__rhs.getloc());
+ this->assign(_M_original_str, _M_flags);
return *this;
}
@@ -622,7 +639,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_flags = __rhs._M_flags;
_M_original_str = std::move(__rhs._M_original_str);
__rhs._M_automaton.reset();
- this->imbue(__rhs.getloc());
+ _M_traits.imbue(__rhs.getloc());
+ this->assign(_M_original_str, _M_flags);
+ return *this;
}
/**
@@ -675,12 +694,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
assign(const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s,
flag_type __flags = ECMAScript)
{
+ _M_automaton = __detail::__compile_nfa(
+ __s.data(), __s.data() + __s.size(), _M_traits, __flags);
+ _M_original_str = __s;
_M_flags = __flags;
- _M_original_str.assign(__s.begin(), __s.end());
- auto __p = _M_original_str.c_str();
- _M_automaton = __detail::__compile_nfa(__p,
- __p + _M_original_str.size(),
- _M_traits, _M_flags);
return *this;
}
@@ -725,7 +742,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
unsigned int
mark_count() const
- { return _M_automaton->_M_sub_count() - 1; }
+ {
+ if (_M_automaton)
+ return _M_automaton->_M_sub_count() - 1;
+ return 0;
+ }
/**
* @brief Gets the flags used to construct the regular expression
@@ -744,9 +765,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
locale_type
imbue(locale_type __loc)
{
- auto __ret = _M_traits.imbue(__loc);
- this->assign(_M_original_str, _M_flags);
- return __ret;
+ _M_automaton.reset();
+ return _M_traits.imbue(__loc);
}
/**
@@ -767,8 +787,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
swap(basic_regex& __rhs)
{
std::swap(_M_flags, __rhs._M_flags);
- std::swap(_M_original_str, __rhs._M_original_str);
- this->imbue(__rhs.imbue(this->getloc()));
+ std::swap(_M_traits, __rhs._M_traits);
+ auto __tmp = std::move(_M_original_str);
+ this->assign(__rhs._M_original_str, _M_flags);
+ __rhs.assign(__tmp, __rhs._M_flags);
}
#ifdef _GLIBCXX_DEBUG
@@ -777,7 +799,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ _M_automaton->_M_dot(__ostr); }
#endif
- protected:
+ private:
typedef std::shared_ptr<__detail::_NFA<_Rx_traits>> _AutomatonPtr;
template<typename _Bp, typename _Ap, typename _Cp, typename _Rp,
@@ -1568,42 +1590,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
explicit
match_results(const _Alloc& __a = _Alloc())
- : _Base_type(__a), _M_in_iterator(false)
+ : _Base_type(__a)
{ }
/**
* @brief Copy constructs a %match_results.
*/
- match_results(const match_results& __rhs)
- : _Base_type(__rhs), _M_in_iterator(false)
- { }
+ match_results(const match_results& __rhs) = default;
/**
* @brief Move constructs a %match_results.
*/
- match_results(match_results&& __rhs) noexcept
- : _Base_type(std::move(__rhs)), _M_in_iterator(false)
- { }
+ match_results(match_results&& __rhs) noexcept = default;
/**
* @brief Assigns rhs to *this.
*/
match_results&
- operator=(const match_results& __rhs)
- {
- match_results(__rhs).swap(*this);
- return *this;
- }
+ operator=(const match_results& __rhs) = default;
/**
* @brief Move-assigns rhs to *this.
*/
match_results&
- operator=(match_results&& __rhs)
- {
- match_results(std::move(__rhs)).swap(*this);
- return *this;
- }
+ operator=(match_results&& __rhs) = default;
/**
* @brief Destroys a %match_results object.
@@ -1690,13 +1700,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
difference_type
position(size_type __sub = 0) const
{
- // [28.12.1.4.5]
- if (_M_in_iterator)
- return __sub < size() ? std::distance(_M_begin,
- (*this)[__sub].first) : -1;
- else
- return __sub < size() ? std::distance(this->prefix().first,
- (*this)[__sub].first) : -1;
+ return __sub < size() ? std::distance(_M_begin,
+ (*this)[__sub].first) : -1;
}
/**
@@ -1778,7 +1783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
const_iterator
cbegin() const
- { return _Base_type::cbegin() + 2; }
+ { return this->begin(); }
/**
* @brief Gets an iterator to one-past-the-end of the collection.
@@ -1792,7 +1797,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
const_iterator
cend() const
- { return _Base_type::cend(); }
+ { return this->end(); }
//@}
@@ -1881,7 +1886,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
void
swap(match_results& __that)
- { _Base_type::swap(__that); }
+ {
+ using std::swap;
+ _Base_type::swap(__that);
+ swap(_M_begin, __that._M_begin);
+ }
//@}
private:
@@ -2620,7 +2629,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
regex_constants::match_flag_type __m
= regex_constants::match_default)
: _M_position(__a, __b, __re, __m),
- _M_subs(__submatches, *(&__submatches+1)), _M_n(0)
+ _M_subs(__submatches, __submatches + _Nm), _M_n(0)
{ _M_init(__a, __b); }
/**
@@ -2629,12 +2638,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
regex_token_iterator(const regex_token_iterator& __rhs)
: _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
- _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_result(__rhs._M_result),
- _M_has_m1(__rhs._M_has_m1)
- {
- if (__rhs._M_result == &__rhs._M_suffix)
- _M_result = &_M_suffix;
- }
+ _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
+ { _M_normalize_result(); }
/**
* @brief Assigns a %regex_token_iterator to another.
@@ -2706,6 +2711,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_end_of_seq() const
{ return _M_result == nullptr; }
+ // [28.12.2.2.4]
+ void
+ _M_normalize_result()
+ {
+ if (_M_position != _Position())
+ _M_result = &_M_current_match();
+ else if (_M_has_m1)
+ _M_result = &_M_suffix;
+ else
+ _M_result = nullptr;
+ }
+
_Position _M_position;
std::vector<int> _M_subs;
value_type _M_suffix;
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc
index 364294d4184..792ed9206ce 100644
--- a/libstdc++-v3/include/bits/regex.tcc
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -62,6 +62,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return false;
typename match_results<_BiIter, _Alloc>::_Base_type& __res = __m;
+ __m._M_begin = __s;
__res.resize(__re._M_automaton->_M_sub_count() + 2);
for (auto& __it : __res)
__it.matched = false;
@@ -274,53 +275,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
"right-curly-bracket",
"tilde",
"DEL",
- ""
};
- // same as boost
- //static const char* __digraphs[] =
- // {
- // "ae",
- // "Ae",
- // "AE",
- // "ch",
- // "Ch",
- // "CH",
- // "ll",
- // "Ll",
- // "LL",
- // "ss",
- // "Ss",
- // "SS",
- // "nj",
- // "Nj",
- // "NJ",
- // "dz",
- // "Dz",
- // "DZ",
- // "lj",
- // "Lj",
- // "LJ",
- // ""
- // };
-
- std::string __s(__last - __first, '?');
- __fctyp.narrow(__first, __last, '?', &*__s.begin());
-
- for (unsigned int __i = 0; *__collatenames[__i]; __i++)
- if (__s == __collatenames[__i])
- return string_type(1, __fctyp.widen(static_cast<char>(__i)));
-
- //for (unsigned int __i = 0; *__digraphs[__i]; __i++)
- // {
- // const char* __now = __digraphs[__i];
- // if (__s == __now)
- // {
- // string_type ret(__s.size(), __fctyp.widen('?'));
- // __fctyp.widen(__now, __now + 2/* ouch */, &*ret.begin());
- // return ret;
- // }
- // }
+ string __s;
+ for (; __first != __last; ++__first)
+ __s += __fctyp.narrow(*__first, 0);
+
+ for (const auto& __it : __collatenames)
+ if (__s == __it)
+ return string_type(1, __fctyp.widen(
+ static_cast<char>(&__it - __collatenames)));
+
+ // TODO Add digraph support:
+ // http://boost.sourceforge.net/libs/regex/doc/collating_names.html
+
return string_type();
}
@@ -331,12 +299,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase) const
{
typedef std::ctype<char_type> __ctype_type;
- typedef std::ctype<char> __cctype_type;
- typedef const pair<const char*, char_class_type> _ClassnameEntry;
const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
- const __cctype_type& __cctyp(use_facet<__cctype_type>(_M_locale));
- static _ClassnameEntry __classnames[] =
+ // Mappings from class name to class mask.
+ static const pair<const char*, char_class_type> __classnames[] =
{
{"d", ctype_base::digit},
{"w", {ctype_base::alnum, _RegexMask::_S_under}},
@@ -355,22 +321,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{"xdigit", ctype_base::xdigit},
};
- std::string __s(__last - __first, '?');
- __fctyp.narrow(__first, __last, '?', &__s[0]);
- __cctyp.tolower(&*__s.begin(), &*__s.begin() + __s.size());
- for (_ClassnameEntry* __it = __classnames;
- __it < *(&__classnames + 1);
- ++__it)
- {
- if (__s == __it->first)
- {
- if (__icase
- && ((__it->second
- & (ctype_base::lower | ctype_base::upper)) != 0))
- return ctype_base::alpha;
- return __it->second;
- }
- }
+ string __s;
+ for (; __first != __last; ++__first)
+ __s += __fctyp.narrow(__fctyp.tolower(*__first), 0);
+
+ for (const auto& __it : __classnames)
+ if (__s == __it.first)
+ {
+ if (__icase
+ && ((__it.second
+ & (ctype_base::lower | ctype_base::upper)) != 0))
+ return ctype_base::alpha;
+ return __it.second;
+ }
return 0;
}
@@ -584,7 +547,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
auto& __prefix = _M_match.at(_M_match.size());
__prefix.first = __prefix_first;
__prefix.matched = __prefix.first != __prefix.second;
- _M_match._M_in_iterator = true;
+ // [28.12.1.4.5]
_M_match._M_begin = _M_begin;
return *this;
}
@@ -599,7 +562,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
auto& __prefix = _M_match.at(_M_match.size());
__prefix.first = __prefix_first;
__prefix.matched = __prefix.first != __prefix.second;
- _M_match._M_in_iterator = true;
+ // [28.12.1.4.5]
_M_match._M_begin = _M_begin;
}
else
@@ -618,11 +581,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_position = __rhs._M_position;
_M_subs = __rhs._M_subs;
_M_n = __rhs._M_n;
- _M_result = __rhs._M_result;
_M_suffix = __rhs._M_suffix;
_M_has_m1 = __rhs._M_has_m1;
- if (__rhs._M_result == &__rhs._M_suffix)
- _M_result = &_M_suffix;
+ _M_normalize_result();
return *this;
}
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
index 14e40c0cd19..ffe01705fe6 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -271,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
auto& __tmp = _M_nfa[__stack.top()];
__stack.pop();
- swap(__tmp._M_next, __tmp._M_alt);
+ std::swap(__tmp._M_next, __tmp._M_alt);
}
}
_M_stack.push(__e);
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index cfb50a92884..c9980e55414 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -3595,7 +3595,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Efficiently compare identical prefixes: O(N) if sequences
// have the same elements in the same order.
- for (; __first1 != __last1; ++__first1, ++__first2)
+ for (; __first1 != __last1 && __first2 != __last2;
+ ++__first1, ++__first2)
if (!__pred(__first1, __first2))
break;
diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h
index cd2a4828361..42b40267a6c 100644
--- a/libstdc++-v3/include/bits/stl_uninitialized.h
+++ b/libstdc++-v3/include/bits/stl_uninitialized.h
@@ -115,8 +115,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const bool __assignable = true;
#else
// trivial types can have deleted assignment
- typedef typename iterator_traits<_InputIterator>::reference _RefType;
- const bool __assignable = is_assignable<_ValueType1, _RefType>::value;
+ typedef typename iterator_traits<_InputIterator>::reference _RefType1;
+ typedef typename iterator_traits<_ForwardIterator>::reference _RefType2;
+ const bool __assignable = is_assignable<_RefType2, _RefType1>::value;
#endif
return std::__uninitialized_copy<__is_trivial(_ValueType1)
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index d446b9d55cb..6523cea8e86 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -1450,7 +1450,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator()(_ArgTypes... __args)
{
__future_base::_State_base::_S_check(_M_state);
- _M_state->_M_run(std::forward<_ArgTypes>(__args)...);
+ auto __state = _M_state;
+ __state->_M_run(std::forward<_ArgTypes>(__args)...);
}
void
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/64476.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/64476.cc
new file mode 100644
index 00000000000..6369b17af1e
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/64476.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+
+#include <memory>
+#include <testsuite_hooks.h>
+
+struct X
+{
+ X() = default;
+ X(X const &) = default;
+ X& operator=(X const&) = delete;
+};
+
+static_assert(__is_trivial(X), "X is trivial");
+
+int constructed = 0;
+int assigned = 0;
+
+struct Y
+{
+ Y() = default;
+ Y(Y const &) = default;
+ Y& operator=(Y const&) = default;
+
+ Y(const X&) { ++constructed; }
+ Y& operator=(const X&)& { ++assigned; return *this; }
+ Y& operator=(const X&)&& = delete;
+ Y& operator=(X&&) = delete;
+};
+
+static_assert(__is_trivial(Y), "Y is trivial");
+
+void
+test01()
+{
+ X a[100];
+ Y b[100];
+
+ std::uninitialized_copy(a, a+10, b);
+
+ VERIFY(constructed == 0);
+ VERIFY(assigned == 10);
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc b/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc
new file mode 100644
index 00000000000..799a18c5d7f
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++14" }
+
+#include <algorithm>
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::forward_list<int> l1{0}, l2;
+ VERIFY( !std::is_permutation(l1.begin(), l1.end(), l2.begin(), l2.end()) );
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc
index 16dae9a16a6..7011d1c8529 100644
--- a/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc
@@ -1,5 +1,4 @@
-// { dg-do compile }
-// { dg-options "-std=c++0x" }
+// { dg-options "-std=c++11" }
// 2009-06-05 Stephen M. Webb <stephen.webb@bregmasoft.ca>
//
@@ -36,9 +35,19 @@ void test01()
re.assign(cs);
}
+// basic_regex::operator=() resets flags. libstdc++/64680
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("[[:alnum:]]", std::regex_constants::basic);
+ re = "\\w+";
+}
+
int
main()
{
test01();
+ test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc
index 0a32ab5e61f..7d4db8f10af 100644
--- a/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc
@@ -1,4 +1,3 @@
-// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
@@ -29,6 +28,7 @@
// Tests C++ string assignment of the basic_regex class.
void test01()
{
+ bool test __attribute__((unused)) = true;
typedef std::basic_regex<char> test_type;
std::string s("a*b");
@@ -36,9 +36,27 @@ void test01()
re.assign(s);
}
+// libstdc++/64584
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ std::regex re("", std::regex_constants::extended);
+ auto flags = re.flags();
+ try
+ {
+ re.assign("(", std::regex_constants::icase);
+ VERIFY(false);
+ }
+ catch (const std::regex_error& e)
+ {
+ VERIFY(flags == re.flags());
+ }
+}
+
int
main()
{
test01();
+ test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/imbue/string.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/imbue/string.cc
new file mode 100644
index 00000000000..d4d4f470547
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/imbue/string.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// [28.8.5] class template basic_regex locale
+
+#include <string>
+#include <regex>
+#include <testsuite_hooks.h>
+
+// libstdc++/64585
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ static const char s[] = "a";
+ std::regex re("a");
+ VERIFY(std::regex_search(s, re));
+
+ auto loc = re.imbue(re.getloc());
+ VERIFY(!std::regex_search(s, re));
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc b/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc
index 5fa4ea77492..91aa06137f5 100644
--- a/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc
+++ b/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc
@@ -24,6 +24,7 @@
// Tests iter->position() behavior
#include <regex>
+#include <tuple>
#include <testsuite_hooks.h>
void
@@ -41,9 +42,53 @@ test01()
}
}
+// PR libstdc++/64239
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("\\w+");
+ std::string s("-a-b-c-");
+
+ std::tuple<int, int, const char*> expected[] =
+ {
+ std::make_tuple(1, 1, "a"),
+ std::make_tuple(3, 1, "b"),
+ std::make_tuple(5, 1, "c"),
+ };
+
+ int i = 0;
+ for (auto it1 = std::sregex_iterator(s.begin(), s.end(), re),
+ end = std::sregex_iterator(); it1 != end; ++it1, i++)
+ {
+ auto it2 = it1;
+ VERIFY(it1->position() == std::get<0>(expected[i]));
+ VERIFY(it1->length() == std::get<1>(expected[i]));
+ VERIFY(it1->str() == std::get<2>(expected[i]));
+ VERIFY(it2->position() == std::get<0>(expected[i]));
+ VERIFY(it2->length() == std::get<1>(expected[i]));
+ VERIFY(it2->str() == std::get<2>(expected[i]));
+ }
+}
+
+void
+test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::smatch m;
+ std::string s = "abcde";
+ std::regex_search(s, m, std::regex("bcd"));
+ VERIFY(m.position() == 1);
+ VERIFY(m.position() == m.prefix().length());
+}
+
int
main()
{
test01();
+ test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc b/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc
new file mode 100644
index 00000000000..f09bbe1c98b
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+// { dg-options "-std=gnu++11" }
+
+//
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.12.2 Class template regex_token_iterator
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const std::string s(" 111 222 ");
+ const std::regex re("\\w+");
+
+ std::sregex_token_iterator it1(s.begin(), s.end(), re), it2(it1), end;
+
+ for (; it1 != end; ++it1, ++it2) {
+ VERIFY(it1 == it2);
+ VERIFY(*it1 == *it2);
+ }
+ VERIFY(it2 == end);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/match_results/swap.cc b/libstdc++-v3/testsuite/28_regex/match_results/swap.cc
new file mode 100644
index 00000000000..18248c1c575
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/match_results/swap.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::cmatch m;
+ std::regex_match("a", m, std::regex("a"));
+ std::cmatch mm1 = m, mm2;
+ mm1.swap(mm2);
+ VERIFY(m == mm2);
+ std::swap(mm1, mm2);
+ VERIFY(m == mm1);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc b/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc
index 48ab04375ec..f2a99ab4a16 100644
--- a/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc
+++ b/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc
@@ -26,6 +26,7 @@
// 28.7(9) Class template regex_traits [re.traits]
#include <regex>
+#include <forward_list>
#include <testsuite_hooks.h>
void
@@ -47,8 +48,29 @@ test01()
VERIFY( c2 == c3 );
}
+// Test forward iterator
+void
+test02()
+{
+ const char strlit[] = "upper";
+ std::forward_list<char> s(strlit, strlit + strlen(strlit));
+ std::regex_traits<char> traits;
+ VERIFY(traits.isctype('C', traits.lookup_classname(s.begin(), s.end(), false)));
+}
+
+// icase
+void
+test03()
+{
+ std::string s("lower");
+ std::regex_traits<char> traits;
+ VERIFY(traits.isctype('C', traits.lookup_classname(s.begin(), s.end(), true)));
+}
+
int main()
{
test01();
+ test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc b/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc
index 825f2ba2bc5..698c18df747 100644
--- a/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc
+++ b/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc
@@ -26,6 +26,7 @@
// 28.7 (8) Class template regex_traits [re.traits]
#include <regex>
+#include <forward_list>
#include <testsuite_hooks.h>
void
@@ -40,8 +41,19 @@ test01()
VERIFY(t.lookup_collatename(name, name+sizeof(name)-1) == "~");
}
+// Test forward iterator.
+void
+test02()
+{
+ const char strlit[] = "tilde";
+ std::forward_list<char> s(strlit, strlit + strlen(strlit));
+ std::regex_traits<char> traits;
+ VERIFY(traits.lookup_collatename(s.begin(), s.end()) == "~");
+}
+
int main()
{
test01();
+ test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/28_regex/traits/wchar_t/user_defined.cc b/libstdc++-v3/testsuite/28_regex/traits/wchar_t/user_defined.cc
index 7eca2d5474d..975a943f74c 100644
--- a/libstdc++-v3/testsuite/28_regex/traits/wchar_t/user_defined.cc
+++ b/libstdc++-v3/testsuite/28_regex/traits/wchar_t/user_defined.cc
@@ -55,8 +55,32 @@ test01()
VERIFY(!regex_match(L"\u2029", re));
}
+struct MyCtype : std::ctype<wchar_t>
+{
+ char
+ do_narrow(wchar_t c, char dflt) const override
+ {
+ if (c >= 256)
+ return dflt;
+ return ((char)c)+1;
+ }
+};
+
+void
+test02()
+{
+ std::locale loc(std::locale(), new MyCtype);
+ std::regex_traits<wchar_t> traits;
+ traits.imbue(loc);
+ wchar_t wch = L'p';
+ VERIFY(traits.lookup_collatename(&wch, &wch+1) == L"q");
+ std::wstring ws = L"chfhs"; // chars of "digit" shifted by 1.
+ VERIFY(traits.lookup_classname(ws.begin(), ws.end()) != 0);
+}
+
int main()
{
test01();
+ test02();
return 0;
}