summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-01-15 13:20:50 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-01-15 13:20:50 +0000
commita1dc5f3f6808a90bd006dfd0918a418564dfe227 (patch)
treed83a5575075861c6aa0f61bc77c9358642b3942f
parentf400b65dc33b04817230f953170aa853b43f93b9 (diff)
downloadgcc-a1dc5f3f6808a90bd006dfd0918a418564dfe227.tar.gz
Merge branches/gcc-6-branch rev 256699.
Change-Id: Ib35a6e2c663e57fd6c857b54fd4287bef5bddfa8
-rw-r--r--gcc/ChangeLog152
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/decl.c3
-rw-r--r--gcc/c/ChangeLog9
-rw-r--r--gcc/c/c-parser.c9
-rw-r--r--gcc/cgraph.c2
-rw-r--r--gcc/combine.c3
-rw-r--r--gcc/config.gcc4
-rw-r--r--gcc/config/arm/arm.h8
-rw-r--r--gcc/config/i386/i386.c59
-rw-r--r--gcc/config/i386/i386.h5
-rw-r--r--gcc/config/i386/x86-tune.def4
-rw-r--r--gcc/config/pa/pa.c9
-rw-r--r--gcc/config/rs6000/altivec.md2
-rw-r--r--gcc/config/rs6000/ppc-asm.h4
-rw-r--r--gcc/config/rs6000/ppc-auxv.h1
-rw-r--r--gcc/config/rs6000/rs6000-protos.h1
-rw-r--r--gcc/config/rs6000/rs6000.c98
-rw-r--r--gcc/config/sol2.h4
-rw-r--r--gcc/config/sparc/sparc.c8
-rwxr-xr-xgcc/configure2
-rw-r--r--gcc/configure.ac2
-rw-r--r--gcc/fortran/ChangeLog39
-rw-r--r--gcc/fortran/interface.c11
-rw-r--r--gcc/fortran/resolve.c18
-rw-r--r--gcc/fortran/simplify.c17
-rw-r--r--gcc/ggc-page.c5
-rw-r--r--gcc/hwint.h1
-rw-r--r--gcc/testsuite/ChangeLog104
-rw-r--r--gcc/testsuite/g++.dg/torture/pr78692.C26
-rw-r--r--gcc/testsuite/gcc.dg/pr82975.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr60092.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82941-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82941-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82942-1.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82942-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-3.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-4.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-5.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-6.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-7.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr80210-2.c11
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr83677.c166
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_typespec_7.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/deferred_character_18.f9029
-rw-r--r--gcc/testsuite/gfortran.dg/interface_40.f908
-rw-r--r--gcc/testsuite/gfortran.dg/simplify_cshift_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/transfer_simplify_11.f908
-rw-r--r--gcc/testsuite/gnat.dg/alignment13.adb21
-rw-r--r--gcc/testsuite/lib/target-supports.exp4
-rw-r--r--libgcc/ChangeLog11
-rw-r--r--libgcc/config.host2
-rw-r--r--libgcc/config/sol2/crtpg.c9
-rw-r--r--libgcc/configure2
-rw-r--r--libgcc/configure.ac2
-rw-r--r--libgfortran/ChangeLog16
-rw-r--r--libgfortran/io/list_read.c22
-rw-r--r--libgfortran/io/unix.c49
-rw-r--r--libgo/configure.ac2
-rwxr-xr-xlibgo/mksysinfo.sh8
-rw-r--r--libgomp/ChangeLog8
-rw-r--r--libgomp/testsuite/libgomp.c/pr81875.c46
-rw-r--r--libstdc++-v3/ChangeLog85
-rw-r--r--libstdc++-v3/include/bits/locale_conv.h2
-rw-r--r--libstdc++-v3/include/bits/regex.h2
-rw-r--r--libstdc++-v3/include/experimental/bits/fs_ops.h7
-rw-r--r--libstdc++-v3/include/std/complex10
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/printers.py6
-rw-r--r--libstdc++-v3/src/filesystem/ops.cc144
-rw-r--r--libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc58
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/59568.cc191
-rw-r--r--libstdc++-v3/testsuite/28_regex/basic_regex/ctors/83598.cc37
-rw-r--r--libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc4
-rw-r--r--libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc19
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc1
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc100
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc36
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc2
83 files changed, 1652 insertions, 227 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 809adfcd915..b17b12ae7de 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,155 @@
+2018-01-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/83677
+ * config/rs6000/altivec.md (*altivec_vpermr_<mode>_internal):
+ Reverse order of second and third operands in first alternative.
+ * config/rs6000/rs6000.c (rs6000_expand_vector_set): Reverse order
+ of first and second elements in UNSPEC_VPERMR vector.
+ (altivec_expand_vec_perm_le): Likewise.
+
+2018-01-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2017-12-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82975
+ * config/arm/arm.h (TEST_REGNO): Check reg_renumber is set before
+ accessing it. Adjust comment.
+
+2017-12-17 John David Anglin <danglin@gcc.gnu.org>
+
+ Backport from mainline
+ 2017-12-03 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/pa.c (pa_legitimate_address_p): For scaled indexing,
+ require base operand is a REG_POINTER prior to reload on targets
+ with non-equivalent space registers.
+
+2017-12-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/66488
+ * ggc-page.c (HOST_BITS_PER_PTR): Do not define here...
+ * hwint.h (HOST_BITS_PER_PTR): ...but here instead.
+
+2017-12-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-12-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ * config/rs6000/ppc-auxv.h (PPC_FEATURE2_HTM_NO_SUSPEND): New define.
+ * config/rs6000/rs6000.c (cpu_supports_info): Use it.
+
+2017-12-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-10-02 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/80210
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Rewrite
+ function to not use the have_cpu variable. Do not set cpu_index,
+ rs6000_cpu_index or rs6000_tune_index if we end up using TARGET_DEFAULT
+ or the default cpu.
+ (rs6000_valid_attribute_p): Remove duplicate initializations of
+ old_optimize and func_optimize.
+ (rs6000_pragma_target_parse): Call rs6000_activate_target_options ().
+ (rs6000_activate_target_options): Make global.
+ * config/rs6000/rs6000-protos.h (rs6000_activate_target_options): Add
+ prototype.
+
+2017-12-11 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR c++/83301
+
+ Backport trunk r243377:
+ 2016-12-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/78692
+ * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Set lhs
+ var to lhs of new_stmt right before noreturn handling rather than to
+ lhs of e->call_stmt early.
+
+2017-12-04 Sebastian Peryt <sebastian.peryt@intel.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ Bakcported from trunk
+ PR target/82941
+ PR target/82942
+ PR target/82990
+ * config/i386/i386.c (pass_insert_vzeroupper): Remove
+ TARGET_AVX512F check from gate condition.
+ (ix86_check_avx256_register): Changed to ...
+ (ix86_check_avx_upper_register): ... this. Add extra check for
+ VALID_AVX512F_REG_OR_XI_MODE.
+ (ix86_avx_u128_mode_needed): Changed
+ ix86_check_avx256_register to ix86_check_avx_upper_register.
+ (ix86_check_avx256_stores): Changed to ...
+ (ix86_check_avx_upper_stores): ... this. Changed
+ ix86_check_avx256_register to ix86_check_avx_upper_register.
+ (ix86_avx_u128_mode_after): Changed
+ avx_reg256_found to avx_upper_reg_found. Changed
+ ix86_check_avx256_stores to ix86_check_avx_upper_stores.
+ (ix86_avx_u128_mode_entry): Changed
+ ix86_check_avx256_register to ix86_check_avx_upper_register.
+ (ix86_avx_u128_mode_exit): Ditto.
+ (ix86_option_override_internal): Set MASK_VZEROUPPER if
+ neither -mzeroupper nor -mno-zeroupper is used and
+ TARGET_EMIT_VZEROUPPER is set.
+ * config/i386/i386.h: (host_detect_local_cpu): New define.
+ (TARGET_EMIT_VZEROUPPER): New.
+ * config/i386/x86-tune.def: Add X86_TUNE_EMIT_VZEROUPPER
+
+2017-12-01 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2017-11-28 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR 81288/target
+ * config/rs6000/rs6000.c (rs6000_rtx_costs): Do not handle
+ TARGET_ISEL && !TARGET_MFCRF differently. Simplify code.
+
+2017-11-29 Daniel Cederman <cederman@gaisler.com>
+
+ Backport from mainline
+ * config/sparc/sparc.c (sparc_do_work_around_errata): Treat the
+ movsi_pic_gotdata_op instruction as a load for the UT699 errata
+ workaround.
+
+2017-11-24 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2017-11-17 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/82621
+ * combine.c (try_combine): Do not split PARALLELs of two SETs if the
+ dest of one of those SETs is unused.
+
+2017-11-21 Pat Haugen <pthaugen@us.ibm.com>
+
+ Backport from mainline
+ 2017-11-21 Pat Haugen <pthaugen@us.ibm.com>
+
+ * config/rs6000/ppc-asm.h (f50, vs50): Fix values.
+
+2017-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2017-11-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * config.gcc (*-*-solaris2*): Enable default_use_cxa_atexit since
+ Solaris 11. Update comment.
+ * configure.ac (gcc_cv_ld_pid): Adapt comment for Solaris 12
+ renaming.
+ * config/sol2.h (STARTFILE_SPEC): Likewise.
+ * configure: Regenerate.
+
+2017-11-16 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (x86_print_call_or_nop): Emit 5 byte nop
+ explicitly as a stream of bytes.
+
2017-11-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Backport from mainline
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 49bbb3c7bd9..a384ad6e140 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20171116
+20180115
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 17b72d620ea..aca3c23380f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_field): Do not set the alignment
+ of the enclosing record type if it is not already set.
+
2017-11-10 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (convert) <RECORD_TYPE>: Add comment and do
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 2e57beae2f5..a02dd24b27f 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -6805,7 +6805,8 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
{
const unsigned int type_align = TYPE_ALIGN (gnu_field_type);
- if (TYPE_ALIGN (gnu_record_type) < type_align)
+ if (TYPE_ALIGN (gnu_record_type)
+ && TYPE_ALIGN (gnu_record_type) < type_align)
TYPE_ALIGN (gnu_record_type) = type_align;
/* If the position is not a multiple of the alignment of the type,
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index ee10fbeb25f..1a9c04045a6 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,12 @@
+2017-12-10 Tom de Vries <tom@codesourcery.com>
+
+ backport from trunk:
+ PR c/81875
+ 2017-09-16 Tom de Vries <tom@codesourcery.com>
+
+ * c-parser.c (c_parser_omp_for_loop): Fold only operands of cond, not
+ cond itself.
+
2017-07-04 Release Manager
* GCC 6.4.0 released.
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 4044bb58c87..fc20bad8d99 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -14767,7 +14767,14 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code,
cond = cond_expr.value;
cond = c_objc_common_truthvalue_conversion (cond_loc, cond);
- cond = c_fully_fold (cond, false, NULL);
+ if (COMPARISON_CLASS_P (cond))
+ {
+ tree op0 = TREE_OPERAND (cond, 0), op1 = TREE_OPERAND (cond, 1);
+ op0 = c_fully_fold (op0, false, NULL);
+ op1 = c_fully_fold (op1, false, NULL);
+ TREE_OPERAND (cond, 0) = op0;
+ TREE_OPERAND (cond, 1) = op1;
+ }
switch (cond_expr.original_code)
{
case GT_EXPR:
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 6ff8f26ef39..0c9d9696c63 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1259,7 +1259,6 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
cgraph_edge *e = this;
tree decl = gimple_call_fndecl (e->call_stmt);
- tree lhs = gimple_call_lhs (e->call_stmt);
gcall *new_stmt;
gimple_stmt_iterator gsi;
bool skip_bounds = false;
@@ -1529,6 +1528,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
gimple_call_set_fntype (new_stmt, TREE_TYPE (e->callee->decl));
/* If the call becomes noreturn, remove the LHS if possible. */
+ tree lhs = gimple_call_lhs (new_stmt);
if (lhs
&& (gimple_call_flags (new_stmt) & ECF_NORETURN)
&& (VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (new_stmt)))
diff --git a/gcc/combine.c b/gcc/combine.c
index a989659f288..24f2af12b89 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2947,7 +2947,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
&& is_parallel_of_n_reg_sets (PATTERN (i2), 2)
&& can_split_parallel_of_n_reg_sets (i2, 2)
&& !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 0)), i2, i3)
- && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3))
+ && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3)
+ && !find_reg_note (i2, REG_UNUSED, 0))
{
/* If there is no I1, there is no I0 either. */
i0 = i1;
diff --git a/gcc/config.gcc b/gcc/config.gcc
index f9d7cfb00d3..8d9203ade2d 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -850,8 +850,8 @@ case ${target} in
sol2_tm_file_tail="${cpu_type}/sol2.h sol2.h"
sol2_tm_file="${sol2_tm_file_head} ${sol2_tm_file_tail}"
case ${target} in
- *-*-solaris2.1[2-9]*)
- # __cxa_atexit was introduced in Solaris 12.
+ *-*-solaris2.1[1-9]*)
+ # __cxa_atexit was introduced in Solaris 11.4.
default_use_cxa_atexit=yes
;;
esac
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 0279e9f92a8..307eed3491d 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1706,12 +1706,10 @@ enum arm_auto_incmodes
/* These assume that REGNO is a hard or pseudo reg number.
They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in reginfo.c during register
- allocation. */
+ or a pseudo reg currently allocated to a suitable hard reg. */
#define TEST_REGNO(R, TEST, VALUE) \
- ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE))
+ ((R TEST VALUE) \
+ || (reg_renumber && ((unsigned) reg_renumber[R] TEST VALUE)))
/* Don't allow the pc to be used. */
#define ARM_REGNO_OK_FOR_BASE_P(REGNO) \
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index e6b565db03c..82309a11404 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2676,7 +2676,7 @@ rest_of_handle_insert_vzeroupper (void)
int i;
/* vzeroupper instructions are inserted immediately after reload to
- account for possible spills from 256bit registers. The pass
+ account for possible spills from 256bit or 512bit registers. The pass
reuses mode switching infrastructure by re-running mode insertion
pass, so disable entities that have already been processed. */
for (i = 0; i < MAX_386_ENTITIES; i++)
@@ -3651,7 +3651,7 @@ public:
/* opt_pass methods: */
virtual bool gate (function *)
{
- return TARGET_AVX && !TARGET_AVX512F
+ return TARGET_AVX
&& TARGET_VZEROUPPER && flag_expensive_optimizations
&& !optimize_size;
}
@@ -5471,7 +5471,8 @@ ix86_option_override_internal (bool main_args_p,
#endif
}
- if (!(opts_set->x_target_flags & MASK_VZEROUPPER))
+ if (!(opts_set->x_target_flags & MASK_VZEROUPPER)
+ && TARGET_EMIT_VZEROUPPER)
opts->x_target_flags |= MASK_VZEROUPPER;
if (!(opts_set->x_target_flags & MASK_STV))
opts->x_target_flags |= MASK_STV;
@@ -18026,16 +18027,17 @@ output_387_binary_op (rtx insn, rtx *operands)
return buf;
}
-/* Check if a 256bit AVX register is referenced inside of EXP. */
+/* Check if a 256bit or 512 bit AVX register is referenced inside of EXP. */
static bool
-ix86_check_avx256_register (const_rtx exp)
+ix86_check_avx_upper_register (const_rtx exp)
{
if (SUBREG_P (exp))
exp = SUBREG_REG (exp);
return (REG_P (exp)
- && VALID_AVX256_REG_OR_OI_MODE (GET_MODE (exp)));
+ && (VALID_AVX256_REG_OR_OI_MODE (GET_MODE (exp))
+ || VALID_AVX512F_REG_OR_XI_MODE (GET_MODE (exp))));
}
/* Return needed mode for entity in optimize_mode_switching pass. */
@@ -18048,7 +18050,7 @@ ix86_avx_u128_mode_needed (rtx_insn *insn)
rtx link;
/* Needed mode is set to AVX_U128_CLEAN if there are
- no 256bit modes used in function arguments. */
+ no 256bit or 512bit modes used in function arguments. */
for (link = CALL_INSN_FUNCTION_USAGE (insn);
link;
link = XEXP (link, 1))
@@ -18057,7 +18059,7 @@ ix86_avx_u128_mode_needed (rtx_insn *insn)
{
rtx arg = XEXP (XEXP (link, 0), 0);
- if (ix86_check_avx256_register (arg))
+ if (ix86_check_avx_upper_register (arg))
return AVX_U128_DIRTY;
}
}
@@ -18065,13 +18067,13 @@ ix86_avx_u128_mode_needed (rtx_insn *insn)
return AVX_U128_CLEAN;
}
- /* Require DIRTY mode if a 256bit AVX register is referenced. Hardware
- changes state only when a 256bit register is written to, but we need
- to prevent the compiler from moving optimal insertion point above
- eventual read from 256bit register. */
+ /* Require DIRTY mode if a 256bit or 512bit AVX register is referenced.
+ Hardware changes state only when a 256bit register is written to,
+ but we need to prevent the compiler from moving optimal insertion
+ point above eventual read from 256bit or 512 bit register. */
subrtx_iterator::array_type array;
FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST)
- if (ix86_check_avx256_register (*iter))
+ if (ix86_check_avx_upper_register (*iter))
return AVX_U128_DIRTY;
return AVX_U128_ANY;
@@ -18151,12 +18153,12 @@ ix86_mode_needed (int entity, rtx_insn *insn)
return 0;
}
-/* Check if a 256bit AVX register is referenced in stores. */
+/* Check if a 256bit or 512bit AVX register is referenced in stores. */
static void
-ix86_check_avx256_stores (rtx dest, const_rtx, void *data)
+ix86_check_avx_upper_stores (rtx dest, const_rtx, void *data)
{
- if (ix86_check_avx256_register (dest))
+ if (ix86_check_avx_upper_register (dest))
{
bool *used = (bool *) data;
*used = true;
@@ -18175,18 +18177,18 @@ ix86_avx_u128_mode_after (int mode, rtx_insn *insn)
return AVX_U128_CLEAN;
/* We know that state is clean after CALL insn if there are no
- 256bit registers used in the function return register. */
+ 256bit or 512bit registers used in the function return register. */
if (CALL_P (insn))
{
- bool avx_reg256_found = false;
- note_stores (pat, ix86_check_avx256_stores, &avx_reg256_found);
+ bool avx_upper_reg_found = false;
+ note_stores (pat, ix86_check_avx_upper_stores, &avx_upper_reg_found);
- return avx_reg256_found ? AVX_U128_DIRTY : AVX_U128_CLEAN;
+ return avx_upper_reg_found ? AVX_U128_DIRTY : AVX_U128_CLEAN;
}
/* Otherwise, return current mode. Remember that if insn
- references AVX 256bit registers, the mode was already changed
- to DIRTY from MODE_NEEDED. */
+ references AVX 256bit or 512bit registers, the mode was already
+ changed to DIRTY from MODE_NEEDED. */
return mode;
}
@@ -18215,13 +18217,13 @@ ix86_avx_u128_mode_entry (void)
tree arg;
/* Entry mode is set to AVX_U128_DIRTY if there are
- 256bit modes used in function arguments. */
+ 256bit or 512bit modes used in function arguments. */
for (arg = DECL_ARGUMENTS (current_function_decl); arg;
arg = TREE_CHAIN (arg))
{
rtx incoming = DECL_INCOMING_RTL (arg);
- if (incoming && ix86_check_avx256_register (incoming))
+ if (incoming && ix86_check_avx_upper_register (incoming))
return AVX_U128_DIRTY;
}
@@ -18253,9 +18255,9 @@ ix86_avx_u128_mode_exit (void)
{
rtx reg = crtl->return_rtx;
- /* Exit mode is set to AVX_U128_DIRTY if there are
- 256bit modes used in the function return register. */
- if (reg && ix86_check_avx256_register (reg))
+ /* Exit mode is set to AVX_U128_DIRTY if there are 256bit
+ or 512 bit modes used in the function return register. */
+ if (reg && ix86_check_avx_upper_register (reg))
return AVX_U128_DIRTY;
return AVX_U128_CLEAN;
@@ -45212,7 +45214,8 @@ static void
x86_print_call_or_nop (FILE *file, const char *target)
{
if (flag_nop_mcount)
- fprintf (file, "1:\tnopl 0x00(%%eax,%%eax,1)\n"); /* 5 byte nop. */
+ /* 5 byte nop: nopl 0(%[re]ax,%[re]ax,1) */
+ fprintf (file, "1:" ASM_BYTE "0x0f, 0x1f, 0x44, 0x00, 0x00\n");
else
fprintf (file, "1:\tcall\t%s\n", target);
}
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 365ec4376ed..8113f83c7fd 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -501,6 +501,8 @@ extern unsigned char ix86_tune_features[X86_TUNE_LAST];
ix86_tune_features[X86_TUNE_AVOID_FALSE_DEP_FOR_BMI]
#define TARGET_ONE_IF_CONV_INSN \
ix86_tune_features[X86_TUNE_ONE_IF_CONV_INSN]
+#define TARGET_EMIT_VZEROUPPER \
+ ix86_tune_features[X86_TUNE_EMIT_VZEROUPPER]
/* Feature tests against the various architecture variations. */
enum ix86_arch_indices {
@@ -1124,6 +1126,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
|| (MODE) == V16SImode || (MODE) == V16SFmode || (MODE) == V32HImode \
|| (MODE) == V4TImode)
+#define VALID_AVX512F_REG_OR_XI_MODE(MODE) \
+ (VALID_AVX512F_REG_MODE (MODE) || (MODE) == XImode)
+
#define VALID_AVX512VL_128_REG_MODE(MODE) \
((MODE) == V2DImode || (MODE) == V2DFmode || (MODE) == V16QImode \
|| (MODE) == V4SImode || (MODE) == V4SFmode || (MODE) == V8HImode)
diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def
index 31a87b913b2..9d00abbcac3 100644
--- a/gcc/config/i386/x86-tune.def
+++ b/gcc/config/i386/x86-tune.def
@@ -555,3 +555,7 @@ DEF_TUNE (X86_TUNE_ADJUST_UNROLL, "adjust_unroll_factor", m_BDVER3 | m_BDVER4)
if-converted to one. */
DEF_TUNE (X86_TUNE_ONE_IF_CONV_INSN, "one_if_conv_insn",
m_SILVERMONT | m_KNL | m_INTEL | m_CORE_ALL | m_GENERIC)
+
+/* X86_TUNE_EMIT_VZEROUPPER: This enables vzeroupper instruction insertion
+ before a transfer of control flow out of the function. */
+DEF_TUNE (X86_TUNE_EMIT_VZEROUPPER, "emit_vzeroupper", ~m_KNL)
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index cc4dfcf1ba5..b4f7a7113ff 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -10462,9 +10462,16 @@ pa_legitimate_address_p (machine_mode mode, rtx x, bool strict)
if (!TARGET_DISABLE_INDEXING
&& GET_CODE (index) == MULT
- && MODE_OK_FOR_SCALED_INDEXING_P (mode)
+ /* Only accept base operands with the REG_POINTER flag prior to
+ reload on targets with non-equivalent space registers. */
+ && (TARGET_NO_SPACE_REGS
+ || (base == XEXP (x, 1)
+ && (reload_completed
+ || (reload_in_progress && HARD_REGISTER_P (base))
+ || REG_POINTER (base))))
&& REG_P (XEXP (index, 0))
&& GET_MODE (XEXP (index, 0)) == Pmode
+ && MODE_OK_FOR_SCALED_INDEXING_P (mode)
&& (strict ? STRICT_REG_OK_FOR_INDEX_P (XEXP (index, 0))
: REG_OK_FOR_INDEX_P (XEXP (index, 0)))
&& GET_CODE (XEXP (index, 1)) == CONST_INT
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index e1e619be3bb..30b7375382a 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -2082,7 +2082,7 @@
UNSPEC_VPERMR))]
"TARGET_P9_VECTOR"
"@
- vpermr %0,%2,%1,%3
+ vpermr %0,%1,%2,%3
xxpermr %x0,%x1,%x3"
[(set_attr "type" "vecperm")
(set_attr "length" "4")])
diff --git a/gcc/config/rs6000/ppc-asm.h b/gcc/config/rs6000/ppc-asm.h
index 1234db65f8d..a7eda88c35e 100644
--- a/gcc/config/rs6000/ppc-asm.h
+++ b/gcc/config/rs6000/ppc-asm.h
@@ -120,7 +120,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define f47 47
#define f48 48
#define f49 49
-#define f50 30
+#define f50 50
#define f51 51
#define f52 52
#define f53 53
@@ -222,7 +222,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define vs47 47
#define vs48 48
#define vs49 49
-#define vs50 30
+#define vs50 50
#define vs51 51
#define vs52 52
#define vs53 53
diff --git a/gcc/config/rs6000/ppc-auxv.h b/gcc/config/rs6000/ppc-auxv.h
index c10c336d0b2..81ef00d99d6 100644
--- a/gcc/config/rs6000/ppc-auxv.h
+++ b/gcc/config/rs6000/ppc-auxv.h
@@ -91,6 +91,7 @@
#define PPC_FEATURE2_HAS_IEEE128 0x00400000
#define PPC_FEATURE2_DARN 0x00200000
#define PPC_FEATURE2_SCV 0x00100000
+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
/* Thread Control Block (TCB) offsets of the AT_PLATFORM, AT_HWCAP and
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index ddb2fe9da48..cbd197b9126 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -230,6 +230,7 @@ extern void rs6000_cpu_cpp_builtins (struct cpp_reader *);
#ifdef TREE_CODE
extern bool rs6000_pragma_target_parse (tree, tree);
#endif
+extern void rs6000_activate_target_options (tree new_tree);
extern void rs6000_target_modify_macros (bool, HOST_WIDE_INT, HOST_WIDE_INT);
extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT,
HOST_WIDE_INT);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 32f0af867de..5ac2f832328 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -362,6 +362,7 @@ static const struct
{ "ebb", PPC_FEATURE2_HAS_EBB, 1 },
{ "htm", PPC_FEATURE2_HAS_HTM, 1 },
{ "htm-nosc", PPC_FEATURE2_HTM_NOSC, 1 },
+ { "htm-no-suspend", PPC_FEATURE2_HTM_NO_SUSPEND, 1 },
{ "isel", PPC_FEATURE2_HAS_ISEL, 1 },
{ "tar", PPC_FEATURE2_HAS_TAR, 1 },
{ "vcrypto", PPC_FEATURE2_HAS_VEC_CRYPTO, 1 },
@@ -3805,13 +3806,8 @@ static bool
rs6000_option_override_internal (bool global_init_p)
{
bool ret = true;
- bool have_cpu = false;
-
- /* The default cpu requested at configure time, if any. */
- const char *implicit_cpu = OPTION_TARGET_CPU_DEFAULT;
-
HOST_WIDE_INT set_masks;
- int cpu_index;
+ int cpu_index = -1;
int tune_index;
struct cl_target_option *main_target_opt
= ((global_init_p || target_option_default_node == NULL)
@@ -3888,42 +3884,20 @@ rs6000_option_override_internal (bool global_init_p)
with -mtune on the command line. Process a '--with-cpu' configuration
request as an implicit --cpu. */
if (rs6000_cpu_index >= 0)
- {
- cpu_index = rs6000_cpu_index;
- have_cpu = true;
- }
+ cpu_index = rs6000_cpu_index;
else if (main_target_opt != NULL && main_target_opt->x_rs6000_cpu_index >= 0)
- {
- rs6000_cpu_index = cpu_index = main_target_opt->x_rs6000_cpu_index;
- have_cpu = true;
- }
- else if (implicit_cpu)
- {
- rs6000_cpu_index = cpu_index = rs6000_cpu_name_lookup (implicit_cpu);
- have_cpu = true;
- }
- else
- {
- /* PowerPC 64-bit LE requires at least ISA 2.07. */
- const char *default_cpu = ((!TARGET_POWERPC64)
- ? "powerpc"
- : ((BYTES_BIG_ENDIAN)
- ? "powerpc64"
- : "powerpc64le"));
-
- rs6000_cpu_index = cpu_index = rs6000_cpu_name_lookup (default_cpu);
- have_cpu = false;
- }
-
- gcc_assert (cpu_index >= 0);
+ cpu_index = main_target_opt->x_rs6000_cpu_index;
+ else if (OPTION_TARGET_CPU_DEFAULT)
+ cpu_index = rs6000_cpu_name_lookup (OPTION_TARGET_CPU_DEFAULT);
/* If we have a cpu, either through an explicit -mcpu=<xxx> or if the
compiler was configured with --with-cpu=<xxx>, replace all of the ISA bits
with those from the cpu, except for options that were explicitly set. If
we don't have a cpu, do not override the target bits set in
TARGET_DEFAULT. */
- if (have_cpu)
+ if (cpu_index >= 0)
{
+ rs6000_cpu_index = cpu_index;
rs6000_isa_flags &= ~set_masks;
rs6000_isa_flags |= (processor_target_table[cpu_index].target_enable
& set_masks);
@@ -3937,14 +3911,26 @@ rs6000_option_override_internal (bool global_init_p)
If there is a TARGET_DEFAULT, use that. Otherwise fall back to using
-mcpu=powerpc, -mcpu=powerpc64, or -mcpu=powerpc64le defaults. */
- HOST_WIDE_INT flags = ((TARGET_DEFAULT) ? TARGET_DEFAULT
- : processor_target_table[cpu_index].target_enable);
+ HOST_WIDE_INT flags;
+ if (TARGET_DEFAULT)
+ flags = TARGET_DEFAULT;
+ else
+ {
+ /* PowerPC 64-bit LE requires at least ISA 2.07. */
+ const char *default_cpu = (!TARGET_POWERPC64
+ ? "powerpc"
+ : (BYTES_BIG_ENDIAN
+ ? "powerpc64"
+ : "powerpc64le"));
+ int default_cpu_index = rs6000_cpu_name_lookup (default_cpu);
+ flags = processor_target_table[default_cpu_index].target_enable;
+ }
rs6000_isa_flags |= (flags & ~rs6000_isa_flags_explicit);
}
if (rs6000_tune_index >= 0)
tune_index = rs6000_tune_index;
- else if (have_cpu)
+ else if (cpu_index >= 0)
rs6000_tune_index = tune_index = cpu_index;
else
{
@@ -3956,7 +3942,7 @@ rs6000_option_override_internal (bool global_init_p)
for (i = 0; i < ARRAY_SIZE (processor_target_table); i++)
if (processor_target_table[i].processor == tune_proc)
{
- rs6000_tune_index = tune_index = i;
+ tune_index = i;
break;
}
}
@@ -4744,7 +4730,7 @@ rs6000_option_override_internal (bool global_init_p)
default:
- if (have_cpu && !(rs6000_isa_flags_explicit & OPTION_MASK_ISEL))
+ if (cpu_index >= 0 && !(rs6000_isa_flags_explicit & OPTION_MASK_ISEL))
rs6000_isa_flags &= ~OPTION_MASK_ISEL;
break;
@@ -7079,7 +7065,7 @@ rs6000_expand_vector_set (rtx target, rtx val, int elt)
{
if (TARGET_P9_VECTOR)
x = gen_rtx_UNSPEC (mode,
- gen_rtvec (3, target, reg,
+ gen_rtvec (3, reg, target,
force_reg (V16QImode, x)),
UNSPEC_VPERMR);
else
@@ -34384,14 +34370,16 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
*total = COSTS_N_INSNS (1);
return true;
}
+ /* FALLTHRU */
+
+ case GT:
+ case LT:
+ case UNORDERED:
if (outer_code == SET)
{
if (XEXP (x, 1) == const0_rtx)
{
- if (TARGET_ISEL && !TARGET_MFCRF)
- *total = COSTS_N_INSNS (8);
- else
- *total = COSTS_N_INSNS (2);
+ *total = COSTS_N_INSNS (2);
return true;
}
else
@@ -34400,19 +34388,6 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
return false;
}
}
- /* FALLTHRU */
-
- case GT:
- case LT:
- case UNORDERED:
- if (outer_code == SET && (XEXP (x, 1) == const0_rtx))
- {
- if (TARGET_ISEL && !TARGET_MFCRF)
- *total = COSTS_N_INSNS (8);
- else
- *total = COSTS_N_INSNS (2);
- return true;
- }
/* CC COMPARE. */
if (outer_code == COMPARE)
{
@@ -35071,7 +35046,7 @@ altivec_expand_vec_perm_le (rtx operands[4])
if (TARGET_P9_VECTOR)
{
- unspec = gen_rtx_UNSPEC (mode, gen_rtvec (3, op0, op1, sel),
+ unspec = gen_rtx_UNSPEC (mode, gen_rtvec (3, op1, op0, sel),
UNSPEC_VPERMR);
}
else
@@ -36394,9 +36369,9 @@ rs6000_valid_attribute_p (tree fndecl,
{
struct cl_target_option cur_target;
bool ret;
- tree old_optimize = build_optimization_node (&global_options);
+ tree old_optimize;
tree new_target, new_optimize;
- tree func_optimize = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl);
+ tree func_optimize;
gcc_assert ((fndecl != NULL_TREE) && (args != NULL_TREE));
@@ -36523,6 +36498,7 @@ rs6000_pragma_target_parse (tree args, tree pop_target)
}
target_option_current_node = cur_tree;
+ rs6000_activate_target_options (target_option_current_node);
/* If we have the preprocessor linked in (i.e. C or C++ languages), possibly
change the macros that are defined. */
@@ -36563,7 +36539,7 @@ static GTY(()) tree rs6000_previous_fndecl;
/* Restore target's globals from NEW_TREE and invalidate the
rs6000_previous_fndecl cache. */
-static void
+void
rs6000_activate_target_options (tree new_tree)
{
cl_target_option_restore (&global_options, TREE_TARGET_OPTION (new_tree));
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index 78764c4e556..f7c77727566 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -185,8 +185,8 @@ along with GCC; see the file COPYING3. If not see
/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. */
#undef STARTFILE_SPEC
#ifdef HAVE_SOLARIS_CRTS
-/* Since Solaris 11.x and Solaris 12, the OS delivers crt1.o, crti.o, and
- crtn.o, with a hook for compiler-dependent stuff like profile handling. */
+/* Since Solaris 11.4, the OS delivers crt1.o, crti.o, and crtn.o, with a hook
+ for compiler-dependent stuff like profile handling. */
#define STARTFILE_SPEC "%{!shared:%{!symbolic: \
crt1.o%s \
%{p:%e-p is not supported; \
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 28ce717cf80..48813f8a52c 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -970,7 +970,8 @@ sparc_do_work_around_errata (void)
&& NONJUMP_INSN_P (insn)
&& (set = single_set (insn)) != NULL_RTX
&& GET_MODE_SIZE (GET_MODE (SET_SRC (set))) <= 4
- && mem_ref (SET_SRC (set)) != NULL_RTX
+ && (mem_ref (SET_SRC (set)) != NULL_RTX
+ || INSN_CODE (insn) == CODE_FOR_movsi_pic_gotdata_op)
&& REG_P (SET_DEST (set))
&& REGNO (SET_DEST (set)) < 32)
{
@@ -1008,6 +1009,11 @@ sparc_do_work_around_errata (void)
&& REGNO (src) != REGNO (x)))
&& !reg_mentioned_p (x, XEXP (dest, 0)))
insert_nop = true;
+
+ /* GOT accesses uses LD. */
+ else if (INSN_CODE (next) == CODE_FOR_movsi_pic_gotdata_op
+ && !reg_mentioned_p (x, XEXP (XEXP (src, 0), 1)))
+ insert_nop = true;
}
}
diff --git a/gcc/configure b/gcc/configure
index 92ae7908c7b..00a2dc05792 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -27889,7 +27889,7 @@ elif test x$gcc_cv_ld != x; then
else
case "$target" in
*-*-solaris2.1[1-9]*)
- # Solaris 11.x and Solaris 12 added PIE support.
+ # Solaris 11.3 added PIE support.
if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
gcc_cv_ld_pie=yes
fi
diff --git a/gcc/configure.ac b/gcc/configure.ac
index cc2031b0aac..8025e912432 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4932,7 +4932,7 @@ elif test x$gcc_cv_ld != x; then
else
case "$target" in
*-*-solaris2.1[[1-9]]*)
- # Solaris 11.x and Solaris 12 added PIE support.
+ # Solaris 11.3 added PIE support.
if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
gcc_cv_ld_pie=yes
fi
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f278002b90a..ccad53b1b86 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,42 @@
+2018-01-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/78814
+ * interface.c (symbol_rank): Check for NULL pointer.
+
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/82367
+ * resolve.c (resolve_allocate_expr): Check for NULL pointer.
+
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/83093
+ * resolve.c (resolve_charlen): Check the type of cl->length
+ after resolution.
+
+2018-01-10 Steven G. Kargl <kargl@kgcc.gnu.org>
+
+ Backport r254555 from trunk
+ PR Fortran/82841
+ * simplify.c(gfc_simplify_transfer): Do not dereference a NULL pointer.
+ Unwrap a short line.
+
+2018-01-04 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR Fortran/83679
+ * simplify.c (gfc_simplify_cshift): Restore early return for zero-sized
+ array. Update Copyright year while here.
+
+2018-01-02 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backport from 7-branch
+ PR fortran/83650
+ * simplify.c (gfc_simplify_cshift): Correct contition for
+ negative shifts.
+
2017-11-13 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 6b2cf103011..6dac80195bd 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1,5 +1,5 @@
/* Deal with interfaces.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2016,2018 Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of GCC.
@@ -1165,8 +1165,13 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
static int
symbol_rank (gfc_symbol *sym)
{
- gfc_array_spec *as;
- as = (sym->ts.type == BT_CLASS) ? CLASS_DATA (sym)->as : sym->as;
+ gfc_array_spec *as = NULL;
+
+ if (sym->ts.type == BT_CLASS && CLASS_DATA (sym) && CLASS_DATA (sym)->as)
+ as = CLASS_DATA (sym)->as;
+ else
+ as = sym->as;
+
return as ? as->rank : 0;
}
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 9b83779605a..ef938009f75 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -7136,8 +7136,13 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code, bool *array_alloc_wo_spec)
if (code->ext.alloc.ts.type == BT_CHARACTER && !e->ts.deferred
&& !UNLIMITED_POLY (e))
{
- int cmp = gfc_dep_compare_expr (e->ts.u.cl->length,
- code->ext.alloc.ts.u.cl->length);
+ int cmp;
+
+ if (!e->ts.u.cl->length)
+ goto failure;
+
+ cmp = gfc_dep_compare_expr (e->ts.u.cl->length,
+ code->ext.alloc.ts.u.cl->length);
if (cmp == 1 || cmp == -1 || cmp == -3)
{
gfc_error ("Allocating %s at %L with type-spec requires the same "
@@ -11077,10 +11082,17 @@ resolve_charlen (gfc_charlen *cl)
specification_expr = saved_specification_expr;
return false;
}
+
+ /* cl->length has been resolved. It should have an integer type. */
+ if (cl->length && cl->length->ts.type != BT_INTEGER)
+ {
+ gfc_error ("Scalar INTEGER expression expected at %L",
+ &cl->length->where);
+ return false;
+ }
}
else
{
-
if (!resolve_index_expr (cl->length))
{
specification_expr = saved_specification_expr;
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 37c04e9bf27..75fedc0f598 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -1,5 +1,5 @@
/* Simplify intrinsic functions at compile-time.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2016, 2018 Free Software Foundation, Inc.
Contributed by Andy Vaught & Katherine Holcomb
This file is part of GCC.
@@ -1838,11 +1838,17 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim)
sz = mpz_get_si (size);
mpz_clear (size);
+ /* Special case: Zero-sized array. */
+ if (sz == 0)
+ return a;
+
/* Adjust shft to deal with right or left shifts. */
- shft = shft < 0 ? 1 - shft : shft;
+ shft = shft % sz;
+ if (shft < 0)
+ shft += sz;
/* Special case: Shift to the original order! */
- if (sz == 0 || shft % sz == 0)
+ if (shft % sz == 0)
return a;
result = gfc_copy_expr (a);
@@ -6355,8 +6361,7 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
return NULL;
/* Calculate the size of the source. */
- if (source->expr_type == EXPR_ARRAY
- && !gfc_array_size (source, &tmp))
+ if (source->expr_type == EXPR_ARRAY && !gfc_array_size (source, &tmp))
gfc_internal_error ("Failure getting length of a constant array.");
/* Create an empty new expression with the appropriate characteristics. */
@@ -6364,7 +6369,7 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
&source->where);
result->ts = mold->ts;
- mold_element = mold->expr_type == EXPR_ARRAY
+ mold_element = (mold->expr_type == EXPR_ARRAY && mold->value.constructor)
? gfc_constructor_first (mold->value.constructor)->expr
: mold;
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 2b42b6e4f39..54bda10762d 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -91,11 +91,6 @@ along with GCC; see the file COPYING3. If not see
4: Object marks as well. */
#define GGC_DEBUG_LEVEL (0)
-#ifndef HOST_BITS_PER_PTR
-#define HOST_BITS_PER_PTR HOST_BITS_PER_LONG
-#endif
-
-
/* A two-level tree is used to look up the page-entry for a given
pointer. Two chunks of the pointer's bits are extracted to index
the first and second levels of the tree, as follows:
diff --git a/gcc/hwint.h b/gcc/hwint.h
index 14740ccc939..4dd255d486c 100644
--- a/gcc/hwint.h
+++ b/gcc/hwint.h
@@ -14,6 +14,7 @@
#define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT)
#define HOST_BITS_PER_INT (CHAR_BIT * SIZEOF_INT)
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
+#define HOST_BITS_PER_PTR (CHAR_BIT * SIZEOF_VOID_P)
/* The string that should be inserted into a printf style format to
indicate a "long" operand. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index df7913a0ae4..48b2a18f813 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,107 @@
+2018-01-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/83677
+ * gcc.target/powerpc/pr83677.c: New file.
+
+2018-01-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/78814
+ * gfortran.dg/interface_40.f90: New testcase.
+
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/82367
+ * gfortran.dg/deferred_character_18.f90: New test.
+
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/83093
+ * gfortran.dg/allocate_with_typespec_7.f90: New test.
+
+2018-01-10 Steven G. Kargl <kargl@kgcc.gnu.org>
+
+ Backport r254555 from trunk
+ PR Fortran/82841
+ * gfortran.dg/transfer_simplify_11.f90: New test.
+
+2018-01-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2017-12-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82975
+ * gcc.dg/pr82975.c: New test.
+
+2018-01-02 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backport from 7-branch
+ PR fortran/83650
+ * gfortran.dg/simplify_cshift_1.f90: Correct condition.
+
+2017-12-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-12-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ * gcc.target/powerpc/cpu-builtin-1.c (htm-no-suspend): Add test.
+
+2017-12-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-10-02 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/80210
+ * gcc.target/powerpc/pr80210-2.c: New test.
+
+2017-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/alignment13.adb: New test.
+
+2017-12-11 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR c++/83301
+
+ Backport trunk r243377:
+ 2016-12-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/78692
+ * g++.dg/torture/pr78692.C: New test.
+
+2017-12-04 Sebastian Peryt <sebastian.peryt@intel.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from trunk
+ PR target/82941
+ PR target/82942
+ PR target/82990
+ * gcc.target/i386/pr82941-1.c: New test.
+ * gcc.target/i386/pr82941-2.c: Likewise.
+ * gcc.target/i386/pr82942-1.c: Likewise.
+ * gcc.target/i386/pr82942-2.c: Likewise.
+ * gcc.target/i386/pr82990-1.c: Likewise.
+ * gcc.target/i386/pr82990-2.c: Likewise.
+ * gcc.target/i386/pr82990-3.c: Likewise.
+ * gcc.target/i386/pr82990-4.c: Likewise.
+ * gcc.target/i386/pr82990-5.c: Likewise.
+ * gcc.target/i386/pr82990-6.c: Likewise.
+ * gcc.target/i386/pr82990-7.c: Likewise.
+
+2017-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2017-11-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * lib/target-supports.exp (check_effective_target_pie): Adapt
+ comment for Solaris 12 renaming.
+
+ * gcc.dg/torture/pr60092.c: Remove *-*-solaris2.11* dg-xfail-run-if.
+
2017-11-13 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
diff --git a/gcc/testsuite/g++.dg/torture/pr78692.C b/gcc/testsuite/g++.dg/torture/pr78692.C
new file mode 100644
index 00000000000..57a0d2fcb0a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr78692.C
@@ -0,0 +1,26 @@
+// PR c++/78692
+
+int a;
+void *b;
+extern "C" {
+struct C {
+ virtual int d ();
+};
+struct E {
+ virtual int operator () (int, const void *, int) = 0;
+};
+class F {
+ int g ();
+ int h;
+ E &i;
+};
+struct : C, E {
+ int operator () (int, const void *, int) { throw int(); }
+} j;
+
+int
+F::g ()
+{
+ a = i (h, b, 0);
+}
+}
diff --git a/gcc/testsuite/gcc.dg/pr82975.c b/gcc/testsuite/gcc.dg/pr82975.c
new file mode 100644
index 00000000000..422ba6c6855
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82975.c
@@ -0,0 +1,20 @@
+/* PR target/82975. */
+/* { dg-do compile } */
+/* { dg-options "-fno-sched-pressure -O2" } */
+/* { dg-additional-options "-mtune=cortex-a57" { target arm*-*-* aarch64*-*-* } } */
+
+typedef __SIZE_TYPE__ size_t;
+
+struct S1
+{
+ char pad1;
+ char val;
+ short pad2;
+};
+
+extern char t[256];
+
+void foo (struct S1 a, size_t i)
+{
+ t[i] = a.val;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr60092.c b/gcc/testsuite/gcc.dg/torture/pr60092.c
index d66e3f2444e..7c6cabb509a 100644
--- a/gcc/testsuite/gcc.dg/torture/pr60092.c
+++ b/gcc/testsuite/gcc.dg/torture/pr60092.c
@@ -4,7 +4,6 @@
/* { dg-skip-if "No undefined weak" { nvptx-*-* } { "*" } { "" } } */
/* { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } } */
/* { dg-additional-options "-Wl,-flat_namespace" { target *-*-darwin[89]* } } */
-/* { dg-xfail-run-if "posix_memalign modifies first arg on error" { *-*-solaris2.11* } { "-O0" } } */
typedef __SIZE_TYPE__ size_t;
extern int posix_memalign(void **memptr, size_t alignment, size_t size) __attribute__((weak));
diff --git a/gcc/testsuite/gcc.target/i386/pr82941-1.c b/gcc/testsuite/gcc.target/i386/pr82941-1.c
new file mode 100644
index 00000000000..d7e530d5116
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82941-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512" } */
+
+#include <immintrin.h>
+
+extern __m512d y, z;
+
+void
+pr82941 ()
+{
+ z = y;
+}
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82941-2.c b/gcc/testsuite/gcc.target/i386/pr82941-2.c
new file mode 100644
index 00000000000..db2f8589ab6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82941-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=knl" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82942-1.c b/gcc/testsuite/gcc.target/i386/pr82942-1.c
new file mode 100644
index 00000000000..9cdf81a9d60
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82942-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mno-avx512er -O2" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82942-2.c b/gcc/testsuite/gcc.target/i386/pr82942-2.c
new file mode 100644
index 00000000000..ddb4e689659
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82942-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mavx512er -mtune=knl -O2" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-1.c b/gcc/testsuite/gcc.target/i386/pr82990-1.c
new file mode 100644
index 00000000000..ff1d6d40eb2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=knl -mvzeroupper" } */
+
+#include <immintrin.h>
+
+extern __m512d y, z;
+
+void
+pr82941 ()
+{
+ z = y;
+}
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-2.c b/gcc/testsuite/gcc.target/i386/pr82990-2.c
new file mode 100644
index 00000000000..0d3cb2333dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -mno-vzeroupper" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-3.c b/gcc/testsuite/gcc.target/i386/pr82990-3.c
new file mode 100644
index 00000000000..201fa98d8d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-3.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mavx512er -mvzeroupper -O2" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-4.c b/gcc/testsuite/gcc.target/i386/pr82990-4.c
new file mode 100644
index 00000000000..09f161c7291
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-4.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mno-avx512er -mno-vzeroupper -O2" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-5.c b/gcc/testsuite/gcc.target/i386/pr82990-5.c
new file mode 100644
index 00000000000..9932bdc5375
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-5.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mtune=generic" } */
+
+#include <immintrin.h>
+
+extern __m512d y, z;
+
+void
+pr82941 ()
+{
+ z = y;
+}
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-6.c b/gcc/testsuite/gcc.target/i386/pr82990-6.c
new file mode 100644
index 00000000000..063a61c111d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-6.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -mtune=knl" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-7.c b/gcc/testsuite/gcc.target/i386/pr82990-7.c
new file mode 100644
index 00000000000..dedde8b854b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-7.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -mtune=generic -mtune-ctrl=^emit_vzeroupper" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
index 8a1f7c86013..928131b52ce 100644
--- a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
@@ -73,6 +73,7 @@ use_cpu_supports_builtins (unsigned int *p)
p[37] = __builtin_cpu_supports ("vsx");
p[38] = __builtin_cpu_supports ("darn");
p[39] = __builtin_cpu_supports ("scv");
+ p[40] = __builtin_cpu_supports ("htm-no-suspend");
#else
p[0] = 0;
#endif
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80210-2.c b/gcc/testsuite/gcc.target/powerpc/pr80210-2.c
new file mode 100644
index 00000000000..455f7d6e31f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr80210-2.c
@@ -0,0 +1,11 @@
+/* Test for ICE arising from GCC target pragma. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#pragma GCC target "no-powerpc-gpopt"
+double
+foo (double a)
+{
+ return __builtin_sqrt (a);
+}
+/* { dg-final { scan-assembler-not "fsqrt" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr83677.c b/gcc/testsuite/gcc.target/powerpc/pr83677.c
new file mode 100644
index 00000000000..a1a760df811
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr83677.c
@@ -0,0 +1,166 @@
+/* { dg-do run { target { powerpc*-*-* && { lp64 && p9vector_hw } } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-options "-mcpu=power9 -O2 " } */
+
+/* PR83677: This test case used to fail due to mis-generation of the
+ xxpermr instruction. It requires inlining to create enough register
+ pressure that we generate xxpermr rather than vpermr. */
+
+#include <altivec.h>
+
+void v_expand_u8(vector unsigned char* a, vector unsigned short* b0, vector unsigned short* b1)
+{
+ *b0 = (vector unsigned short)vec_mergeh(*a, vec_splats((unsigned char)0));
+ *b1 = (vector unsigned short)vec_mergel(*a, vec_splats((unsigned char)0));
+}
+
+void v_expand_u16(vector unsigned short* a, vector unsigned int* b0, vector unsigned int* b1)
+{
+ *b0 = (vector unsigned int)vec_mergeh(*a, vec_splats((unsigned short)0));
+ *b1 = (vector unsigned int)vec_mergel(*a, vec_splats((unsigned short)0));
+}
+
+void v_load_deinterleave_u8(unsigned char *ptr, vector unsigned char* a, vector unsigned char* b, vector unsigned char* c)
+{
+ vector unsigned char v1 = vec_xl( 0, ptr);
+ vector unsigned char v2 = vec_xl(16, ptr);
+ vector unsigned char v3 = vec_xl(32, ptr);
+
+ static const vector unsigned char a12_perm = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 0, 0, 0, 0, 0};
+ static const vector unsigned char a123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 17, 20, 23, 26, 29};
+ *a = vec_perm(vec_perm(v1, v2, a12_perm), v3, a123_perm);
+
+ static const vector unsigned char b12_perm = {1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 0, 0, 0, 0, 0};
+ static const vector unsigned char b123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 18, 21, 24, 27, 30};
+ *b = vec_perm(vec_perm(v1, v2, b12_perm), v3, b123_perm);
+
+ static const vector unsigned char c12_perm = {2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 0, 0, 0, 0, 0, 0};
+ static const vector unsigned char c123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 19, 22, 25, 28, 31};
+ *c = vec_perm(vec_perm(v1, v2, c12_perm), v3, c123_perm);
+}
+
+void v_load_deinterleave_f32(float *ptr, vector float* a, vector float* b, vector float* c)
+{
+ vector float v1 = vec_xl( 0, ptr);
+ vector float v2 = vec_xl(16, ptr);
+ vector float v3 = vec_xl(32, ptr);
+
+ static const vector unsigned char flp = {0, 1, 2, 3, 12, 13, 14, 15, 16, 17, 18, 19, 28, 29, 30, 31};
+ *a = vec_perm(v1, vec_sld(v3, v2, 8), flp);
+
+ static const vector unsigned char flp2 = {28, 29, 30, 31, 0, 1, 2, 3, 12, 13, 14, 15, 16, 17, 18, 19};
+ *b = vec_perm(v2, vec_sld(v1, v3, 8), flp2);
+
+ *c = vec_perm(vec_sld(v2, v1, 8), v3, flp);
+}
+
+void v_store_interleave_f32(float *ptr, vector float a, vector float b, vector float c)
+{
+ vector float hbc = vec_mergeh(b, c);
+
+ static const vector unsigned char ahbc = {0, 1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 4, 5, 6, 7};
+ vec_xst(vec_perm(a, hbc, ahbc), 0, ptr);
+
+ vector float lab = vec_mergel(a, b);
+ vec_xst(vec_sld(lab, hbc, 8), 16, ptr);
+
+ static const vector unsigned char clab = {8, 9, 10, 11, 24, 25, 26, 27, 28, 29, 30, 31, 12, 13, 14, 15};
+ vec_xst(vec_perm(c, lab, clab), 32, ptr);
+}
+
+vector float v_cvt_f32(vector unsigned int a)
+{
+ return (vector float)vec_ctf(a, 0);
+}
+
+void acc_simd_(const unsigned char* src, float* dst, const unsigned char* mask, int len)
+{
+ int x = 0;
+ const int cVectorWidth = 16;
+
+ for ( ; x <= len - cVectorWidth; x += cVectorWidth)
+ {
+ vector unsigned char v_mask = vec_xl(0, mask + x);
+ v_mask = (vector unsigned char)vec_cmpeq(vec_splats((unsigned char)0), v_mask);
+ v_mask = (vector unsigned char)vec_nor(v_mask, v_mask);
+ vector unsigned char v_src0, v_src1, v_src2;
+ v_load_deinterleave_u8((unsigned char *)(src + (x * 3)), &v_src0, &v_src1, &v_src2);
+ v_src0 = v_src0 & v_mask;
+ v_src1 = v_src1 & v_mask;
+ v_src2 = v_src2 & v_mask;
+
+ /* expand 16 uchar to 4 vectors which contains 4 uint */
+ vector unsigned short v_src00, v_src01, v_src10, v_src11, v_src20, v_src21;
+ v_expand_u8(&v_src0, &v_src00, &v_src01);
+ v_expand_u8(&v_src1, &v_src10, &v_src11);
+ v_expand_u8(&v_src2, &v_src20, &v_src21);
+ vector unsigned int v_src000, v_src001, v_src010, v_src011;
+ vector unsigned int v_src100, v_src101, v_src110, v_src111;
+ vector unsigned int v_src200, v_src201, v_src210, v_src211;
+ v_expand_u16(&v_src00, &v_src000, &v_src001);
+ v_expand_u16(&v_src01, &v_src010, &v_src011);
+ v_expand_u16(&v_src10, &v_src100, &v_src101);
+ v_expand_u16(&v_src11, &v_src110, &v_src111);
+ v_expand_u16(&v_src20, &v_src200, &v_src201);
+ v_expand_u16(&v_src21, &v_src210, &v_src211);
+
+ vector float v_dst000, v_dst001, v_dst010, v_dst011;
+ vector float v_dst100, v_dst101, v_dst110, v_dst111;
+ vector float v_dst200, v_dst201, v_dst210, v_dst211;
+ v_load_deinterleave_f32(dst + (x * 3), &v_dst000, &v_dst100, &v_dst200);
+ v_load_deinterleave_f32(dst + ((x + 4) * 3), &v_dst001, &v_dst101, &v_dst201);
+ v_load_deinterleave_f32(dst + ((x + 8) * 3), &v_dst010, &v_dst110, &v_dst210);
+ v_load_deinterleave_f32(dst + ((x + 12) * 3), &v_dst011, &v_dst111, &v_dst211);
+
+ v_store_interleave_f32(dst + (x * 3), vec_add(v_dst000, v_cvt_f32(v_src000)), vec_add(v_dst100, v_cvt_f32(v_src100)), vec_add(v_dst200, v_cvt_f32(v_src200)));
+ v_store_interleave_f32(dst + ((x + 4) * 3), vec_add(v_dst001, v_cvt_f32(v_src001)), vec_add(v_dst101, v_cvt_f32(v_src101)), vec_add(v_dst201, v_cvt_f32(v_src201)));
+ v_store_interleave_f32(dst + ((x + 8) * 3), vec_add(v_dst010, v_cvt_f32(v_src010)), vec_add(v_dst110, v_cvt_f32(v_src110)), vec_add(v_dst210, v_cvt_f32(v_src210)));
+ v_store_interleave_f32(dst + ((x + 12) * 3), vec_add(v_dst011, v_cvt_f32(v_src011)), vec_add(v_dst111, v_cvt_f32(v_src111)), vec_add(v_dst211, v_cvt_f32(v_src211)));
+ }
+ return;
+}
+
+void acc_(const unsigned char* src, float* dst, const unsigned char* mask, int len)
+{
+ int x = 0;
+ src += (x * 3);
+ dst += (x * 3);
+ for( ; x < len; x++, src += 3, dst += 3 )
+ {
+ if( mask[x] ) /* if mask, R/G/B dst[] += src[] */
+ {
+ for( int k = 0; k < 3; k++ )
+ {
+ dst[k] += src[k];
+ }
+ }
+ }
+ return;
+}
+
+#define N 16
+
+int main(int argc, char *argv[])
+{
+ unsigned char __attribute__ ((aligned (16) )) mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1};
+ unsigned char __attribute__ ((aligned (16) )) src[3*N];
+ float __attribute__ ((aligned (16) )) dst[3*N];
+ float __attribute__ ((aligned (16) )) exp[3*N];
+
+ int i;
+
+ /* initialize src and dst */
+ for (i=0; i<3*N; i++) src[i] = (unsigned char)(i*3);
+ for (i=0; i<3*N; i++) {dst[i] = i * 1.0f; exp[i] = dst[i];}
+
+ acc_(src, exp, mask, N);
+ acc_simd_(src, dst, mask, N);
+
+ for (i=0; i<N; i++)
+ {
+ if ((dst[3*i] != exp[3*i]) || (dst[3*i+1] != exp[3*i+1]) || (dst[3*i+2] != exp[3*i+2]))
+ __builtin_abort ();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_7.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_7.f90
new file mode 100644
index 00000000000..feb6c8c16cf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_7.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! PR Fortran/83093
+! Contributed by Gerhard Steinmetz <gscfq at t-online dot de>
+program p
+ integer, parameter :: n(2) = [1,2]
+ real :: x = 2
+ character(:), allocatable :: z, zz, zzz
+ character(:), allocatable :: y, yy
+ allocate (character(a) :: z) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(x) :: zz) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character((1.0)) :: z) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(y) :: y) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(n(1:2)) :: y)! { dg-error "Scalar INTEGER expression" }
+end
diff --git a/gcc/testsuite/gfortran.dg/deferred_character_18.f90 b/gcc/testsuite/gfortran.dg/deferred_character_18.f90
new file mode 100644
index 00000000000..1b1457fa293
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/deferred_character_18.f90
@@ -0,0 +1,29 @@
+! { dg-do compile }
+! PR Fortran/82367
+! Contributed by Walter Spector <w6ws at earthlink dot net>
+module cls_allocmod
+ implicit none
+
+contains
+
+ subroutine cls_alloc (n, str)
+ integer, intent(in) :: n
+ character(*), allocatable, intent(out) :: str
+! Note: Star ^ should have been a colon (:)
+
+ allocate (character(n)::str)
+
+ end subroutine
+
+end module
+
+program cls
+ use cls_allocmod
+ implicit none
+
+ character(:), allocatable :: s
+
+ call cls_alloc(42, s) ! { dg-error "allocatable or pointer dummy argument" }
+ print *, 'string len =', len(s)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/interface_40.f90 b/gcc/testsuite/gfortran.dg/interface_40.f90
new file mode 100644
index 00000000000..085c6b30f39
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_40.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/78814
+! Code contributed by Gerhard Steinmetz
+program p
+ class(*) :: x ! { dg-error " must be dummy, allocatable or pointer" }
+ print *, f(x)
+end
+
diff --git a/gcc/testsuite/gfortran.dg/simplify_cshift_1.f90 b/gcc/testsuite/gfortran.dg/simplify_cshift_1.f90
index dbe67f4c8e9..3eb5adb49c8 100644
--- a/gcc/testsuite/gfortran.dg/simplify_cshift_1.f90
+++ b/gcc/testsuite/gfortran.dg/simplify_cshift_1.f90
@@ -23,12 +23,12 @@ program foo
v = cshift(c, 2)
if (any(b /= v)) call abort
- ! Special cases shift = 0, size(a), 1-size(a)
+ ! Special cases shift = 0, size(a), size(a)
b = cshift([1, 2, 3, 4, 5], 0)
if (any(b /= a)) call abort
b = cshift([1, 2, 3, 4, 5], size(a))
if (any(b /= a)) call abort
- b = cshift([1, 2, 3, 4, 5], 1-size(a))
+ b = cshift([1, 2, 3, 4, 5], -size(a))
if (any(b /= a)) call abort
! simplification of array arg.
diff --git a/gcc/testsuite/gfortran.dg/transfer_simplify_11.f90 b/gcc/testsuite/gfortran.dg/transfer_simplify_11.f90
new file mode 100644
index 00000000000..ce7a4ad5e56
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/transfer_simplify_11.f90
@@ -0,0 +1,8 @@
+! { dg-do run }
+! PR Fortran/82841
+!
+ integer, parameter :: N = 2
+ character(len=1) :: chr(N)
+ chr = transfer(repeat("x",ncopies=N),[character(len=1) ::], N)
+ if (chr(1) /= 'x' .and. chr(2) /= 'x') call abort
+end
diff --git a/gcc/testsuite/gnat.dg/alignment13.adb b/gcc/testsuite/gnat.dg/alignment13.adb
new file mode 100644
index 00000000000..dd0b25425f0
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/alignment13.adb
@@ -0,0 +1,21 @@
+-- { dg-do run }
+-- { dg-options "-gnatws" }
+
+procedure Alignment13 is
+
+ type Rec is record
+ I1 : aliased Short_Integer;
+ I2 : Integer;
+ end record;
+
+ for Rec use record
+ I1 at 0 range 0 .. 15;
+ end record;
+
+ R : Rec;
+
+begin
+ if R.I2'Bit_Position /= 32 then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 354262986bc..09d42b28cf8 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1085,8 +1085,8 @@ proc check_effective_target_pie { } {
return 1;
}
if { [istarget *-*-solaris2.1\[1-9\]*] } {
- # Full PIE support was added in Solaris 11.x and Solaris 12, but gcc
- # errors out if missing, so check for that.
+ # Full PIE support was added in Solaris 11.3, but gcc errors out
+ # if missing, so check for that.
return [check_no_compiler_messages pie executable {
int main (void) { return 0; }
} "-pie -fpie"]
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 488af8ec77f..fc76c961dde 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,14 @@
+2017-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2017-11-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * config.host (*-*-solaris2*): Adapt comment for Solaris 12
+ renaming.
+ * config/sol2/crtpg.c (__start_crt_compiler): Likewise.
+ * configure.ac (libgcc_cv_solaris_crts): Likewise.
+ * configure: Regenerate.
+
2017-11-05 Andreas Tobler <andreast@gcc.gnu.org>
Backport from mainline
diff --git a/libgcc/config.host b/libgcc/config.host
index d16960c1f25..3e9bb1d2846 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -277,7 +277,7 @@ case ${host} in
tmake_file="$tmake_file $cpu_type/t-sol2"
extra_parts="gmon.o crtbegin.o crtend.o"
if test "${libgcc_cv_solaris_crts}" = yes; then
- # Solaris 11.x and 12 provide crt1.o, crti.o, and crtn.o as part of the
+ # Solaris 11.4 provides crt1.o, crti.o, and crtn.o as part of the
# base system. crtp.o and crtpg.o implement the compiler-dependent parts.
extra_parts="$extra_parts crtp.o crtpg.o"
# If the Solaris CRTs are present, both ld and gld will have PIE support.
diff --git a/libgcc/config/sol2/crtpg.c b/libgcc/config/sol2/crtpg.c
index 38ee21cc9b4..d6672c8f372 100644
--- a/libgcc/config/sol2/crtpg.c
+++ b/libgcc/config/sol2/crtpg.c
@@ -31,11 +31,10 @@ extern char _start[], _etext[];
int __start_crt_compiler (int, char **);
-/* Since Solaris 11.x and Solaris 12, the system-provided CRTs provide a
- hook to invoke initialization code early during process startup.
- __start_crt_compiler is documented in crt1.o(5). We use it to perform
- initialization for profiling as a substitute for the earlier separate
- gcrt1.o. */
+/* Since Solaris 11.4, the system-provided CRTs provide a hook to invoke
+ initialization code early during process startup. __start_crt_compiler
+ is documented in crt1.o(5). We use it to perform initialization for
+ profiling as a substitute for the earlier separate gcrt1.o. */
int
__start_crt_compiler (int argc __attribute__ ((unused)),
diff --git a/libgcc/configure b/libgcc/configure
index e7d6c75a6f7..04ff07636fc 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -4667,7 +4667,7 @@ esac
case ${host} in
*-*-solaris2*)
- # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
+ # Check for system-provided CRTs on Solaris 11.4.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking system-provided CRTs on Solaris" >&5
$as_echo_n "checking system-provided CRTs on Solaris... " >&6; }
if test "${libgcc_cv_solaris_crts+set}" = set; then :
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 269997f23e2..58b67790c05 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -294,7 +294,7 @@ esac
case ${host} in
*-*-solaris2*)
- # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
+ # Check for system-provided CRTs on Solaris 11.4.
AC_CACHE_CHECK([system-provided CRTs on Solaris],
[libgcc_cv_solaris_crts],
[libgcc_cv_solaris_crts=no
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index dd0eb9c720e..2bb43830478 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,19 @@
+2018-01-03 Janne Blomqvist <jb@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/83649
+ * io/unix.c (MAX_CHUNK): New define.
+ (raw_read): For reads larger than MAX_CHUNK, loop.
+ (raw_write): Write no more than MAX_CHUNK bytes per iteration.
+
+2017-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/81937
+ * io/list_read.c (next_char_internal): Don't attempt to read
+ from the internal unit stream if no bytes are left. Decrement
+ bytes_left in the right place.
+
2017-10-22 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 244430d9765..986a0714cb9 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -266,15 +266,19 @@ next_char_internal (st_parameter_dt *dtp)
}
/* Get the next character and handle end-of-record conditions. */
-
- if (dtp->common.unit) /* Check for kind=4 internal unit. */
- length = sread (dtp->u.p.current_unit->s, &c, 1);
+ if (likely (dtp->u.p.current_unit->bytes_left > 0))
+ {
+ if (dtp->common.unit) /* Check for kind=4 internal unit. */
+ length = sread (dtp->u.p.current_unit->s, &c, 1);
+ else
+ {
+ char cc;
+ length = sread (dtp->u.p.current_unit->s, &cc, 1);
+ c = cc;
+ }
+ }
else
- {
- char cc;
- length = sread (dtp->u.p.current_unit->s, &cc, 1);
- c = cc;
- }
+ length = 0;
if (unlikely (length < 0))
{
@@ -290,7 +294,6 @@ next_char_internal (st_parameter_dt *dtp)
generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL);
return '\0';
}
- dtp->u.p.current_unit->bytes_left--;
}
else
{
@@ -302,6 +305,7 @@ next_char_internal (st_parameter_dt *dtp)
dtp->u.p.at_eof = 1;
}
}
+ dtp->u.p.current_unit->bytes_left--;
done:
dtp->u.p.at_eol = (c == '\n' || c == EOF);
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index bdec1e89f52..aed668471a8 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -294,12 +294,50 @@ raw_flush (unix_stream * s __attribute__ ((unused)))
return 0;
}
+/* Write/read at most 2 GB - 4k chunks at a time. Linux never reads or
+ writes more than this, and there are reports that macOS fails for
+ larger than 2 GB as well. */
+#define MAX_CHUNK 2147479552
+
static ssize_t
raw_read (unix_stream * s, void * buf, ssize_t nbyte)
{
/* For read we can't do I/O in a loop like raw_write does, because
- that will break applications that wait for interactive I/O. */
- return read (s->fd, buf, nbyte);
+ that will break applications that wait for interactive I/O. We
+ still can loop around EINTR, though. This however causes a
+ problem for large reads which must be chunked, see comment above.
+ So assume that if the size is larger than the chunk size, we're
+ reading from a file and not the terminal. */
+ if (nbyte <= MAX_CHUNK)
+ {
+ while (true)
+ {
+ ssize_t trans = read (s->fd, buf, nbyte);
+ if (trans == -1 && errno == EINTR)
+ continue;
+ return trans;
+ }
+ }
+ else
+ {
+ ssize_t bytes_left = nbyte;
+ char *buf_st = buf;
+ while (bytes_left > 0)
+ {
+ ssize_t to_read = bytes_left < MAX_CHUNK ? bytes_left: MAX_CHUNK;
+ ssize_t trans = read (s->fd, buf_st, to_read);
+ if (trans == -1)
+ {
+ if (errno == EINTR)
+ continue;
+ else
+ return trans;
+ }
+ buf_st += trans;
+ bytes_left -= trans;
+ }
+ return nbyte - bytes_left;
+ }
}
static ssize_t
@@ -312,10 +350,13 @@ raw_write (unix_stream * s, const void * buf, ssize_t nbyte)
buf_st = (char *) buf;
/* We must write in a loop since some systems don't restart system
- calls in case of a signal. */
+ calls in case of a signal. Also some systems might fail outright
+ if we try to write more than 2 GB in a single syscall, so chunk
+ up large writes. */
while (bytes_left > 0)
{
- trans = write (s->fd, buf_st, bytes_left);
+ ssize_t to_write = bytes_left < MAX_CHUNK ? bytes_left: MAX_CHUNK;
+ trans = write (s->fd, buf_st, to_write);
if (trans < 0)
{
if (errno == EINTR)
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a86bcb82311..b23685c7144 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -684,7 +684,7 @@ STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset}
AC_SUBST(STRUCT_EPOLL_EVENT_FD_OFFSET)
dnl Check if <sys/stat.h> uses timespec_t for st_?tim members. Introduced
-dnl in Solaris 12 for XPG7 compatibility.
+dnl in Solaris 11.4 for XPG7 compatibility.
AC_EGREP_HEADER([timespec_t.*st_atim], [sys/stat.h],
[have_stat_timespec=yes], [have_stat_timespec=no])
AM_CONDITIONAL(HAVE_STAT_TIMESPEC, test $have_stat_timespec = yes)
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 1271e1a550f..53c017f7596 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1503,22 +1503,22 @@ grep '^type _zone_net_addr_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr/[16]byte/' \
>> ${OUT}
-# The Solaris 12 _flow_arp_desc_t struct.
+# The Solaris 11.4 _flow_arp_desc_t struct.
grep '^type _flow_arp_desc_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _flow_l3_desc_t struct.
+# The Solaris 11.4 _flow_l3_desc_t struct.
grep '^type _flow_l3_desc_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _mac_ipaddr_t struct.
+# The Solaris 11.3 _mac_ipaddr_t struct.
grep '^type _mac_ipaddr_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _mactun_info_t struct.
+# The Solaris 11.3 _mactun_info_t struct.
grep '^type _mactun_info_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index a8db5f76834..a5e99d38a5e 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2017-12-10 Tom de Vries <tom@codesourcery.com>
+
+ backport from trunk:
+ PR c/81875
+ 2017-09-16 Tom de Vries <tom@codesourcery.com>
+
+ * testsuite/libgomp.c/pr81875.c: New test.
+
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/libgomp/testsuite/libgomp.c/pr81875.c b/libgomp/testsuite/libgomp.c/pr81875.c
new file mode 100644
index 00000000000..3067d49a492
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr81875.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+#define N 32ULL
+int a[N];
+
+const unsigned long long c = 0x7fffffffffffffffULL;
+
+void
+f2_tpf_static32 (void)
+{
+ unsigned long long i;
+ #pragma omp for
+ for (i = c + N; i > c; i -= 1ULL)
+ a[i - 1ULL - c] -= 4;
+}
+
+__attribute__((noinline, noclone)) int
+test_tpf_static32 (void)
+{
+ int i, j, k;
+ for (i = 0; i < N; i++)
+ a[i] = i - 25;
+
+ f2_tpf_static32 ();
+
+ for (i = 0; i < N; i++)
+ if (a[i] != i - 29)
+ return 1;
+
+ return 0;
+}
+
+int
+main ()
+{
+ if (test_tpf_static32 ())
+ abort ();
+
+ return 0;
+}
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index cbe0fc5daa8..8db45525a7d 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,88 @@
+2018-01-15 Jonathan Wakely <jwakely@redhat.com>
+
+ * python/libstdcxx/v6/printers.py (register_type_printers): Remove
+ printer for experimental::any. Fix printers for experimental::optional
+ and experimental::basic_string_view.
+
+ Backport from mainline
+ 2018-01-04 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83626
+ * src/filesystem/ops.cc (remove(const path&, error_code&))): Do not
+ return an error for non-existent paths. Remove unnecessary
+ symlink_status call.
+ (remove_all(const path&)): Fix type of result variable.
+ (remove_all(const path&, error_code&))): Use non-throwing increment
+ for directory iterator. Do not return an error for non-existent paths.
+ * testsuite/experimental/filesystem/operations/remove.cc: New test.
+ * testsuite/experimental/filesystem/operations/remove_all.cc: Fix
+ expected results for non-existent paths.
+
+2018-01-05 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2017-11-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/locale_conv.h (wbuffer_convert::_M_conv_get): Fix typo.
+ * testsuite/22_locale/conversions/buffer/3.cc: New test.
+
+ Backport from mainline
+ 2017-10-19 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/experimental/filesystem/iterators/
+ recursive_directory_iterator.cc: Ensure that error_code arguments are
+ cleared when required.
+ * testsuite/experimental/filesystem/operations/create_directory.cc:
+ Remove redundant check.
+ * testsuite/experimental/filesystem/operations/temp_directory_path.cc:
+ Ensure that error_code argument is cleared when required.
+
+ Backport from mainline
+ 2017-12-27 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83600
+ * include/bits/regex.h (match_results::end()): Return valid iterator
+ when not ready.
+ * testsuite/28_regex/match_results/ctors/char/default.cc: Check that
+ unready objects are empty and have equal begin and end iterators.
+ * testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise.
+
+ Backport from mainline
+ 2017-12-27 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83598
+ * include/bits/regex.h (basic_regex): Don't modify flags passed to
+ constructors.
+ * testsuite/28_regex/basic_regex/ctors/83598.cc: New test.
+
+ Backport from mainline
+ 2017-12-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83279
+ * src/filesystem/std-ops.cc (do_copy_file): Handle sendfile not
+ copying entire file.
+
+ Backport from mainline
+ 2018-01-04 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/experimental/fs_ops.h (exists(const path&, error_code&))):
+ Only check status_known once.
+
+ Backport from mainline
+ 2017-10-25 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/79283
+ * src/filesystem/ops.cc (read_symlink): Handle st_size being zero.
+
+2017-12-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/59568
+ * include/std/complex (operator>>): Only use putback if a character
+ was successfully extracted and only set the value if a number was
+ successfully extracted.
+ * testsuite/26_numerics/complex/inserters_extractors/char/59568.cc:
+ New test.
+
2017-11-11 John David Anglin <danglin@gcc.gnu.org>
Backport from mainline
diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h
index 9667374840b..06376e9cd19 100644
--- a/libstdc++-v3/include/bits/locale_conv.h
+++ b/libstdc++-v3/include/bits/locale_conv.h
@@ -431,7 +431,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
streamsize __nbytes = sizeof(_M_get_buf) - _M_unconv;
__nbytes = std::min(__nbytes, _M_buf->in_avail());
if (__nbytes < 1)
- __nbytes == 1;
+ __nbytes = 1;
__nbytes = _M_buf->sgetn(_M_get_buf + _M_unconv, __nbytes);
if (__nbytes < 1)
return false;
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 983bdef3871..cf7aa3ee4bf 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -1751,7 +1751,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
*/
const_iterator
end() const
- { return _Base_type::end() - 3; }
+ { return _Base_type::end() - (empty() ? 0 : 3); }
/**
* @brief Gets an iterator to one-past-the-end of the collection.
diff --git a/libstdc++-v3/include/experimental/bits/fs_ops.h b/libstdc++-v3/include/experimental/bits/fs_ops.h
index 62a9826d6e5..7b30a30138e 100644
--- a/libstdc++-v3/include/experimental/bits/fs_ops.h
+++ b/libstdc++-v3/include/experimental/bits/fs_ops.h
@@ -131,8 +131,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
auto __s = status(__p, __ec);
if (status_known(__s))
- __ec.clear();
- return exists(__s);
+ {
+ __ec.clear();
+ return __s.type() != file_type::not_found;
+ }
+ return false;
}
uintmax_t file_size(const path& __p);
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 8f9703a59c8..1225c6bc44e 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -493,7 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
{
_Tp __re_x, __im_x;
- _CharT __ch;
+ _CharT __ch = _CharT();
__is >> __ch;
if (__ch == '(')
{
@@ -511,11 +511,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
else
__is.setstate(ios_base::failbit);
}
- else
+ else if (__is)
{
__is.putback(__ch);
- __is >> __re_x;
- __x = __re_x;
+ if (__is >> __re_x)
+ __x = __re_x;
+ else
+ __is.setstate(ios_base::failbit);
}
return __is;
}
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 040715a9073..ec3feafc5de 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1154,7 +1154,7 @@ class TemplateTypePrinter(object):
Recognizes type names that match a regular expression.
Replaces them with a formatted string which can use replacement field
{N} to refer to the \N subgroup of the regex match.
- Type printers are recusively applied to the subgroups.
+ Type printers are recursively applied to the subgroups.
This allows recognizing e.g. "std::vector<(.*), std::allocator<\\1> >"
and replacing it with "std::vector<{1}>", omitting the template argument
@@ -1335,10 +1335,10 @@ def register_type_printers(obj):
# strip the "fundamentals_v1" inline namespace from these types
add_one_template_type_printer(obj, 'optional<T>',
'experimental::fundamentals_v1::optional<(.*)>',
- 'experimental::optional<\\1>')
+ 'experimental::optional<{1}>')
add_one_template_type_printer(obj, 'basic_string_view<C>',
'experimental::fundamentals_v1::basic_string_view<(.*), std::char_traits<\\1> >',
- 'experimental::basic_string_view<\\1>')
+ 'experimental::basic_string_view<{1}>')
def register_libstdcxx_printers (obj):
"Register libstdc++ pretty-printers with objfile Obj."
diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
index 0dcb1b410fc..d4bd5207b63 100644
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -443,48 +443,68 @@ namespace
return false;
}
+ size_t count = from_st->st_size;
#ifdef _GLIBCXX_USE_SENDFILE
off_t offset = 0;
- const auto n = ::sendfile(out.fd, in.fd, &offset, from_st->st_size);
- if (n < 0 && (errno == ENOSYS || errno == EINVAL))
+ ssize_t n = ::sendfile(out.fd, in.fd, &offset, count);
+ if (n < 0 && errno != ENOSYS && errno != EINVAL)
{
-#endif
- __gnu_cxx::stdio_filebuf<char> sbin(in.fd, std::ios::in);
- __gnu_cxx::stdio_filebuf<char> sbout(out.fd, std::ios::out);
- if (sbin.is_open())
- in.fd = -1;
- if (sbout.is_open())
- out.fd = -1;
- if (from_st->st_size && !(std::ostream(&sbout) << &sbin))
- {
- ec = std::make_error_code(std::errc::io_error);
- return false;
- }
- if (!sbout.close() || !sbin.close())
+ ec.assign(errno, std::generic_category());
+ return false;
+ }
+ if ((size_t)n == count)
+ {
+ if (!out.close() || !in.close())
{
ec.assign(errno, std::generic_category());
return false;
}
-
ec.clear();
return true;
+ }
+ else if (n > 0)
+ count -= n;
+#endif // _GLIBCXX_USE_SENDFILE
+
+ using std::ios;
+ __gnu_cxx::stdio_filebuf<char> sbin(in.fd, ios::in|ios::binary);
+ __gnu_cxx::stdio_filebuf<char> sbout(out.fd, ios::out|ios::binary);
+
+ if (sbin.is_open())
+ in.fd = -1;
+ if (sbout.is_open())
+ out.fd = -1;
#ifdef _GLIBCXX_USE_SENDFILE
+ if (n != 0)
+ {
+ if (n < 0)
+ n = 0;
+
+ const auto p1 = sbin.pubseekoff(n, ios::beg, ios::in);
+ const auto p2 = sbout.pubseekoff(n, ios::beg, ios::out);
+
+ const std::streampos errpos(std::streamoff(-1));
+ if (p1 == errpos || p2 == errpos)
+ {
+ ec = std::make_error_code(std::errc::io_error);
+ return false;
+ }
}
- if (n != from_st->st_size)
+#endif
+
+ if (count && !(std::ostream(&sbout) << &sbin))
{
- ec.assign(errno, std::generic_category());
+ ec = std::make_error_code(std::errc::io_error);
return false;
}
- if (!out.close() || !in.close())
+ if (!sbout.close() || !sbin.close())
{
ec.assign(errno, std::generic_category());
return false;
}
-
ec.clear();
return true;
-#endif
}
}
#endif
@@ -1199,26 +1219,45 @@ fs::read_symlink(const path& p)
fs::path fs::read_symlink(const path& p, error_code& ec)
{
+ path result;
#ifdef _GLIBCXX_HAVE_SYS_STAT_H
stat_type st;
if (::lstat(p.c_str(), &st))
{
ec.assign(errno, std::generic_category());
- return {};
+ return result;
}
- std::string buf(st.st_size, '\0');
- ssize_t len = ::readlink(p.c_str(), &buf.front(), buf.size());
- if (len == -1)
+ std::string buf(st.st_size ? st.st_size + 1 : 128, '\0');
+ do
{
- ec.assign(errno, std::generic_category());
- return {};
+ ssize_t len = ::readlink(p.c_str(), &buf.front(), buf.size());
+ if (len == -1)
+ {
+ ec.assign(errno, std::generic_category());
+ return result;
+ }
+ else if (len == (ssize_t)buf.size())
+ {
+ if (buf.size() > 4096)
+ {
+ ec.assign(ENAMETOOLONG, std::generic_category());
+ return result;
+ }
+ buf.resize(buf.size() * 2);
+ }
+ else
+ {
+ buf.resize(len);
+ result.assign(buf);
+ ec.clear();
+ break;
+ }
}
- ec.clear();
- return path{buf.data(), buf.data()+len};
+ while (true);
#else
ec = std::make_error_code(std::errc::not_supported);
- return {};
#endif
+ return result;
}
@@ -1235,16 +1274,15 @@ fs::remove(const path& p)
bool
fs::remove(const path& p, error_code& ec) noexcept
{
- if (exists(symlink_status(p, ec)))
+ if (::remove(p.c_str()) == 0)
{
- if (::remove(p.c_str()) == 0)
- {
- ec.clear();
- return true;
- }
- else
- ec.assign(errno, std::generic_category());
+ ec.clear();
+ return true;
}
+ else if (errno == ENOENT)
+ ec.clear();
+ else
+ ec.assign(errno, std::generic_category());
return false;
}
@@ -1253,7 +1291,7 @@ std::uintmax_t
fs::remove_all(const path& p)
{
error_code ec;
- bool result = remove_all(p, ec);
+ const auto result = remove_all(p, ec);
if (ec.value())
_GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot remove all", p, ec));
return result;
@@ -1262,14 +1300,28 @@ fs::remove_all(const path& p)
std::uintmax_t
fs::remove_all(const path& p, error_code& ec) noexcept
{
- auto fs = symlink_status(p, ec);
- uintmax_t count = 0;
- if (ec.value() == 0 && fs.type() == file_type::directory)
- for (directory_iterator d(p, ec), end; ec.value() == 0 && d != end; ++d)
- count += fs::remove_all(d->path(), ec);
- if (ec.value())
+ const auto s = symlink_status(p, ec);
+ if (!status_known(s))
return -1;
- return fs::remove(p, ec) ? ++count : -1; // fs:remove() calls ec.clear()
+
+ ec.clear();
+ if (s.type() == file_type::not_found)
+ return 0;
+
+ uintmax_t count = 0;
+ if (s.type() == file_type::directory)
+ {
+ for (directory_iterator d(p, ec), end; !ec && d != end; d.increment(ec))
+ count += fs::remove_all(d->path(), ec);
+ if (ec.value() == ENOENT)
+ ec.clear();
+ else if (ec)
+ return -1;
+ }
+
+ if (fs::remove(p, ec))
+ ++count;
+ return ec ? -1 : count;
}
void
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
new file mode 100644
index 00000000000..99a679dc124
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
@@ -0,0 +1,58 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+
+#include <locale>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+struct streambuf : std::streambuf
+{
+ int_type underflow() override
+ {
+ if (c != '\0')
+ {
+ this->setg(&c, &c, &c + 1);
+ return *this->gptr();
+ }
+ c = '\0';
+ return traits_type::eof();
+ }
+
+private:
+ char c = 'a';
+};
+
+struct codecvt : std::codecvt<wchar_t, char, std::mbstate_t> { };
+
+void
+test01()
+{
+ // https://gcc.gnu.org/ml/libstdc++/2017-11/msg00022.html
+ streambuf sb;
+ std::wbuffer_convert<codecvt> conv(&sb);
+ VERIFY( sb.in_avail() == 0 );
+ wchar_t c = conv.sgetc();
+ VERIFY( c == L'a' );
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/59568.cc b/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/59568.cc
new file mode 100644
index 00000000000..e292e13311a
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/59568.cc
@@ -0,0 +1,191 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <complex>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::istringstream in(" 1 (2) ( 2.0 , 0.5 ) ");
+ std::complex<double> c1, c2, c3;
+ in >> c1 >> c2 >> c3;
+ VERIFY( in.good() );
+ VERIFY( c1.real() == 1 && c1.imag() == 0 );
+ VERIFY( c2.real() == 2 && c2.imag() == 0 );
+ VERIFY( c3.real() == 2 && c3.imag() == 0.5 );
+}
+
+void
+test02()
+{
+ std::istringstream in;
+ std::complex<double> c(-1, -1);
+ const std::complex<double> c0 = c;
+
+ in.str("a");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == 'a' );
+ VERIFY( c == c0 );
+
+ in.str(" ( ) ");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == ')' );
+ VERIFY( c == c0 );
+
+ in.str("(,");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == ',' );
+ VERIFY( c == c0 );
+
+ in.str("(b)");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == 'b' );
+ VERIFY( c == c0 );
+
+ in.str("( c)");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == 'c' );
+ VERIFY( c == c0 );
+
+ in.str("(99d");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ // VERIFY( in.get() == 'd' );
+ VERIFY( c == c0 );
+
+ in.str("(99 e");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ // VERIFY( in.get() == 'e' );
+ VERIFY( c == c0 );
+
+ in.str("(99, f");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == 'f' );
+ VERIFY( c == c0 );
+
+ in.str("(99, 88g");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ // VERIFY( in.get() == 'g' );
+ VERIFY( c == c0 );
+
+ in.str("(99, 88 h");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ // VERIFY( in.get() == 'h' );
+ VERIFY( c == c0 );
+
+ in.str("(99, )");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == ')' );
+ VERIFY( c == c0 );
+}
+
+void
+test03()
+{
+ // PR libstdc++/59568
+ std::istringstream in;
+ std::complex<double> c;
+
+ in.str("");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+
+ in.str(" ");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+
+ in.str("(99");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+
+ in.str("(99,");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+
+ in.str("(99,99");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+}
+
+void
+test04()
+{
+ // Test noskipws handling
+ std::istringstream in;
+ const char* bad_inputs[] = {
+ " 1", " (2)", "( 2)", "(2 )", "(2 ,3)", "(2,3 )", 0
+ };
+ const std::complex<double> c0(-1, -1);
+ std::complex<double> c;
+ for (int i = 0; bad_inputs[i]; ++i)
+ {
+ c = c0;
+ in.clear();
+ in.str(bad_inputs[i]);
+ in >> std::noskipws >> c;
+ VERIFY( in.fail() );
+ VERIFY( c == c0 );
+
+ in.clear();
+ in.str(bad_inputs[i]);
+ in >> std::skipws >> c;
+ VERIFY( !in.fail() );
+ VERIFY( c != c0 );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+}
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/83598.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/83598.cc
new file mode 100644
index 00000000000..b958dfbe42f
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/83598.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ // PR libstdc++83598
+ std::regex r1(".", std::regex_constants::syntax_option_type{});
+ VERIFY(r1.flags() == std::regex_constants::syntax_option_type{});
+ std::regex r2(".", std::regex_constants::icase);
+ VERIFY(r2.flags() == std::regex_constants::icase);
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc b/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc
index 80b8bf767e5..82ae40dc219 100644
--- a/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc
+++ b/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc
@@ -32,6 +32,8 @@ void test01()
std::cmatch cm;
VERIFY( cm.size() == 0 );
VERIFY( !cm.ready() );
+ VERIFY( cm.empty() );
+ VERIFY( cm.begin() == cm.end() ); // PR libstdc++/83600
}
void test02()
@@ -41,6 +43,8 @@ void test02()
std::smatch sm;
VERIFY( sm.size() == 0 );
VERIFY( !sm.ready() );
+ VERIFY( sm.empty() );
+ VERIFY( sm.begin() == sm.end() ); // PR libstdc++/83600
}
int
diff --git a/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc b/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc
index a4f68c1fc0d..88fe6a4f54c 100644
--- a/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc
+++ b/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc
@@ -32,6 +32,8 @@ void test01()
std::wcmatch cm;
VERIFY( cm.size() == 0 );
VERIFY( !cm.ready() );
+ VERIFY( cm.empty() );
+ VERIFY( cm.begin() == cm.end() ); // PR libstdc++/83600
}
void test02()
@@ -41,6 +43,8 @@ void test02()
std::wsmatch sm;
VERIFY( sm.size() == 0 );
VERIFY( !sm.ready() );
+ VERIFY( sm.empty() );
+ VERIFY( sm.begin() == sm.end() ); // PR libstdc++/83600
}
int
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
index 9e94c4799be..dec59697163 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
@@ -28,6 +28,7 @@ void
test01()
{
bool test __attribute__((unused)) = false;
+ const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
std::error_code ec;
// Test non-existent path.
@@ -37,15 +38,19 @@ test01()
VERIFY( iter == end(iter) );
// Test empty directory.
+ ec = bad_ec;
create_directory(p, fs::current_path(), ec);
VERIFY( !ec );
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, ec);
VERIFY( !ec );
VERIFY( iter == end(iter) );
// Test non-empty directory.
- create_directories(p / "d1/d2");
+ ec = bad_ec;
+ create_directories(p / "d1/d2", ec);
VERIFY( !ec );
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, ec);
VERIFY( !ec );
VERIFY( iter != end(iter) );
@@ -56,6 +61,7 @@ test01()
VERIFY( iter == end(iter) );
// Test inaccessible directory.
+ ec = bad_ec;
permissions(p, fs::perms::none, ec);
VERIFY( !ec );
iter = fs::recursive_directory_iterator(p, ec);
@@ -64,15 +70,19 @@ test01()
// Test inaccessible directory, skipping permission denied.
const auto opts = fs::directory_options::skip_permission_denied;
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, opts, ec);
VERIFY( !ec );
VERIFY( iter == end(iter) );
// Test inaccessible sub-directory.
+ ec = bad_ec;
permissions(p, fs::perms::owner_all, ec);
VERIFY( !ec );
+ ec = bad_ec;
permissions(p/"d1/d2", fs::perms::none, ec);
VERIFY( !ec );
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, ec);
VERIFY( !ec );
VERIFY( iter != end(iter) );
@@ -84,12 +94,14 @@ test01()
VERIFY( iter == end(iter) );
// Test inaccessible sub-directory, skipping permission denied.
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, opts, ec);
VERIFY( !ec );
VERIFY( iter != end(iter) );
VERIFY( iter->path() == p/"d1" );
++iter; // should recurse into d1
VERIFY( iter->path() == p/"d1/d2" );
+ ec = bad_ec;
iter.increment(ec); // should fail to recurse into p/d1/d2, so skip it
VERIFY( !ec );
VERIFY( iter == end(iter) );
@@ -103,12 +115,15 @@ test02()
{
bool test __attribute__((unused)) = false;
+ const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
std::error_code ec;
const auto p = __gnu_test::nonexistent_path();
+ ec = bad_ec;
create_directories(p / "d1/d2", ec);
VERIFY( !ec );
// Test post-increment (libstdc++/71005)
+ ec = bad_ec;
auto iter = fs::recursive_directory_iterator(p, ec);
VERIFY( !ec );
VERIFY( iter != end(iter) );
@@ -130,7 +145,7 @@ test03()
{
bool test __attribute__((unused)) = false;
- std::error_code ec;
+ std::error_code ec = make_error_code(std::errc::invalid_argument);
const auto p = __gnu_test::nonexistent_path();
create_directories(p / "longer_than_small_string_buffer", ec);
VERIFY( !ec );
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc
index 66c2b3fb796..eae60a05bd4 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc
@@ -50,7 +50,6 @@ test01()
VERIFY( !ec );
VERIFY( !b );
b = create_directory(p);
- VERIFY( !ec );
VERIFY( !b );
remove_all(p, ec);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc
new file mode 100644
index 00000000000..7c098b4864b
--- /dev/null
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc
@@ -0,0 +1,100 @@
+// Copyright (C) 2018 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-lstdc++fs" }
+// { dg-do run { target c++11 } }
+// { dg-require-filesystem-ts "" }
+
+#include <experimental/filesystem>
+#include <testsuite_hooks.h>
+#include <testsuite_fs.h>
+
+namespace fs = std::experimental::filesystem;
+
+void
+test01()
+{
+ std::error_code ec;
+ const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
+ bool n;
+
+ n = fs::remove("", ec);
+ VERIFY( !ec ); // This seems odd, but is what the standard requires.
+ VERIFY( !n );
+
+ auto p = __gnu_test::nonexistent_path();
+ ec = bad_ec;
+ n = remove(p, ec);
+ VERIFY( !ec );
+ VERIFY( !n );
+
+ auto link = __gnu_test::nonexistent_path();
+ create_symlink(p, link); // dangling symlink
+ ec = bad_ec;
+ n = remove(link, ec);
+ VERIFY( !ec );
+ VERIFY( n );
+ VERIFY( !exists(symlink_status(link)) );
+
+ __gnu_test::scoped_file f(p);
+ create_symlink(p, link);
+ ec = bad_ec;
+ n = remove(link, ec);
+ VERIFY( !ec );
+ VERIFY( n );
+ VERIFY( !exists(symlink_status(link)) ); // The symlink is removed, but
+ VERIFY( exists(p) ); // its target is not.
+
+ ec = bad_ec;
+ n = remove(p, ec);
+ VERIFY( !ec );
+ VERIFY( n );
+ VERIFY( !exists(symlink_status(p)) );
+
+ const auto dir = __gnu_test::nonexistent_path();
+ create_directories(dir/"a/b");
+ ec.clear();
+ n = remove(dir/"a", ec);
+ VERIFY( ec );
+ VERIFY( !n );
+ VERIFY( exists(dir/"a/b") );
+
+ permissions(dir, fs::perms::none, ec);
+ if (!ec)
+ {
+ ec.clear();
+ n = remove(dir/"a/b", ec);
+ VERIFY( ec );
+ VERIFY( !n );
+ permissions(dir, fs::perms::owner_all, ec);
+ }
+
+ ec = bad_ec;
+ n = remove(dir/"a/b", ec);
+ VERIFY( !ec );
+ VERIFY( n );
+ VERIFY( !exists(dir/"a/b") );
+
+ remove(dir/"a", ec);
+ remove(dir, ec);
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
index 57d15af9c5c..67f6e989d27 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Free Software Foundation, Inc.
+// Copyright (C) 2016-2018 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
@@ -29,19 +29,19 @@ void
test01()
{
std::error_code ec;
+ const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
std::uintmax_t n;
n = fs::remove_all("", ec);
- VERIFY( ec );
- VERIFY( n == std::uintmax_t(-1) );
+ VERIFY( !ec ); // This seems odd, but is what the TS requires.
+ VERIFY( n == 0 );
auto p = __gnu_test::nonexistent_path();
- ec.clear();
+ ec = bad_ec;
n = remove_all(p, ec);
- VERIFY( ec );
- VERIFY( n == std::uintmax_t(-1) );
+ VERIFY( !ec );
+ VERIFY( n == 0 );
- const auto bad_ec = ec;
auto link = __gnu_test::nonexistent_path();
create_symlink(p, link); // dangling symlink
ec = bad_ec;
@@ -59,7 +59,7 @@ test01()
VERIFY( !exists(symlink_status(link)) ); // The symlink is removed, but
VERIFY( exists(p) ); // its target is not.
- auto dir = __gnu_test::nonexistent_path();
+ const auto dir = __gnu_test::nonexistent_path();
create_directories(dir/"a/b/c");
ec = bad_ec;
n = remove_all(dir/"a", ec);
@@ -85,8 +85,28 @@ test01()
b2.path.clear();
}
+void
+test02()
+{
+ const auto dir = __gnu_test::nonexistent_path();
+ create_directories(dir/"a/b/c");
+ std::uintmax_t n = remove_all(dir/"a");
+ VERIFY( n == 3 );
+ VERIFY( exists(dir) );
+ VERIFY( !exists(dir/"a") );
+
+ n = remove_all(dir/"a");
+ VERIFY( n == 0 );
+ VERIFY( exists(dir) );
+
+ n = remove_all(dir);
+ VERIFY( n == 1 );
+ VERIFY( !exists(dir) );
+}
+
int
main()
{
test01();
+ test02();
}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc
index 23d4b9c4ab3..06c48cb2020 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc
@@ -44,7 +44,7 @@ test01()
if (!fs::exists("/tmp"))
return; // just give up
- std::error_code ec;
+ std::error_code ec = make_error_code(std::errc::invalid_argument);
fs::path p1 = fs::temp_directory_path(ec);
VERIFY( !ec );
VERIFY( exists(p1) );