From f27d3dec7c06f9964c5087e52cd677b7dc2440b1 Mon Sep 17 00:00:00 2001 From: yroux Date: Thu, 12 Feb 2015 09:21:29 +0000 Subject: [PATCH] Merge branches/gcc-4_9-branch rev 220524 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@220638 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 248 +++++++++++++++ gcc/DATESTAMP | 2 +- gcc/ada/ChangeLog | 5 + gcc/ada/gcc-interface/decl.c | 9 +- gcc/alias.c | 14 +- gcc/c-family/ChangeLog | 9 + gcc/c-family/c-common.c | 3 +- gcc/c/ChangeLog | 15 + gcc/c/c-typeck.c | 5 +- gcc/config/aarch64/aarch64-simd.md | 35 +++ gcc/config/i386/avx2intrin.h | 18 ++ gcc/config/i386/driver-i386.c | 14 + gcc/config/i386/emmintrin.h | 16 + gcc/config/i386/i386.c | 12 +- gcc/config/i386/i386.md | 10 +- gcc/config/i386/predicates.md | 9 +- gcc/config/i386/sse.md | 2 +- gcc/config/nios2/nios2.c | 15 + gcc/config/rs6000/rs6000-cpus.def | 1 + gcc/config/rs6000/rs6000.c | 28 +- gcc/config/rs6000/rs6000.md | 12 +- gcc/config/s390/s390.c | 31 +- gcc/config/s390/s390.md | 2 +- gcc/cp/ChangeLog | 18 ++ gcc/cp/decl.c | 2 + gcc/cp/pt.c | 3 + gcc/cp/repo.c | 6 +- gcc/cse.c | 40 ++- gcc/dse.c | 8 + gcc/dwarf2out.c | 16 +- gcc/dwarf2out.h | 2 +- gcc/expr.c | 18 +- gcc/fortran/ChangeLog | 50 +++ gcc/fortran/class.c | 37 ++- gcc/fortran/dependency.c | 37 ++- gcc/fortran/interface.c | 17 +- gcc/fortran/intrinsic.texi | 4 +- gcc/fortran/resolve.c | 125 ++++---- gcc/fortran/trans-decl.c | 5 +- gcc/go/gofrontend/export.cc | 16 +- gcc/go/gofrontend/export.h | 5 +- gcc/go/gofrontend/gogo.cc | 79 ++++- gcc/go/gofrontend/gogo.h | 16 +- gcc/go/gofrontend/import.cc | 10 +- gcc/go/gofrontend/unsafe.cc | 2 +- gcc/ipa-inline-transform.c | 2 +- gcc/ipa.c | 14 +- gcc/jump.c | 25 +- gcc/lto-cgraph.c | 3 +- gcc/omp-low.c | 11 +- gcc/ree.c | 75 ++++- gcc/rtlanal.c | 13 +- gcc/testsuite/ChangeLog | 187 +++++++++++ gcc/testsuite/c-c++-common/pr61553.c | 8 + gcc/testsuite/c-c++-common/tsan/atomic_stack.c | 8 +- gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c | 9 +- gcc/testsuite/c-c++-common/tsan/mutexset1.c | 9 +- gcc/testsuite/c-c++-common/tsan/race_on_barrier.c | 10 +- gcc/testsuite/c-c++-common/tsan/race_on_mutex.c | 12 +- gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c | 11 +- gcc/testsuite/c-c++-common/tsan/simple_race.c | 11 +- gcc/testsuite/c-c++-common/tsan/simple_stack.c | 25 +- gcc/testsuite/c-c++-common/tsan/sleep_sync.c | 6 + gcc/testsuite/c-c++-common/tsan/tiny_race.c | 8 +- gcc/testsuite/c-c++-common/tsan/tls_race.c | 8 +- gcc/testsuite/c-c++-common/tsan/tsan_barrier.h | 14 + .../c-c++-common/tsan/write_in_reader_lock.c | 8 +- gcc/testsuite/g++.dg/cpp0x/override1.C | 4 + gcc/testsuite/g++.dg/cpp0x/variadic165.C | 17 + gcc/testsuite/g++.dg/ipa/pr64068.C | 49 +++ gcc/testsuite/g++.dg/pr54442.C | 12 + gcc/testsuite/g++.dg/template/repo11.C | 31 ++ gcc/testsuite/g++.dg/tsan/atomic_free.C | 9 +- gcc/testsuite/g++.dg/tsan/atomic_free2.C | 9 +- gcc/testsuite/g++.dg/tsan/cond_race.C | 9 +- gcc/testsuite/g++.dg/tsan/tsan_barrier.h | 14 + gcc/testsuite/gcc.dg/ipa/PR64559.c | 39 +++ gcc/testsuite/gcc.dg/pr61058.c | 10 + gcc/testsuite/gcc.dg/pr63637-1.c | 15 + gcc/testsuite/gcc.dg/pr63637-2.c | 15 + gcc/testsuite/gcc.dg/pr63637-3.c | 15 + gcc/testsuite/gcc.dg/pr63637-4.c | 15 + gcc/testsuite/gcc.dg/pr63637-5.c | 15 + gcc/testsuite/gcc.dg/pr63637-6.c | 15 + gcc/testsuite/gcc.dg/pr64563.c | 14 + gcc/testsuite/gcc.dg/pr64663.c | 17 + gcc/testsuite/gcc.dg/pr64766.c | 9 + gcc/testsuite/gcc.dg/pr64778.c | 10 + gcc/testsuite/gcc.dg/tm/pr64391.c | 10 + gcc/testsuite/gcc.dg/vect/pr64421.c | 36 +++ gcc/testsuite/gcc.target/aarch64/pr63424.c | 39 +++ gcc/testsuite/gcc.target/i386/avx2-pr64286.c | 37 +++ gcc/testsuite/gcc.target/i386/builtin_target.c | 30 ++ gcc/testsuite/gcc.target/i386/pr63637-1.c | 15 + gcc/testsuite/gcc.target/i386/pr63637-2.c | 15 + gcc/testsuite/gcc.target/i386/pr63637-3.c | 15 + gcc/testsuite/gcc.target/i386/pr63637-4.c | 15 + gcc/testsuite/gcc.target/i386/pr63637-5.c | 15 + gcc/testsuite/gcc.target/i386/pr63637-6.c | 15 + gcc/testsuite/gcc.target/i386/pr64513.c | 17 + gcc/testsuite/gcc.target/i386/sse-14.c | 2 + gcc/testsuite/gcc.target/i386/sse-22.c | 4 + gcc/testsuite/gfortran.dg/allocate_with_mold_1.f90 | 47 +++ gcc/testsuite/gfortran.dg/class_allocate_17.f90 | 32 ++ gcc/testsuite/gfortran.dg/class_allocate_18.f90 | 21 ++ gcc/testsuite/gfortran.dg/coarray_36.f | 347 +++++++++++++++++++++ gcc/testsuite/gfortran.dg/coarray_37.f90 | 18 ++ gcc/testsuite/gfortran.dg/internal_pack_15.f90 | 77 +++++ gcc/testsuite/gfortran.dg/pr64528.f90 | 20 ++ gcc/testsuite/gnat.dg/opt47.adb | 31 ++ gcc/testsuite/gnat.dg/unchecked_convert1.adb | 4 +- gcc/trans-mem.c | 9 +- gcc/tree-vrp.c | 2 +- gcc/tree.c | 7 +- libatomic/ChangeLog | 5 + libatomic/fop_n.c | 12 +- libbacktrace/ChangeLog | 5 + libbacktrace/configure | 133 ++++---- libbacktrace/configure.ac | 5 +- libcilkrts/ChangeLog | 5 + libcilkrts/configure | 105 ++++--- libcilkrts/configure.ac | 3 +- libgcc/ChangeLog | 30 ++ libgcc/config/i386/cpuinfo.c | 12 + libgcc/config/nios2/linux-unwind.h | 3 +- libgcc/config/pa/linux-atomic.c | 42 +-- libgomp/ChangeLog | 5 + libgomp/testsuite/libgomp.c/pr64734.c | 55 ++++ libquadmath/ChangeLog | 5 + libquadmath/configure | 131 ++++---- libquadmath/configure.ac | 3 +- libsanitizer/ChangeLog | 5 + libsanitizer/configure | 105 ++++--- libsanitizer/configure.ac | 3 +- libstdc++-v3/ChangeLog | 50 +++ libstdc++-v3/include/bits/regex.h | 60 ++-- libstdc++-v3/include/bits/regex.tcc | 92 ++---- libstdc++-v3/include/bits/stl_algo.h | 3 +- .../25_algorithms/is_permutation/64646.cc | 35 +++ .../28_regex/basic_regex/assign/char/cstring.cc | 13 +- .../28_regex/basic_regex/assign/char/string.cc | 20 +- .../testsuite/28_regex/basic_regex/imbue/string.cc | 44 +++ .../28_regex/traits/char/lookup_classname.cc | 22 ++ .../28_regex/traits/char/lookup_collatename.cc | 12 + .../28_regex/traits/wchar_t/user_defined.cc | 24 ++ 145 files changed, 3162 insertions(+), 616 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/pr61553.c create mode 100644 gcc/testsuite/c-c++-common/tsan/tsan_barrier.h create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic165.C create mode 100644 gcc/testsuite/g++.dg/ipa/pr64068.C create mode 100644 gcc/testsuite/g++.dg/pr54442.C create mode 100644 gcc/testsuite/g++.dg/template/repo11.C create mode 100644 gcc/testsuite/g++.dg/tsan/tsan_barrier.h create mode 100644 gcc/testsuite/gcc.dg/ipa/PR64559.c create mode 100644 gcc/testsuite/gcc.dg/pr61058.c create mode 100644 gcc/testsuite/gcc.dg/pr63637-1.c create mode 100644 gcc/testsuite/gcc.dg/pr63637-2.c create mode 100644 gcc/testsuite/gcc.dg/pr63637-3.c create mode 100644 gcc/testsuite/gcc.dg/pr63637-4.c create mode 100644 gcc/testsuite/gcc.dg/pr63637-5.c create mode 100644 gcc/testsuite/gcc.dg/pr63637-6.c create mode 100644 gcc/testsuite/gcc.dg/pr64563.c create mode 100644 gcc/testsuite/gcc.dg/pr64663.c create mode 100644 gcc/testsuite/gcc.dg/pr64766.c create mode 100644 gcc/testsuite/gcc.dg/pr64778.c create mode 100644 gcc/testsuite/gcc.dg/tm/pr64391.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr64421.c create mode 100644 gcc/testsuite/gcc.target/aarch64/pr63424.c create mode 100644 gcc/testsuite/gcc.target/i386/avx2-pr64286.c create mode 100644 gcc/testsuite/gcc.target/i386/pr63637-1.c create mode 100644 gcc/testsuite/gcc.target/i386/pr63637-2.c create mode 100644 gcc/testsuite/gcc.target/i386/pr63637-3.c create mode 100644 gcc/testsuite/gcc.target/i386/pr63637-4.c create mode 100644 gcc/testsuite/gcc.target/i386/pr63637-5.c create mode 100644 gcc/testsuite/gcc.target/i386/pr63637-6.c create mode 100644 gcc/testsuite/gcc.target/i386/pr64513.c create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_mold_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/class_allocate_17.f90 create mode 100644 gcc/testsuite/gfortran.dg/class_allocate_18.f90 create mode 100644 gcc/testsuite/gfortran.dg/coarray_36.f create mode 100644 gcc/testsuite/gfortran.dg/coarray_37.f90 create mode 100644 gcc/testsuite/gfortran.dg/internal_pack_15.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr64528.f90 create mode 100644 gcc/testsuite/gnat.dg/opt47.adb create mode 100644 libgomp/testsuite/libgomp.c/pr64734.c create mode 100644 libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc create mode 100644 libstdc++-v3/testsuite/28_regex/basic_regex/imbue/string.cc diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c09fe7..f7bb14f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,251 @@ +2015-02-05 Segher Boessenkool + + 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 + + PR target/64938 + Backport from mainline + 2015-01-15 Jan Hubicka + + 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 + + Backport from mainline + 2015-01-31 Uros Bizjak + + 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 + + * config/i386/i386.md (*prefetch_prefetchw1): Remove mode of + address_operand 0. Rename from *prefetch_prefetchwt1_. + * config/i386/predicates.md (address_no_seg_operand): Call + address_operand with VOIDmode. + (vsib_address_operand): Ditto. + +2015-02-01 H.J. Lu + + Backported from mainline + 2015-01-24 H.J. Lu + + * 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 + + Backported from mainline + 2015-01-27 Jakub Jelinek + + 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 + + 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 + + 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 + + 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 + + * 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 + + * config/s390/s390.c (s390_memory_move_cost): Increase costs for + memory accesses. + +2015-01-27 Andreas Krebbel + + * config/s390/s390.c (s390_register_move_cost): Increase costs for + FPR->GPR moves. + +2015-01-26 Uros Bizjak + + Backport from mainline + 2015-01-26 Uros Bizjak + + 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 + + * config/i386/sse.md (sse2_loadld): Set attribute isa to sse2 for + alternative 1. + +2015-01-23 Jakub Jelinek + + 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 + + Backported from trunk. + 2015-01-22 Wei Mi + + PR rtl-optimization/64557 + * dse.c (record_store): Call get_addr for mem_addr. + (check_mem_read_rtx): Likewise. + +2015-01-22 Andreas Krebbel + + * config/s390/s390.md (atomic code attribute): Fix typo "ior" -> + "or". + +2015-01-21 Wei Mi + + Backported from trunk. + 2014-11-22 Jan Hubicka + + 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 + + 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 + + Backport from mainline + 2014-11-27 Richard Biener + + 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 + + * expr.c (expand_expr_real_1) : Use the expression to + set the memory attributes in all cases but clear MEM_EXPR if need be. + +2015-01-14 Jakub Jelinek + + Backported from mainline + 2015-01-12 Jakub Jelinek + + 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 + + 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 + + PR tree-optimization/64563 + * tree-vrp.c (vrp_evaluate_conditional): Check for VR_RANGE + instead of != VR_VARYING. + +2015-01-14 Marek Polacek + + Backport from mainline + 2015-01-13 Marek Polacek + + PR middle-end/64391 + * trans-mem.c (get_attrs_for): Return NULL_TREE if X is NULL_TREE. + +2015-01-13 Marc Glisse + + PR c++/54442 + * tree.c (build_qualified_type): Use a canonical type for + TYPE_CANONICAL. + +2015-01-13 Pat Haugen + + Backport from mainline + 2014-12-20 Segher Boessenkool + + 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 (*boolc3_internal1 for BOOL_128): + Swap BOOL_REGS_OP1 and BOOL_REGS_OP2. Correct arguments to + rs6000_split_logical. + (*boolc3_internal2 for TI2): Swap operands[1] and operands[2]. + +2015-01-13 Renlin Li + + Backport from mainline: + 2014-11-19 Renlin Li + + PR target/63424 + * config/aarch64/aarch64-simd.md (v2di3): New. + +2015-01-13 Oleg Endo + + Backport form mainline + 2015-01-13 Oleg Endo + + PR target/64479 + * rtlanal.c (set_reg_p): Handle SEQUENCE constructs. + 2015-01-09 Jakub Jelinek PR rtl-optimization/64536 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8c9f1eb..2e50b8f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20150113 +20150208 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ba21f43..ef516a3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2015-02-08 Eric Botcazou + + * gcc-interface/decl.c (is_cplusplus_method): Use Is_Primitive flag to + detect primitive operations of tagged and untagged types. + 2015-01-05 Eric Botcazou PR ada/64492 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 95bc778..0f62af7 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5510,16 +5510,17 @@ is_cplusplus_method (Entity_Id gnat_entity) if (Convention (gnat_entity) != Convention_CPP) return false; - /* This is the main case: C++ method imported as a primitive operation. */ - if (Is_Dispatching_Operation (gnat_entity)) + /* This is the main case: C++ method imported as a primitive operation. + Note that a C++ class with no virtual functions can be imported as a + limited record type so the operation is not necessarily dispatching. */ + if (Is_Primitive (gnat_entity)) return true; /* A thunk needs to be handled like its associated primitive operation. */ if (Is_Subprogram (gnat_entity) && Is_Thunk (gnat_entity)) return true; - /* C++ classes with no virtual functions can be imported as limited - record types, but we need to return true for the constructors. */ + /* A constructor is a method on the C++ side. */ if (Is_Constructor (gnat_entity)) return true; diff --git a/gcc/alias.c b/gcc/alias.c index 99add26..9956306 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 c1f2fc0..701d1ce 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,12 @@ +2015-01-20 Marek Polacek + + Backport from mainline + 2014-06-23 Marek Polacek + + 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 487fb4e..8856701 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 deb70eb..57be674 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,18 @@ +2015-02-01 Jakub Jelinek + + Backported from mainline + 2015-01-27 Jakub Jelinek + + 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 + + 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 d736fbc..bc24a3b 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3085,7 +3085,7 @@ convert_arguments (location_t loc, vec 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/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 137519f..bb7be4b 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -951,6 +951,41 @@ [(set_attr "type" "neon_minmax")] ) +(define_expand "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 () + { + 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/i386/avx2intrin.h b/gcc/config/i386/avx2intrin.h index d04c972..76233b5 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 722c546..992f91f 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 a2bdf0e..8eb5cab 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 d96d6c5..d620116 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -11076,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))); } } @@ -11089,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))); } } @@ -32362,7 +32370,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 @@ -32383,6 +32392,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 cd7eadb..2f76305 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_" - [(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/predicates.md b/gcc/config/i386/predicates.md index 2ef1384..4ba2e6f 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 c700425..5a62572 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 cdd2e6b..047b615 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/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index b17fd0d..ba56df8 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -91,6 +91,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 96da81b..f5df7d5 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -20691,7 +20691,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. */ @@ -21100,6 +21100,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; @@ -23821,11 +23824,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 (); @@ -23857,6 +23859,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. */ @@ -32553,6 +32565,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 46837e1..f77754a 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -8600,8 +8600,8 @@ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=") (match_operator:BOOL_128 3 "boolean_operator" [(not:BOOL_128 - (match_operand:BOOL_128 2 "vlogical_operand" "")) - (match_operand:BOOL_128 1 "vlogical_operand" "")]))] + (match_operand:BOOL_128 2 "vlogical_operand" "")) + (match_operand:BOOL_128 1 "vlogical_operand" "")]))] "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)" { if (TARGET_VSX && vsx_register_operand (operands[0], mode)) @@ -8616,7 +8616,7 @@ && reload_completed && int_reg_operand (operands[0], 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; } @@ -8638,14 +8638,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/s390/s390.c b/gcc/config/s390/s390.c index cf337b0..c566899 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 b17c1fa..10d7a5a 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/cp/ChangeLog b/gcc/cp/ChangeLog index 8fcbbe6..83bf91d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,21 @@ +2015-02-04 Ville Voutilainen + + PR c++/64901 + * decl.c (duplicate_decls): Also duplicate DECL_FINAL_P and + DECL_OVERRIDE_P. + +2015-01-29 Jason Merrill + + 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 + + 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 PR c++/64487 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1613e9a..4cc386e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1788,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 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 699ae69..2abfc70 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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)); diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index f076f23..2b571c5 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/cse.c b/gcc/cse.c index ec9aff4..9b8b816 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/dse.c b/gcc/dse.c index 09dc5df..878fedc 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 d48895c..23319d0 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 696fef9..a8e6452 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 efda624..575da43 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9982,7 +9982,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 @@ -10078,7 +10078,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) @@ -10263,17 +10263,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 c0cae2b..f9509e6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,53 @@ +2015-02-03 Steven G. Kargl + + * intrinsic.texi (CO_ASSOCIATED): c_prt_1 should be c_ptr_1. + +2015-01-27 Paul Thomas + + 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 + + PR fortran/64771 + * interface.c (check_dummy_characteristics): Fix coarray handling. + +2015-01-26 Janus Weil + + 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 + + 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 + + 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 + + Backported from mainline + 2015-01-13 Jakub Jelinek + + 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 Backport from mainline diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 346aee6..aee9666 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 f9b975a..3c7d579 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 f24641c..db20475 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: diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index eb6924c..8d003d6 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 a23f6d4..54d7176 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; @@ -5782,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; @@ -5982,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; @@ -6017,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; @@ -6230,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; @@ -6500,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; @@ -6853,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) @@ -6899,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)) @@ -7055,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 @@ -8268,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; @@ -8398,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; @@ -8410,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; @@ -8422,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; } @@ -9081,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; @@ -9882,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; @@ -10690,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; } @@ -11021,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. */ @@ -11044,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. */ @@ -11068,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. */ @@ -11180,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 @@ -12023,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; } @@ -12475,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; @@ -12549,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; @@ -12599,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; @@ -12660,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; @@ -12675,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; @@ -12695,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; @@ -13265,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; @@ -13411,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; } @@ -14622,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-decl.c b/gcc/fortran/trans-decl.c index 2b06679..4b3e89b 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 13c61a5..e37f034 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& 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 c6a4810..c010a14 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& imports, diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index f042f64..699456d 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 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 3f28087..2e378b4 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.cc b/gcc/go/gofrontend/import.cc index 4913100..daeb42f 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 e7c61f0..e9409b2 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 6f68631..a9be22f 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 ebaa82d..fe4d0fb 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 e6dabd0..d41373b 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 173067f..9e6915f 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 ea45e20..f0059be 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 750b780..7d00d81 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; - enum machine_mode dst_mode = GET_MODE (SET_DEST (PATTERN (cand->insn))); rtx src_reg = get_extended_src_reg (SET_SRC (PATTERN (cand->insn))); @@ -1010,6 +1009,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) { @@ -1021,6 +1021,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/rtlanal.c b/gcc/rtlanal.c index 98fbacc..e99ef7b 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 4545277..1c6a780 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,190 @@ +2015-02-04 Matthias Klose + + Backport from mainline + 2015-01-15 Martin Liska + + * g++.dg/ipa/pr64068.C: New test. + * gcc.dg/ipa/PR64559.c: New test. + +2015-02-04 Uros Bizjak + + Backport from mainline + 2015-01-31 Uros Bizjak + + PR target/64882 + * gcc.dg/torture/pr64882.c: New test. + +2015-02-01 H.J. Lu + + Backported from mainline + 2015-01-24 H.J. Lu + + * 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 + + Backported from mainline + 2015-01-27 Jakub Jelinek + + PR rtl-optimization/61058 + * gcc.dg/pr61058.c: New test. + + PR c/64766 + * gcc.dg/pr64766.c: New test. + + 2015-01-26 Jakub Jelinek + + 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 + + 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 + + PR debug/64663 + * gcc.dg/pr64663.c: New test. + +2015-01-29 Ilya Tocar + + * gcc.target/i386/sse-14.c: Test new intrinsic. + * gcc.target/i386/sse-22.c: Ditto. + +2015-01-27 Paul Thomas + + Backport from mainline + PR fortran/62044 + * gfortran.dg/allocate_with_mold_1.f90: New test + +2015-01-27 Janus Weil + + Backport from mainline + PR fortran/64230 + * gfortran.dg/class_allocate_18.f90: Remove -fsanitize option to + prevent linking errors. + +2015-01-27 Tobias Burnus + + PR fortran/64771 + * gfortran.dg/coarray_36.f: New. + * gfortran.dg/coarray_37.f90: New. + +2015-01-26 Janus Weil + + Backport from mainline + PR fortran/64230 + * gfortran.dg/class_allocate_18.f90: New. + +2015-01-26 Eric Botcazou + + PR testsuite/64712 + * gnat.dg/unchecked_convert1.adb (Unchecked_Convert1): Initialize A. + +2015-01-24 Thomas Koenig + + Backport from trunk + PR fortran/57023 + * gfortran.dg/internal_pack_15.f90: New test. + +2015-01-24 Janus Weil + + Backport from mainline + PR fortran/60922 + * gfortran.dg/class_allocate_17.f90: New. + +2015-01-20 Marek Polacek + + Backport from mainline + 2014-06-23 Marek Polacek + + PR c/61553 + * c-c++-common/pr61553.c: New test. + +2015-01-16 Bernd Edlinger + + * 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 + + * gnat.dg/opt47.adb: New test. + +2015-01-14 Jakub Jelinek + + Backported from mainline + 2015-01-12 Jakub Jelinek + + PR target/64513 + * gcc.target/i386/pr64513.c: New test. + + 2015-01-13 Jakub Jelinek + + 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 + + PR tree-optimization/64563 + * gcc.dg/pr64563.c: New test. + +2015-01-14 Marek Polacek + + Backport from mainline + 2015-01-13 Marek Polacek + + PR middle-end/64391 + * gcc.dg/tm/pr64391.c: New test. + +2015-01-13 Marc Glisse + + PR c++/54442 + * g++.dg/pr54442.C: New file. + +2015-01-13 Renlin Li + + Backported from mainline + 2014-11-19 Renlin Li + + PR target/63424 + * gcc.target/aarch64/pr63424.c: New Test. + 2015-01-12 Janus Weil Backport from mainline diff --git a/gcc/testsuite/c-c++-common/pr61553.c b/gcc/testsuite/c-c++-common/pr61553.c new file mode 100644 index 0000000..8a3b699 --- /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 6a37951..746afa7 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 -#include +#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 28cd630..e2176da 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 -#include #include +#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 7c32a85..084f514 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 -#include -#include +#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 0a0e5fa..3de3ff2 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 -#include -#include -#include +#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 5dad345..ae30d05 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 -#include -#include -#include +#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 80a6fb6..57d7e21 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 -#include -#include -#include +#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 a40accd..c1a369b 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 -#include #include +#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 b66a670..a4d0aba 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 -#include -#include +#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 44d4455..c681dce 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 #include +#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 962497b..10a3feb 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 -#include +#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 423867e..4dd6506 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 -#include +#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 0000000..5d37a64 --- /dev/null +++ b/gcc/testsuite/c-c++-common/tsan/tsan_barrier.h @@ -0,0 +1,14 @@ +/* TSAN-invisible barriers. Link with -ldl. */ +#include +#include + +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 898d23d..df32632 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 -#include +#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/override1.C b/gcc/testsuite/g++.dg/cpp0x/override1.C index e05693f..77f6034 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 struct D2 : T diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic165.C b/gcc/testsuite/g++.dg/cpp0x/variadic165.C new file mode 100644 index 0000000..862931f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic165.C @@ -0,0 +1,17 @@ +// PR c++/64514 +// { dg-do compile { target c++11 } } + +template +struct Functor +{ + template + 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 0000000..9528883 --- /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 0000000..a489565 --- /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/template/repo11.C b/gcc/testsuite/g++.dg/template/repo11.C new file mode 100644 index 0000000..5cabfd4 --- /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 struct J { J(H) {} }; +template struct K; +template struct K {}; +template +struct K : K, J { + K(const H &p1, const T &... p2) : K(p2...), J(p1) {} +}; +template struct C : K<0, E...> { + C(const E &... p1) : K<0, E...>(p1...) {} +}; +template struct A { + A() = default; +}; +struct M; +template struct L { + struct B { + template static M *__test(...); + typedef A _Del; + typedef decltype(__test<_Del>()) type; + }; + C> _M_t; + L(typename B::type) : _M_t(0, A()) {} +}; +struct M {}; +int main() { L(new M); } diff --git a/gcc/testsuite/g++.dg/tsan/atomic_free.C b/gcc/testsuite/g++.dg/tsan/atomic_free.C index 26d01ae..20429f1 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 -#include +#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 1fe512c..3b6a8e3 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 -#include +#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 a937614..d72d0fb 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 -#include #include +#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 0000000..5d37a64 --- /dev/null +++ b/gcc/testsuite/g++.dg/tsan/tsan_barrier.h @@ -0,0 +1,14 @@ +/* TSAN-invisible barriers. Link with -ldl. */ +#include +#include + +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/gcc.dg/ipa/PR64559.c b/gcc/testsuite/gcc.dg/ipa/PR64559.c new file mode 100644 index 0000000..463afdc --- /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/pr61058.c b/gcc/testsuite/gcc.dg/pr61058.c new file mode 100644 index 0000000..6f840f4 --- /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 0000000..7a716f9 --- /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 0000000..44e9d7c --- /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 0000000..51a2ff7 --- /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 0000000..1a91483 --- /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 0000000..fce8593 --- /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 0000000..1b997c4 --- /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/pr64563.c b/gcc/testsuite/gcc.dg/pr64563.c new file mode 100644 index 0000000..7223349 --- /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 0000000..9a0bf0d --- /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 0000000..bf6fb2d --- /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 0000000..71a2607 --- /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 0000000..235118a --- /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 0000000..7e48a8b --- /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 0000000..c6bd762 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr63424.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#include + +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 0000000..2edb321 --- /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 +#include +#include +#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 c40983e..af73338 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/pr63637-1.c b/gcc/testsuite/gcc.target/i386/pr63637-1.c new file mode 100644 index 0000000..9cc9750 --- /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 0000000..fc54900 --- /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 0000000..4b631ce --- /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 0000000..7b36690 --- /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 0000000..f0c79b7 --- /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 0000000..4b0b3ba --- /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/pr64513.c b/gcc/testsuite/gcc.target/i386/pr64513.c new file mode 100644 index 0000000..0236496 --- /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 d9a5fed..ca0745e 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 e9f227a..e6a1d31 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 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/gfortran.dg/allocate_with_mold_1.f90 b/gcc/testsuite/gfortran.dg/allocate_with_mold_1.f90 new file mode 100644 index 0000000..2ea6d22 --- /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 +! +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 0000000..639ba80 --- /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 + +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 0000000..ad3f76c --- /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 + +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 0000000..d06a01e --- /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 0000000..6f56c32 --- /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/internal_pack_15.f90 b/gcc/testsuite/gfortran.dg/internal_pack_15.f90 new file mode 100644 index 0000000..13e3304 --- /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 0000000..f6cca4f --- /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/gnat.dg/opt47.adb b/gcc/testsuite/gnat.dg/opt47.adb new file mode 100644 index 0000000..cfe44eb --- /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 eb63d59..1a02c19 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/trans-mem.c b/gcc/trans-mem.c index fe6dc28..73afb23 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-vrp.c b/gcc/tree-vrp.c index 57a58b1..2f93c7e 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 5ce8e90..293b29f 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/libatomic/ChangeLog b/libatomic/ChangeLog index 6be97ea..de4c8f5 100644 --- a/libatomic/ChangeLog +++ b/libatomic/ChangeLog @@ -1,3 +1,8 @@ +2015-01-21 Andrew Waterman + + * 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 4a18da9..9739b9c 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 f73ab03..90826b5 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,8 @@ +2015-01-26 Matthias Klose + + * 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 f4f9d05..57a0f94 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 878bd2c..40b4d54 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 2b7bc43..375085c 100644 --- a/libcilkrts/ChangeLog +++ b/libcilkrts/ChangeLog @@ -1,3 +1,8 @@ +2015-01-26 Matthias Klose + + * 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 0dadbbd..31f848e 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 fb21505..369d94a 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 d729ccb..1a02eb4 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,33 @@ +2015-02-01 H.J. Lu + + Backported from mainline + 2015-01-24 H.J. Lu + + * 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 + + * 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 + + 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 Backport from mainline diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c index 6ff7502..7972ced 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 92ff1f6..ba4bd80 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 19e37b6..2554f46 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/libgomp/ChangeLog b/libgomp/ChangeLog index 0c50427..81c62da 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2015-01-23 Jakub Jelinek + + PR middle-end/64734 + * libgomp.c/pr64734.c: New test. + 2014-12-03 Uros Bizjak * 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 0000000..457f481 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr64734.c @@ -0,0 +1,55 @@ +/* PR middle-end/64734 */ + +#include + +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 2722ed3..a370729 100644 --- a/libquadmath/ChangeLog +++ b/libquadmath/ChangeLog @@ -1,3 +1,8 @@ +2015-01-26 Matthias Klose + + * 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 907e0cf..8b8ca49 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 c547da8..eb4fe8c 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 23bcabe..ee4afbf 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,8 @@ +2015-01-27 Matthias Klose + + * 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 5e4840f..c550ad6 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 e672131..eb8b3ba 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 28ee344..3c8b9e8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,53 @@ +2015-02-03 Tim Shen + + PR libstdc++/64680 + Backported from mainline + 2015-01-22 Tim Shen + + * 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 + + PR libstdc++/64649 + Backported from mainline + 2015-01-22 Tim Shen + + * 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 + + PR libstdc++/64649 + Backported from mainline + 2015-01-19 Tim Shen + + * 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 + + 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 + + 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 PR libstdc++/64476 diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 3cbec3c..ea70679 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 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(__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(&__it - __collatenames))); + + // TODO Add digraph support: + // http://boost.sourceforge.net/libs/regex/doc/collating_names.html + return string_type(); } @@ -332,12 +299,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase) const { typedef std::ctype __ctype_type; - typedef std::ctype __cctype_type; - typedef const pair _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 __classnames[] = { {"d", ctype_base::digit}, {"w", {ctype_base::alnum, _RegexMask::_S_under}}, @@ -356,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; } diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index cfb50a9..c9980e5 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/testsuite/25_algorithms/is_permutation/64646.cc b/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc new file mode 100644 index 0000000..799a18c --- /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 +// . + +// { dg-options "-std=gnu++14" } + +#include +#include +#include + +void +test01() +{ + std::forward_list 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 16dae9a..7011d1c 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 // @@ -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 0a32ab5..7d4db8f 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 @@ -29,6 +28,7 @@ // Tests C++ string assignment of the basic_regex class. void test01() { + bool test __attribute__((unused)) = true; typedef std::basic_regex 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 0000000..d4d4f47 --- /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 +// . + +// [28.8.5] class template basic_regex locale + +#include +#include +#include + +// 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/traits/char/lookup_classname.cc b/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc index 48ab043..f2a99ab 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 +#include #include void @@ -47,8 +48,29 @@ test01() VERIFY( c2 == c3 ); } +// Test forward iterator +void +test02() +{ + const char strlit[] = "upper"; + std::forward_list s(strlit, strlit + strlen(strlit)); + std::regex_traits traits; + VERIFY(traits.isctype('C', traits.lookup_classname(s.begin(), s.end(), false))); +} + +// icase +void +test03() +{ + std::string s("lower"); + std::regex_traits 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 825f2ba..698c18d 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 +#include #include 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 s(strlit, strlit + strlen(strlit)); + std::regex_traits 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 7eca2d5..975a943 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 +{ + 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 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; } -- 2.7.4