aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@gcc.gnu.org>2018-08-17 14:12:20 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2018-08-17 14:12:20 +0000
commit33cec993eac1fb2a3a996612d31b072a922160d9 (patch)
tree1f3fc5917c336043c3bc0e8aafb78c2cbdb9b9f3
parentb27d440b39fff2befe700afa30d5f71faeb02e97 (diff)
parentc5d725c0a8da3b2227d119871e881d8a6e1bf600 (diff)
downloadgcc-33cec993eac1fb2a3a996612d31b072a922160d9.zip
gcc-33cec993eac1fb2a3a996612d31b072a922160d9.tar.gz
gcc-33cec993eac1fb2a3a996612d31b072a922160d9.tar.bz2
Merge trunk r263618.
From-SVN: r263620
-rw-r--r--ChangeLog.name-lookup4
-rw-r--r--gcc/ChangeLog125
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/builtins.c63
-rw-r--r--gcc/builtins.h2
-rw-r--r--gcc/c-family/ChangeLog34
-rw-r--r--gcc/c-family/c-common.c1
-rw-r--r--gcc/c-family/c-common.h1
-rw-r--r--gcc/c-family/c-indentation.c192
-rw-r--r--gcc/c-family/c.opt92
-rw-r--r--gcc/common.opt10
-rw-r--r--gcc/config/i386/i386.opt6
-rw-r--r--gcc/config/ia64/ia64.opt4
-rw-r--r--gcc/config/rs6000/altivec.md81
-rw-r--r--gcc/config/rs6000/darwin.md45
-rw-r--r--gcc/config/rs6000/dfp.md6
-rw-r--r--gcc/config/rs6000/htm.md36
-rw-r--r--gcc/config/rs6000/rs6000.md223
-rw-r--r--gcc/config/rs6000/rs6000.opt5
-rw-r--r--gcc/config/rs6000/sync.md6
-rw-r--r--gcc/config/rs6000/vsx.md3
-rw-r--r--gcc/cppbuiltin.c3
-rw-r--r--gcc/diagnostic-show-locus.c8
-rw-r--r--gcc/diagnostic.c6
-rw-r--r--gcc/doc/rtl.texi29
-rw-r--r--gcc/dwarf2out.c1
-rw-r--r--gcc/expmed.c93
-rw-r--r--gcc/expmed.h2
-rw-r--r--gcc/expr.c35
-rw-r--r--gcc/expr.h2
-rw-r--r--gcc/gimple-fold.c33
-rw-r--r--gcc/gimple-fold.h2
-rw-r--r--gcc/gimple-ssa-sprintf.c84
-rw-r--r--gcc/lto-opts.c1
-rw-r--r--gcc/lto-wrapper.c6
-rw-r--r--gcc/opt-functions.awk1
-rw-r--r--gcc/optabs.c3
-rw-r--r--gcc/optc-gen.awk20
-rw-r--r--gcc/opth-gen.awk1
-rw-r--r--gcc/opts-common.c28
-rw-r--r--gcc/opts.h3
-rw-r--r--gcc/rtl.h9
-rw-r--r--gcc/testsuite/ChangeLog101
-rw-r--r--gcc/testsuite/c-c++-common/Wmisleading-indentation-pr70693.c12
-rw-r--r--gcc/testsuite/g++.dg/opt/eh1.C2
-rw-r--r--gcc/testsuite/g++.dg/opt/mpx.C4
-rw-r--r--gcc/testsuite/g++.dg/template/inline1.C2
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr81408.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunreachable-code-1.C22
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunreachable-code-2.C23
-rw-r--r--gcc/testsuite/g++.dg/warn/pr31246-2.C9
-rw-r--r--gcc/testsuite/g++.dg/warn/pr31246.C9
-rw-r--r--gcc/testsuite/gcc.dg/missing-header-fixit-3.c27
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr33092.c6
-rw-r--r--gcc/testsuite/gcc.dg/pr41837.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr41841.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr42250.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr43084.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr43317.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr51879-18.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr36066.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52969.c16
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr86505.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c119
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-11.c65
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifc-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr45122.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect.exp7
-rw-r--r--gcc/testsuite/gcc.target/aarch64/imm_choice_comparison.c54
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-cvt-2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-cvt-2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr45352-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/zee.c2
-rw-r--r--gcc/testsuite/gfortran.dg/auto_char_len_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/auto_char_len_4.f901
-rw-r--r--gcc/testsuite/gfortran.dg/c_ptr_tests_15.f902
-rw-r--r--gcc/testsuite/gfortran.dg/char_array_structure_constructor.f901
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr47331.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr40999.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr41011.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr42051.f031
-rw-r--r--gcc/testsuite/gfortran.dg/pr46804.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr83149_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/pr83149_b.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_10.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_11.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_12.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_13.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_14.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_15.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_16.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_17.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_18.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_19.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_20.f032
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_7.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_8.f901
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_9.f901
-rw-r--r--gcc/tree-inline.c23
-rw-r--r--gcc/wide-int-range.cc2
-rw-r--r--libcpp/ChangeLog22
-rw-r--r--libcpp/include/cpp-id-data.h18
-rw-r--r--libcpp/macro.c3
-rw-r--r--libstdc++-v3/ChangeLog16
-rw-r--r--libstdc++-v3/include/std/ostream3
-rw-r--r--libstdc++-v3/include/tr1/legendre_function.tcc2
-rw-r--r--libstdc++-v3/src/c++11/cow-stdexcept.cc20
118 files changed, 1393 insertions, 645 deletions
diff --git a/ChangeLog.name-lookup b/ChangeLog.name-lookup
index 0f2ae63..f0d63eb 100644
--- a/ChangeLog.name-lookup
+++ b/ChangeLog.name-lookup
@@ -1,3 +1,7 @@
+2018-08-17 Nathan Sidwell <nathan@acm.org>
+
+ Merge trunk r263618.
+
2018-08-16 Nathan Sidwell <nathan@acm.org>
Merge trunk r263587.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fdac7e7..17545dc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,128 @@
+2018-08-17 Nathan Sidwell <nathan@acm.org>
+
+ * cppbuiltin.c: Include "cpplib.h", not "cpp-id-data.h".
+
+2018-08-17 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/86841
+ * wide-int-range.cc (wide_int_range_lshift): Use to_uhwi.
+
+2018-08-17 Martin Liska <mliska@suse.cz>
+
+ * common.opt: Remove Warn, Init and Report for options with
+ Ignore/Deprecated flag. Warning is done automatically for
+ Deprecated flags.
+ * config/i386/i386.opt: Likewise.
+ * config/ia64/ia64.opt: Likewise.
+ * config/rs6000/rs6000.opt: Likewise.
+ * cppbuiltin.c (define_builtin_macros_for_compilation_flags):
+ Remove usage of flag_check_pointer_bounds.
+ * lto-wrapper.c (merge_and_complain): Do not handle
+ OPT_fcheck_pointer_bounds.
+ (append_compiler_options): Likewise.
+ * opt-functions.awk: Do not handle Deprecated.
+ * optc-gen.awk: Check that Var, Report and Init are not
+ used for an option with Ignore/Deprecated flag.
+ * opts-common.c (decode_cmdline_option): Do not report
+ CL_ERR_DEPRECATED.
+ (read_cmdline_option): Report warning for OPT_SPECIAL_deprecated
+ options.
+ * opts.h (struct cl_option): Remove cl_deprecated flag.
+ (CL_ERR_DEPRECATED): Remove error enum value.
+
+2018-08-17 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/86505
+ * tree-inline.c (copy_bb): When inlining __builtin_va_arg_pack_len ()
+ across a va-arg-pack using call adjust its return value accordingly.
+
+2018-08-16 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/86853
+ * gimple-ssa-sprintf.c (struct format_result): Rename member.
+ (struct fmtresult): Add member and initialize it in ctors.
+ (format_character): Handle %C. Extend range to NUL. Set MAYFAIL.
+ (format_string): Handle %S the same as %ls. Set MAYFAIL.
+ (format_directive): Set POSUNDER4K when MAYFAIL is set.
+ (parse_directive): Handle %C same as %c.
+ (sprintf_dom_walker::compute_format_length): Adjust.
+ (is_call_safe): Adjust.
+
+2018-08-16 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * builtins.c (c_strlen): Add new parameter eltsize. Use it
+ for determining how to count the elements.
+ * builtins.h (c_strlen): Adjust prototype.
+ * expr.c (string_constant): Add new parameter mem_size.
+ Set *mem_size appropriately.
+ * expr.h (string_constant): Adjust protoype.
+ * gimple-fold.c (get_range_strlen): Add new parameter eltsize.
+ * gimple-fold.h (get_range_strlen): Adjust prototype.
+ * gimple-ssa-sprintf.c (get_string_length): Add new parameter eltsize.
+ (format_string): Call get_string_length with eltsize.
+
+2018-08-16 David Malcolm <dmalcolm@redhat.com>
+
+ * diagnostic.c (default_diagnostic_start_span_fn): Call pp_string
+ to emit the span, rather than setting it as the prefix.
+
+2018-08-16 David Malcolm <dmalcolm@redhat.com>
+
+ * diagnostic-show-locus.c (layout::start_annotation_line): Add
+ "margin_char" parameter, defaulting to space. Use it in place
+ of pp_space for the initial part of the margin.
+ (layout::print_leading_fixits): Use '+' when filling the margin
+ of line-insertion fix-it hints.
+
+2018-08-16 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * config/rs6000/rs6000.md (two unnamed define_insn and define_split):
+ Delete.
+
+2018-08-16 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * config/rs6000/altivec.md: Don't set length attribute to the default
+ value.
+ * config/rs6000/darwin.md: Ditto.
+ * config/rs6000/dfp.md: Ditto.
+ * config/rs6000/htm.md: Ditto.
+ * config/rs6000/rs6000.md: Ditto.
+ * config/rs6000/sync.md: Ditto.
+ * config/rs6000/vsx.md: Ditto.
+
+2018-08-16 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * config/rs6000/altivec.md: Don't set length attribute to the default
+ value, for branch instructions.
+ * config/rs6000/darwin.md: Ditto.
+ * config/rs6000/rs6000.md: Ditto.
+
+2018-08-16 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * config/rs6000/rs6000.md (length): Always define as const_int 4.
+ (unnamed conditional branch define_insn): Set length to 4 or 8
+ depending on offset.
+ (<bd>_<mode>): Similar, for alternative 0.
+ (<bd>tf_<mode>): Ditto.
+
+2018-08-16 Tamar Christina <tamar.christina@arm.com>
+
+ * expr.c (copy_blkmode_to_reg): Perform larger copies when safe.
+
+2018-08-16 Matthew Malcomson <matthew.malcomson@arm.com>
+
+ * doc/rtl.texi: Replace old RTX class names with new names.
+
+
+2018-08-16 Vlad Lazar <vlad.lazar@arm.com>
+
+ * expmed.h (canonicalize_comparison): New declaration.
+ * expmed.c (canonicalize_comparison, equivalent_cmp_code): New function.
+ * expmed.c (emit_store_flag_1): Add call to canonicalize_comparison.
+ * optabs.c (prepare_cmp_insn): Likewise.
+ * rtl.h (unsigned_condition_p): New function which checks if a
+ comparison operator is unsigned.
+
2018-08-16 Nathan Sidwell <nathan@acm.org>
* config/rs6000/rs6000-c.c (rs6000_macro_to_expend): Use cpp_macro_p.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index d8abe1f..f0507b5 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20180816
+20180817
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 6716aab..b1a79f3 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -568,41 +568,43 @@ string_length (const void *ptr, unsigned eltsize, unsigned maxelts)
accesses. Note that this implies the result is not going to be emitted
into the instruction stream.
- The value returned is of type `ssizetype'.
+ ELTSIZE is 1 for normal single byte character strings, and 2 or
+ 4 for wide characer strings. ELTSIZE is by default 1.
- Unfortunately, string_constant can't access the values of const char
- arrays with initializers, so neither can we do so here. */
+ The value returned is of type `ssizetype'. */
tree
-c_strlen (tree src, int only_value)
+c_strlen (tree src, int only_value, unsigned eltsize)
{
+ gcc_assert (eltsize == 1 || eltsize == 2 || eltsize == 4);
STRIP_NOPS (src);
if (TREE_CODE (src) == COND_EXPR
&& (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0))))
{
tree len1, len2;
- len1 = c_strlen (TREE_OPERAND (src, 1), only_value);
- len2 = c_strlen (TREE_OPERAND (src, 2), only_value);
+ len1 = c_strlen (TREE_OPERAND (src, 1), only_value, eltsize);
+ len2 = c_strlen (TREE_OPERAND (src, 2), only_value, eltsize);
if (tree_int_cst_equal (len1, len2))
return len1;
}
if (TREE_CODE (src) == COMPOUND_EXPR
&& (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0))))
- return c_strlen (TREE_OPERAND (src, 1), only_value);
+ return c_strlen (TREE_OPERAND (src, 1), only_value, eltsize);
location_t loc = EXPR_LOC_OR_LOC (src, input_location);
/* Offset from the beginning of the string in bytes. */
tree byteoff;
- src = string_constant (src, &byteoff);
+ tree memsize;
+ src = string_constant (src, &byteoff, &memsize);
if (src == 0)
return NULL_TREE;
/* Determine the size of the string element. */
- unsigned eltsize
- = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (src))));
+ if (eltsize != tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (src)))))
+ return NULL_TREE;
/* Set MAXELTS to sizeof (SRC) / sizeof (*SRC) - 1, the maximum possible
length of SRC. Prefer TYPE_SIZE() to TREE_STRING_LENGTH() if possible
@@ -613,14 +615,10 @@ c_strlen (tree src, int only_value)
HOST_WIDE_INT strelts = TREE_STRING_LENGTH (src);
strelts = strelts / eltsize - 1;
- HOST_WIDE_INT maxelts = strelts;
- tree type = TREE_TYPE (src);
- if (tree size = TYPE_SIZE_UNIT (type))
- if (tree_fits_shwi_p (size))
- {
- maxelts = tree_to_uhwi (size);
- maxelts = maxelts / eltsize - 1;
- }
+ if (!tree_fits_uhwi_p (memsize))
+ return NULL_TREE;
+
+ HOST_WIDE_INT maxelts = tree_to_uhwi (memsize) / eltsize - 1;
/* PTR can point to the byte representation of any string type, including
char* and wchar_t*. */
@@ -628,19 +626,23 @@ c_strlen (tree src, int only_value)
if (byteoff && TREE_CODE (byteoff) != INTEGER_CST)
{
+ /* For empty strings the result should be zero. */
+ if (maxelts == 0)
+ return ssize_int (0);
+
+ /* The code below works only for single byte character types. */
+ if (eltsize != 1)
+ return NULL_TREE;
+
/* If the string has an internal NUL character followed by any
non-NUL characters (e.g., "foo\0bar"), we can't compute
the offset to the following NUL if we don't know where to
start searching for it. */
unsigned len = string_length (ptr, eltsize, strelts);
- if (len < strelts)
- {
- /* Return when an embedded null character is found. */
- return NULL_TREE;
- }
- if (!maxelts)
- return ssize_int (0);
+ /* Return when an embedded null character is found or none at all. */
+ if (len < strelts || len > maxelts)
+ return NULL_TREE;
/* We don't know the starting offset, but we do know that the string
has no internal zero bytes. If the offset falls within the bounds
@@ -650,8 +652,8 @@ c_strlen (tree src, int only_value)
tree offsave = TREE_SIDE_EFFECTS (byteoff) ? save_expr (byteoff) : byteoff;
offsave = fold_convert (ssizetype, offsave);
tree condexp = fold_build2_loc (loc, LE_EXPR, boolean_type_node, offsave,
- build_int_cst (ssizetype, len * eltsize));
- tree lenexp = size_diffop_loc (loc, ssize_int (strelts * eltsize), offsave);
+ build_int_cst (ssizetype, len));
+ tree lenexp = size_diffop_loc (loc, ssize_int (strelts), offsave);
return fold_build3_loc (loc, COND_EXPR, ssizetype, condexp, lenexp,
build_zero_cst (ssizetype));
}
@@ -684,6 +686,11 @@ c_strlen (tree src, int only_value)
return NULL_TREE;
}
+ /* If eltoff is larger than strelts but less than maxelts the
+ string length is zero, since the excess memory will be zero. */
+ if (eltoff > strelts)
+ return ssize_int (0);
+
/* Use strlen to search for the first zero byte. Since any strings
constructed with build_string will have nulls appended, we win even
if we get handed something like (char[4])"abcd".
@@ -691,7 +698,7 @@ c_strlen (tree src, int only_value)
Since ELTOFF is our starting index into the string, no further
calculation is needed. */
unsigned len = string_length (ptr + eltoff * eltsize, eltsize,
- maxelts - eltoff);
+ strelts - eltoff);
return ssize_int (len);
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 1113bd3..805f180 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -58,7 +58,7 @@ extern bool get_pointer_alignment_1 (tree, unsigned int *,
unsigned HOST_WIDE_INT *);
extern unsigned int get_pointer_alignment (tree);
extern unsigned string_length (const void*, unsigned, unsigned);
-extern tree c_strlen (tree, int);
+extern tree c_strlen (tree, int, unsigned = 1);
extern void expand_builtin_setjmp_setup (rtx, rtx);
extern void expand_builtin_setjmp_receiver (rtx);
extern void expand_builtin_update_setjmp_buf (rtx);
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index d293d99..93b1ba1 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,37 @@
+2018-08-17 Nathan Sidwell <nathan@acm.org>
+
+ * c-ada-spec.c: Don't #include "cpp-id-data.h"
+ * c-cppbuiltin.c: Likewise.
+
+2018-08-17 Martin Liska <mliska@suse.cz>
+
+ * c.opt: Remove Warn, Init and Report for options with
+ Ignore/Deprecated flag. Warning is done automatically for
+ Deprecated flags.
+
+2018-08-16 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/70693
+ * c-common.c (selftest::c_family_tests): Call
+ selftest::c_indentation_c_tests.
+ * c-common.h (selftest::c_indentation_c_tests): New decl.
+ * c-indentation.c: Include "selftest.h".
+ (next_tab_stop): Add "tab_width" param, rather than accessing
+ cpp_opts.
+ (get_visual_column): Likewise. Clarify comment. Bulletproof
+ against reading past the end of the line.
+ (get_first_nws_vis_column): Add "tab_width" param.
+ (detect_intervening_unindent): Likewise.
+ (should_warn_for_misleading_indentation): Read tab width from
+ cpp_opts and pass around.
+ (selftest::test_next_tab_stop): New test.
+ (selftest::assert_get_visual_column_succeeds): New function.
+ (ASSERT_GET_VISUAL_COLUMN_SUCCEEDS): New macro.
+ (selftest::assert_get_visual_column_fails): New function.
+ (ASSERT_GET_VISUAL_COLUMN_FAILS): New macro.
+ (selftest::test_get_visual_column): New test.
+ (selftest::c_indentation_c_tests): New function.
+
2018-08-16 Nathan Sidwell <nathan@acm.org>
* c-ada-spec.c (count_ada_macro): Use cpp_user_macro_p.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 55b2e50..95cff21 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8370,6 +8370,7 @@ c_family_tests (void)
{
c_common_c_tests ();
c_format_c_tests ();
+ c_indentation_c_tests ();
c_pretty_print_c_tests ();
c_spellcheck_cc_tests ();
}
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 8a802bb..9b05e60 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1338,6 +1338,7 @@ namespace selftest {
/* Declarations for specific families of tests within c-family,
by source file, in alphabetical order. */
extern void c_format_c_tests (void);
+ extern void c_indentation_c_tests (void);
extern void c_pretty_print_c_tests (void);
extern void c_spellcheck_cc_tests (void);
diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c
index 44b1e1e..436d61b 100644
--- a/gcc/c-family/c-indentation.c
+++ b/gcc/c-family/c-indentation.c
@@ -23,15 +23,15 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "c-common.h"
#include "c-indentation.h"
+#include "selftest.h"
extern cpp_options *cpp_opts;
/* Round up VIS_COLUMN to nearest tab stop. */
static unsigned int
-next_tab_stop (unsigned int vis_column)
+next_tab_stop (unsigned int vis_column, unsigned int tab_width)
{
- const unsigned int tab_width = cpp_opts->tabstop;
vis_column = ((vis_column + tab_width) / tab_width) * tab_width;
return vis_column;
}
@@ -43,12 +43,13 @@ next_tab_stop (unsigned int vis_column)
Returns true if a conversion was possible, writing the result to OUT,
otherwise returns false. If FIRST_NWS is not NULL, then write to it
the visual column corresponding to the first non-whitespace character
- on the line. */
+ on the line (up to or before EXPLOC). */
static bool
get_visual_column (expanded_location exploc, location_t loc,
unsigned int *out,
- unsigned int *first_nws)
+ unsigned int *first_nws,
+ unsigned int tab_width)
{
/* PR c++/68819: if the column number is zero, we presumably
had a location_t > LINE_MAP_MAX_LOCATION_WITH_COLS, and so
@@ -73,6 +74,8 @@ get_visual_column (expanded_location exploc, location_t loc,
char_span line = location_get_source_line (exploc.file, exploc.line);
if (!line)
return false;
+ if ((size_t)exploc.column > line.length ())
+ return false;
unsigned int vis_column = 0;
for (int i = 1; i < exploc.column; i++)
{
@@ -85,7 +88,7 @@ get_visual_column (expanded_location exploc, location_t loc,
}
if (ch == '\t')
- vis_column = next_tab_stop (vis_column);
+ vis_column = next_tab_stop (vis_column, tab_width);
else
vis_column++;
}
@@ -106,7 +109,8 @@ get_visual_column (expanded_location exploc, location_t loc,
static bool
get_first_nws_vis_column (const char *file, int line_num,
- unsigned int *first_nws)
+ unsigned int *first_nws,
+ unsigned int tab_width)
{
gcc_assert (first_nws);
@@ -125,7 +129,7 @@ get_first_nws_vis_column (const char *file, int line_num,
}
if (ch == '\t')
- vis_column = next_tab_stop (vis_column);
+ vis_column = next_tab_stop (vis_column, tab_width);
else
vis_column++;
}
@@ -178,7 +182,8 @@ static bool
detect_intervening_unindent (const char *file,
int body_line,
int next_stmt_line,
- unsigned int vis_column)
+ unsigned int vis_column,
+ unsigned int tab_width)
{
gcc_assert (file);
gcc_assert (next_stmt_line > body_line);
@@ -186,7 +191,7 @@ detect_intervening_unindent (const char *file,
for (int line = body_line + 1; line < next_stmt_line; line++)
{
unsigned int line_vis_column;
- if (get_first_nws_vis_column (file, line, &line_vis_column))
+ if (get_first_nws_vis_column (file, line, &line_vis_column, tab_width))
if (line_vis_column < vis_column)
return true;
}
@@ -289,6 +294,8 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
expanded_location next_stmt_exploc = expand_location (next_stmt_loc);
expanded_location guard_exploc = expand_location (guard_loc);
+ const unsigned int tab_width = cpp_opts->tabstop;
+
/* They must be in the same file. */
if (next_stmt_exploc.file != body_exploc.file)
return false;
@@ -334,7 +341,7 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
unsigned int guard_line_first_nws;
if (!get_visual_column (guard_exploc, guard_loc,
&guard_vis_column,
- &guard_line_first_nws))
+ &guard_line_first_nws, tab_width))
return false;
/* Heuristic: only warn if the guard is the first thing
on its line. */
@@ -394,15 +401,15 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
it's not clear that it's meaningful to look at indentation. */
if (!get_visual_column (next_stmt_exploc, next_stmt_loc,
&next_stmt_vis_column,
- &next_stmt_line_first_nws))
+ &next_stmt_line_first_nws, tab_width))
return false;
if (!get_visual_column (body_exploc, body_loc,
&body_vis_column,
- &body_line_first_nws))
+ &body_line_first_nws, tab_width))
return false;
if (!get_visual_column (guard_exploc, guard_loc,
&guard_vis_column,
- &guard_line_first_nws))
+ &guard_line_first_nws, tab_width))
return false;
/* If the line where the next stmt starts has non-whitespace
@@ -486,7 +493,7 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
int vis_column = MIN (next_stmt_vis_column, body_vis_column);
if (detect_intervening_unindent (body_exploc.file, body_exploc.line,
next_stmt_exploc.line,
- vis_column))
+ vis_column, tab_width))
return false;
/* Otherwise, they are visually aligned: issue a warning. */
@@ -611,3 +618,160 @@ warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
guard_tinfo_to_string (guard_tinfo.keyword));
}
}
+
+#if CHECKING_P
+
+namespace selftest {
+
+/* Verify that next_tab_stop works as expected. */
+
+static void
+test_next_tab_stop ()
+{
+ const unsigned int tab_width = 8;
+
+ ASSERT_EQ (next_tab_stop (0, tab_width), 8);
+ ASSERT_EQ (next_tab_stop (1, tab_width), 8);
+ ASSERT_EQ (next_tab_stop (7, tab_width), 8);
+
+ ASSERT_EQ (next_tab_stop (8, tab_width), 16);
+ ASSERT_EQ (next_tab_stop (9, tab_width), 16);
+ ASSERT_EQ (next_tab_stop (15, tab_width), 16);
+
+ ASSERT_EQ (next_tab_stop (16, tab_width), 24);
+ ASSERT_EQ (next_tab_stop (17, tab_width), 24);
+ ASSERT_EQ (next_tab_stop (23, tab_width), 24);
+}
+
+/* Verify that the given call to get_visual_column succeeds, with
+ the given results. */
+
+static void
+assert_get_visual_column_succeeds (const location &loc,
+ const char *file, int line, int column,
+ const unsigned int tab_width,
+ unsigned int expected_visual_column,
+ unsigned int expected_first_nws)
+{
+ expanded_location exploc;
+ exploc.file = file;
+ exploc.line = line;
+ exploc.column = column;
+ exploc.data = NULL;
+ exploc.sysp = false;
+ unsigned int actual_visual_column;
+ unsigned int actual_first_nws;
+ bool result = get_visual_column (exploc, UNKNOWN_LOCATION,
+ &actual_visual_column,
+ &actual_first_nws, tab_width);
+ ASSERT_TRUE_AT (loc, result);
+ ASSERT_EQ_AT (loc, actual_visual_column, expected_visual_column);
+ ASSERT_EQ_AT (loc, actual_first_nws, expected_first_nws);
+}
+
+/* Verify that the given call to get_visual_column succeeds, with
+ the given results. */
+
+#define ASSERT_GET_VISUAL_COLUMN_SUCCEEDS(FILENAME, LINE, COLUMN, \
+ TAB_WIDTH, \
+ EXPECTED_VISUAL_COLUMN, \
+ EXPECTED_FIRST_NWS) \
+ SELFTEST_BEGIN_STMT \
+ assert_get_visual_column_succeeds (SELFTEST_LOCATION, \
+ FILENAME, LINE, COLUMN, \
+ TAB_WIDTH, \
+ EXPECTED_VISUAL_COLUMN, \
+ EXPECTED_FIRST_NWS); \
+ SELFTEST_END_STMT
+
+/* Verify that the given call to get_visual_column fails gracefully. */
+
+static void
+assert_get_visual_column_fails (const location &loc,
+ const char *file, int line, int column,
+ const unsigned int tab_width)
+{
+ expanded_location exploc;
+ exploc.file = file;
+ exploc.line = line;
+ exploc.column = column;
+ exploc.data = NULL;
+ exploc.sysp = false;
+ unsigned int actual_visual_column;
+ unsigned int actual_first_nws;
+ bool result = get_visual_column (exploc, UNKNOWN_LOCATION,
+ &actual_visual_column,
+ &actual_first_nws, tab_width);
+ ASSERT_FALSE_AT (loc, result);
+}
+
+/* Verify that the given call to get_visual_column fails gracefully. */
+
+#define ASSERT_GET_VISUAL_COLUMN_FAILS(FILENAME, LINE, COLUMN, \
+ TAB_WIDTH) \
+ SELFTEST_BEGIN_STMT \
+ assert_get_visual_column_fails (SELFTEST_LOCATION, \
+ FILENAME, LINE, COLUMN, \
+ TAB_WIDTH); \
+ SELFTEST_END_STMT
+
+/* Verify that get_visual_column works as expected. */
+
+static void
+test_get_visual_column ()
+{
+ /* Create a tempfile with a mixture of tabs and spaces.
+
+ Both lines have either a space or a tab, then " line N",
+ for 8 characters in total.
+
+ 1-based "columns" (w.r.t. to line 1):
+ .....................0000000001111.
+ .....................1234567890123. */
+ const char *content = (" line 1\n"
+ "\t line 2\n");
+ line_table_test ltt;
+ temp_source_file tmp (SELFTEST_LOCATION, ".txt", content);
+
+ const unsigned int tab_width = 8;
+ const char *file = tmp.get_filename ();
+
+ /* Line 1 (space-based indentation). */
+ {
+ const int line = 1;
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 1, tab_width, 0, 0);
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 2, tab_width, 1, 1);
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 3, tab_width, 2, 2);
+ /* first_nws should have stopped increasing. */
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 4, tab_width, 3, 2);
+ /* Verify the end-of-line boundary. */
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 8, tab_width, 7, 2);
+ ASSERT_GET_VISUAL_COLUMN_FAILS (file, line, 9, tab_width);
+ }
+
+ /* Line 2 (tab-based indentation). */
+ {
+ const int line = 2;
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 1, tab_width, 0, 0);
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 2, tab_width, 8, 8);
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 3, tab_width, 9, 9);
+ /* first_nws should have stopped increasing. */
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 4, tab_width, 10, 9);
+ /* Verify the end-of-line boundary. */
+ ASSERT_GET_VISUAL_COLUMN_SUCCEEDS (file, line, 8, tab_width, 14, 9);
+ ASSERT_GET_VISUAL_COLUMN_FAILS (file, line, 9, tab_width);
+ }
+}
+
+/* Run all of the selftests within this file. */
+
+void
+c_indentation_c_tests ()
+{
+ test_next_tab_stop ();
+ test_get_visual_column ();
+}
+
+} // namespace selftest
+
+#endif /* CHECKING_P */
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index d614838..9980bfa 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -413,7 +413,7 @@ C ObjC C++ ObjC++ Var(warn_char_subscripts) Warning LangEnabledBy(C ObjC C++ Obj
Warn about subscripts whose type is \"char\".
Wchkp
-C ObjC C++ ObjC++ Var(warn_chkp) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Deprecated
+C ObjC C++ ObjC++ Warning Deprecated
Deprecated in GCC 9. This switch has no effect.
Wclobbered
@@ -820,7 +820,7 @@ C ObjC Var(warn_missing_prototypes) Warning
Warn about global functions without prototypes.
Wmudflap
-C ObjC C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C ObjC C++ ObjC++ Deprecated
Wmultichar
C ObjC C++ ObjC++ CPP(warn_multichar) CppReason(CPP_W_MULTICHAR) Var(cpp_warn_multichar) Init(0) Warning
@@ -1238,14 +1238,14 @@ C++ ObjC++ Joined RejectNegative Var(aligned_new_threshold) UInteger Init(-1)
-faligned-new=<N> Use C++17 over-aligned type allocation for alignments greater than N.
fall-virtual
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fallow-parameterless-variadic-functions
C ObjC Var(flag_allow_parameterless_variadic_functions)
Allow variadic functions without named parameter.
falt-external-templates
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
No longer supported.
fasm
@@ -1268,78 +1268,78 @@ C ObjC C++ ObjC++
Where shorter, use canonicalized paths to systems headers.
fcheck-pointer-bounds
-C ObjC C++ ObjC++ LTO Report Var(flag_check_pointer_bounds) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-check-incomplete-type
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_incomplete_type) Init(1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-zero-input-bounds-for-main
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_zero_input_bounds_for_main) Init(0) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-first-field-has-own-bounds
-C ObjC C++ ObjC++ LTO RejectNegative Report Var(flag_chkp_first_field_has_own_bounds) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated RejectNegative
Deprecated in GCC 9. This switch has no effect.
fchkp-narrow-bounds
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_narrow_bounds) Init(1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-narrow-to-innermost-array
-C ObjC C++ ObjC++ LTO RejectNegative Report Var(flag_chkp_narrow_to_innermost_arrray) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated RejectNegative
Deprecated in GCC 9. This switch has no effect.
fchkp-flexible-struct-trailing-arrays
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_flexible_struct_trailing_arrays) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-optimize
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_optimize) Init(-1)
+C ObjC C++ ObjC++ LTO Deprecated
fchkp-use-fast-string-functions
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_fast_string_functions) Init(0) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-use-nochk-string-functions
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_nochk_string_functions) Init(0) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-use-static-bounds
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_static_bounds) Init(1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-use-static-const-bounds
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_static_const_bounds) Init(-1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-treat-zero-dynamic-size-as-infinite
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_zero_dynamic_size_as_infinite) Init(0) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-check-read
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_check_read) Init(1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-check-write
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_check_write) Init(1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-store-bounds
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_store_bounds) Init(1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-instrument-calls
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_instrument_calls) Init(1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-instrument-marked-only
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_instrument_marked_only) Init(0) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
fchkp-use-wrappers
-C ObjC C++ ObjC++ LTO Report Var(flag_chkp_use_wrappers) Init(1) Deprecated
+C ObjC C++ ObjC++ LTO Deprecated
Deprecated in GCC 9. This switch has no effect.
static-libmpx
@@ -1350,8 +1350,8 @@ static-libmpxwrappers
Driver Deprecated
Deprecated in GCC 9. This switch has no effect.
-fcilkplus Undocumented
-C ObjC C++ ObjC++ LTO Report Var(flag_cilkplus) Init(0)
+fcilkplus
+C ObjC C++ ObjC++ LTO Undocumented Ignore
Deprecated in GCC 8. This switch has no effect.
fconcepts
@@ -1363,7 +1363,7 @@ C ObjC C++ ObjC++
Allow the arguments of the '?' operator to have different types.
fconserve-space
-C++ ObjC++ Var(flag_conserve_space)
+C++ ObjC++ Ignore
Does nothing. Preserved for backward compatibility.
fconstant-string-class=
@@ -1430,7 +1430,7 @@ C++ ObjC++ Var(flag_enforce_eh_specs) Init(1)
Generate code to check exception specifications.
fenum-int-equiv
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fexec-charset=
C ObjC C++ ObjC++ Joined RejectNegative
@@ -1449,10 +1449,10 @@ C++ ObjC++ Var(flag_extern_tls_init) Init(-1)
Support dynamic initialization of thread-local variables in a different translation unit.
fexternal-templates
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
ffor-scope
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
ffreestanding
C ObjC C++ ObjC++
@@ -1471,20 +1471,20 @@ C ObjC Var(flag_gnu89_inline) Init(-1)
Use traditional GNU semantics for inline functions.
fguiding-decls
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fhandle-exceptions
C++ ObjC++ Optimization Alias(fexceptions) Warn({-fhandle-exceptions has been renamed -fexceptions (and is now on by default)})
fhonor-std
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fhosted
C ObjC
Assume normal C execution environment.
fhuge-objects
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
No longer supported.
fimplement-inlines
@@ -1504,14 +1504,14 @@ C++ ObjC++ Var(flag_new_inheriting_ctors) Init(1)
Implement C++17 inheriting constructor semantics.
ffriend-injection
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fkeep-inline-dllexport
C C++ ObjC ObjC++ Var(flag_keep_inline_dllexport) Init(1) Report Condition(TARGET_DLLIMPORT_DECL_ATTRIBUTES)
Don't emit dllexported inline functions unless needed.
flabels-ok
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
flax-vector-conversions
C ObjC C++ ObjC++ Var(flag_lax_vector_conversions)
@@ -1522,19 +1522,19 @@ C ObjC C++ ObjC++ Var(flag_ms_extensions)
Don't warn about uses of Microsoft extensions.
fmudflap
-C ObjC C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C ObjC C++ ObjC++ Deprecated
fmudflapth
-C ObjC C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C ObjC C++ ObjC++ Deprecated
fmudflapir
-C ObjC C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C ObjC C++ ObjC++ Deprecated
fname-mangling-version-
-C++ ObjC++ Joined Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Joined Deprecated
fnew-abi
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fnew-ttp-matching
C++ ObjC++ Var(flag_new_ttp)
@@ -1575,7 +1575,7 @@ fnonansi-builtins
C++ ObjC++ Var(flag_no_nonansi_builtin, 0)
fnonnull-objects
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fnothrow-opt
C++ ObjC++ Optimization Var(flag_nothrow_opt)
@@ -1710,7 +1710,7 @@ C++ ObjC++ Var(flag_sized_deallocation) Init(-1)
Enable C++14 sized deallocation support.
fsquangle
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fsso-struct=
C ObjC Joined RejectNegative Enum(sso_struct) Var(default_sso) Init(SSO_NATIVE)
@@ -1737,7 +1737,7 @@ C++ ObjC++ Optimization Var(flag_strict_enums)
Assume that values of enumeration type are always within the minimum range of that type.
fstrict-prototype
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fstrong-eval-order
C++ ObjC++ Common Alias(fstrong-eval-order=, all, none)
@@ -1777,7 +1777,7 @@ C++ ObjC++ Joined RejectNegative UInteger
-ftemplate-depth=<number> Specify maximum template instantiation depth.
fthis-is-variable
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
fthreadsafe-statics
C++ ObjC++ Optimization Var(flag_threadsafe_statics) Init(1)
@@ -1808,11 +1808,11 @@ C++ ObjC++ Var(flag_visibility_ms_compat)
Changes visibility to match Microsoft Visual Studio by default.
fvtable-gc
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
No longer supported.
fvtable-thunks
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
No longer supported.
fweak
@@ -1828,7 +1828,7 @@ C ObjC C++ ObjC++ Var(flag_working_directory) Init(-1)
Generate a #line directive pointing at the current working directory.
fxref
-C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+C++ ObjC++ Deprecated
No longer supported.
fzero-link
diff --git a/gcc/common.opt b/gcc/common.opt
index 507291f..ebc3ef4 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1087,7 +1087,7 @@ Common Report Var(flag_caller_saves) Optimization
Save registers around function calls.
fcheck-data-deps
-Common Report Var(flag_check_data_deps)
+Common Ignore
This switch is deprecated; do not use.
fcheck-new
@@ -2897,19 +2897,19 @@ Common Driver Var(dwarf2out_as_locview_support) Init(2)
Assume assembler support for view in (DWARF2+) .loc directives
gcoff
-Common Driver Ignore Warn(switch %qs no longer supported)
+Common Driver Deprecated
Does nothing. Preserved for backward compatibility.
gcoff1
-Common Driver Ignore Warn(switch %qs no longer supported)
+Common Driver Deprecated
Does nothing. Preserved for backward compatibility.
gcoff2
-Common Driver Ignore Warn(switch %qs no longer supported)
+Common Driver Deprecated
Does nothing. Preserved for backward compatibility.
gcoff3
-Common Driver Ignore Warn(switch %qs no longer supported)
+Common Driver Deprecated
Does nothing. Preserved for backward compatibility.
gcolumn-info
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index 3724994..e7fbf9b 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -842,7 +842,7 @@ Target Report Mask(ISA_CLWB) Var(ix86_isa_flags) Save
Support CLWB instruction.
mpcommit
-Target Ignore Warn(%qs was deprecated)
+Target Deprecated
;; Deprecated
mfxsr
@@ -951,7 +951,7 @@ Target Report Mask(ISA_RTM) Var(ix86_isa_flags) Save
Support RTM built-in functions and code generation.
mmpx
-Target Report Deprecated
+Target Deprecated
Deprecated in GCC 9. This switch has no effect.
mmwaitx
@@ -999,7 +999,7 @@ Target RejectNegative Joined Integer Var(ix86_stack_protector_guard_symbol_str)
Use the given symbol for addressing the stack-protector guard.
mmitigate-rop
-Target Ignore Warn(%qs was deprecated)
+Target Deprecated
;; Deprecated
mgeneral-regs-only
diff --git a/gcc/config/ia64/ia64.opt b/gcc/config/ia64/ia64.opt
index 5a8b2b8..61f2c9f 100644
--- a/gcc/config/ia64/ia64.opt
+++ b/gcc/config/ia64/ia64.opt
@@ -164,10 +164,10 @@ Target Report Var(mflag_sched_spec_control_ldc) Init(0)
Use simple data speculation check for control speculation.
msched-prefer-non-data-spec-insns
-Target Ignore Warn(switch %qs is no longer supported)
+Target Deprecated
msched-prefer-non-control-spec-insns
-Target Ignore Warn(switch %qs is no longer supported)
+Target Deprecated
msched-count-spec-in-critical-path
Target Report Var(mflag_sched_count_spec_in_critical_path) Init(0)
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 8ee42ae..3419e3a 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -413,8 +413,7 @@
(use (match_operand:SI 1 "call_operand" "s"))])]
"TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
"bl %z1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*restore_world"
[(match_parallel 0 "restore_world_operation"
@@ -441,8 +440,7 @@
(match_operand:V4SI 4 "altivec_register_operand" "v"))])]
"TARGET_ALTIVEC"
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*save_vregs_<mode>_r12"
[(match_parallel 0 "any_parallel_operand"
@@ -455,8 +453,7 @@
(match_operand:V4SI 4 "altivec_register_operand" "v"))])]
"TARGET_ALTIVEC"
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*restore_vregs_<mode>_r11"
[(match_parallel 0 "any_parallel_operand"
@@ -469,8 +466,7 @@
(match_operand:P 4 "short_cint_operand" "I"))))])]
"TARGET_ALTIVEC"
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*restore_vregs_<mode>_r12"
[(match_parallel 0 "any_parallel_operand"
@@ -483,8 +479,7 @@
(match_operand:P 4 "short_cint_operand" "I"))))])]
"TARGET_ALTIVEC"
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
;; Simple binary operations.
@@ -2047,8 +2042,7 @@
"@
vperm %0,%1,%2,%3
xxperm %x0,%x1,%x3"
- [(set_attr "type" "vecperm")
- (set_attr "length" "4")])
+ [(set_attr "type" "vecperm")])
(define_insn "altivec_vperm_v8hiv16qi"
[(set (match_operand:V16QI 0 "register_operand" "=v,?wo")
@@ -2060,8 +2054,7 @@
"@
vperm %0,%1,%2,%3
xxperm %x0,%x1,%x3"
- [(set_attr "type" "vecperm")
- (set_attr "length" "4")])
+ [(set_attr "type" "vecperm")])
(define_expand "altivec_vperm_<mode>_uns"
[(set (match_operand:VM 0 "register_operand")
@@ -2088,8 +2081,7 @@
"@
vperm %0,%1,%2,%3
xxperm %x0,%x1,%x3"
- [(set_attr "type" "vecperm")
- (set_attr "length" "4")])
+ [(set_attr "type" "vecperm")])
(define_expand "vec_permv16qi"
[(set (match_operand:V16QI 0 "register_operand")
@@ -2115,8 +2107,7 @@
"@
vpermr %0,%1,%2,%3
xxpermr %x0,%x1,%x3"
- [(set_attr "type" "vecperm")
- (set_attr "length" "4")])
+ [(set_attr "type" "vecperm")])
(define_insn "altivec_vrfip" ; ceil
[(set (match_operand:V4SF 0 "register_operand" "=v")
@@ -3273,8 +3264,7 @@
"@
vperm %0,%1,%2,%3
xxperm %x0,%x1,%x3"
- [(set_attr "type" "vecperm")
- (set_attr "length" "4")])
+ [(set_attr "type" "vecperm")])
(define_insn "vperm_v16qiv8hi"
[(set (match_operand:V8HI 0 "register_operand" "=v,?wo")
@@ -3286,8 +3276,7 @@
"@
vperm %0,%1,%2,%3
xxperm %x0,%x1,%x3"
- [(set_attr "type" "vecperm")
- (set_attr "length" "4")])
+ [(set_attr "type" "vecperm")])
(define_expand "vec_unpacku_hi_v16qi"
@@ -3862,8 +3851,7 @@
(clz:VI2 (match_operand:VI2 1 "register_operand" "v")))]
"TARGET_P8_VECTOR"
"vclz<wd> %0,%1"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
;; Vector absolute difference unsigned
(define_expand "vadu<mode>3"
@@ -3889,8 +3877,7 @@
(ctz:VI2 (match_operand:VI2 1 "register_operand" "v")))]
"TARGET_P9_VECTOR"
"vctz<wd> %0,%1"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
;; Vector population count
(define_insn "*p8v_popcount<mode>2"
@@ -3898,8 +3885,7 @@
(popcount:VI2 (match_operand:VI2 1 "register_operand" "v")))]
"TARGET_P8_VECTOR"
"vpopcnt<wd> %0,%1"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
;; Vector parity
(define_insn "*p9v_parity<mode>2"
@@ -3907,8 +3893,7 @@
(parity:VParity (match_operand:VParity 1 "register_operand" "v")))]
"TARGET_P9_VECTOR"
"vprtyb<wd> %0,%1"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
;; Vector Gather Bits by Bytes by Doubleword
(define_insn "p8v_vgbbd"
@@ -3917,8 +3902,7 @@
UNSPEC_VGBBD))]
"TARGET_P8_VECTOR"
"vgbbd %0,%1"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
;; 128-bit binary integer arithmetic
@@ -3932,8 +3916,7 @@
(match_operand:V1TI 2 "register_operand" "v")))]
"TARGET_VADDUQM"
"vadduqm %0,%1,%2"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "altivec_vaddcuq"
[(set (match_operand:V1TI 0 "register_operand" "=v")
@@ -3942,8 +3925,7 @@
UNSPEC_VADDCUQ))]
"TARGET_VADDUQM"
"vaddcuq %0,%1,%2"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "altivec_vsubuqm"
[(set (match_operand:V1TI 0 "register_operand" "=v")
@@ -3951,8 +3933,7 @@
(match_operand:V1TI 2 "register_operand" "v")))]
"TARGET_VADDUQM"
"vsubuqm %0,%1,%2"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "altivec_vsubcuq"
[(set (match_operand:V1TI 0 "register_operand" "=v")
@@ -3961,8 +3942,7 @@
UNSPEC_VSUBCUQ))]
"TARGET_VADDUQM"
"vsubcuq %0,%1,%2"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "altivec_vaddeuqm"
[(set (match_operand:V1TI 0 "register_operand" "=v")
@@ -3972,8 +3952,7 @@
UNSPEC_VADDEUQM))]
"TARGET_VADDUQM"
"vaddeuqm %0,%1,%2,%3"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "altivec_vaddecuq"
[(set (match_operand:V1TI 0 "register_operand" "=v")
@@ -3983,8 +3962,7 @@
UNSPEC_VADDECUQ))]
"TARGET_VADDUQM"
"vaddecuq %0,%1,%2,%3"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "altivec_vsubeuqm"
[(set (match_operand:V1TI 0 "register_operand" "=v")
@@ -3994,8 +3972,7 @@
UNSPEC_VSUBEUQM))]
"TARGET_VADDUQM"
"vsubeuqm %0,%1,%2,%3"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "altivec_vsubecuq"
[(set (match_operand:V1TI 0 "register_operand" "=v")
@@ -4005,8 +3982,7 @@
UNSPEC_VSUBECUQ))]
"TARGET_VADDUQM"
"vsubecuq %0,%1,%2,%3"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
;; We use V2DI as the output type to simplify converting the permute
;; bits into an integer
@@ -4098,8 +4074,7 @@
(clobber (reg:CCFP CR6_REGNO))]
"TARGET_P8_VECTOR"
"bcd<bcd_add_sub>. %0,%1,%2,%3"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
;; Use a floating point type (V2DFmode) for the compare to set CR6 so that we
;; can use the unordered test for BCD nans and add/subtracts that overflow. An
@@ -4117,8 +4092,7 @@
(clobber (match_scratch:V1TI 0 "=v"))]
"TARGET_P8_VECTOR"
"bcd<bcd_add_sub>. %0,%1,%2,%3"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "*bcd<bcd_add_sub>_test2"
[(set (match_operand:V1TI 0 "register_operand" "=v")
@@ -4135,8 +4109,7 @@
(match_operand:V2DF 4 "zero_constant" "j")))]
"TARGET_P8_VECTOR"
"bcd<bcd_add_sub>. %0,%1,%2,%3"
- [(set_attr "length" "4")
- (set_attr "type" "vecsimple")])
+ [(set_attr "type" "vecsimple")])
(define_insn "darn_32"
[(set (match_operand:SI 0 "register_operand" "=r")
diff --git a/gcc/config/rs6000/darwin.md b/gcc/config/rs6000/darwin.md
index 48fd5b96..37acb31 100644
--- a/gcc/config/rs6000/darwin.md
+++ b/gcc/config/rs6000/darwin.md
@@ -23,8 +23,7 @@ You should have received a copy of the GNU General Public License
(plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
(high:DI (match_operand 2 "" ""))))]
"TARGET_MACHO && TARGET_64BIT"
- "addis %0,%1,ha16(%2)"
- [(set_attr "length" "4")])
+ "addis %0,%1,ha16(%2)")
(define_insn "movdf_low_si"
[(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
@@ -72,8 +71,7 @@ You should have received a copy of the GNU General Public License
gcc_unreachable ();
}
}
- [(set_attr "type" "load")
- (set_attr "length" "4,4")])
+ [(set_attr "type" "load")])
(define_insn "movdf_low_st_si"
[(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
@@ -81,8 +79,7 @@ You should have received a copy of the GNU General Public License
(match_operand:DF 0 "gpc_reg_operand" "f"))]
"TARGET_MACHO && TARGET_HARD_FLOAT && ! TARGET_64BIT"
"stfd %0,lo16(%2)(%1)"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
+ [(set_attr "type" "store")])
(define_insn "movdf_low_st_di"
[(set (mem:DF (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
@@ -90,8 +87,7 @@ You should have received a copy of the GNU General Public License
(match_operand:DF 0 "gpc_reg_operand" "f"))]
"TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_64BIT"
"stfd %0,lo16(%2)(%1)"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
+ [(set_attr "type" "store")])
(define_insn "movsf_low_si"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
@@ -101,8 +97,7 @@ You should have received a copy of the GNU General Public License
"@
lfs %0,lo16(%2)(%1)
lwz %0,lo16(%2)(%1)"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
+ [(set_attr "type" "load")])
(define_insn "movsf_low_di"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
@@ -112,8 +107,7 @@ You should have received a copy of the GNU General Public License
"@
lfs %0,lo16(%2)(%1)
lwz %0,lo16(%2)(%1)"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
+ [(set_attr "type" "load")])
(define_insn "movsf_low_st_si"
[(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
@@ -123,8 +117,7 @@ You should have received a copy of the GNU General Public License
"@
stfs %0,lo16(%2)(%1)
stw %0,lo16(%2)(%1)"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
+ [(set_attr "type" "store")])
(define_insn "movsf_low_st_di"
[(set (mem:SF (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,b")
@@ -134,8 +127,7 @@ You should have received a copy of the GNU General Public License
"@
stfs %0,lo16(%2)(%1)
stw %0,lo16(%2)(%1)"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
+ [(set_attr "type" "store")])
;; 64-bit MachO load/store support
(define_insn "movdi_low"
@@ -146,8 +138,7 @@ You should have received a copy of the GNU General Public License
"@
ld %0,lo16(%2)(%1)
lfd %0,lo16(%2)(%1)"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
+ [(set_attr "type" "load")])
(define_insn "movsi_low_st"
[(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
@@ -155,8 +146,7 @@ You should have received a copy of the GNU General Public License
(match_operand:SI 0 "gpc_reg_operand" "r"))]
"TARGET_MACHO && ! TARGET_64BIT"
"stw %0,lo16(%2)(%1)"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
+ [(set_attr "type" "store")])
(define_insn "movdi_low_st"
[(set (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,b")
@@ -166,8 +156,7 @@ You should have received a copy of the GNU General Public License
"@
std %0,lo16(%2)(%1)
stfd %0,lo16(%2)(%1)"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
+ [(set_attr "type" "store")])
;; Mach-O PIC trickery.
(define_expand "macho_high"
@@ -263,8 +252,7 @@ You should have received a copy of the GNU General Public License
return "bcl 20,31,%0\n%0:";
}
[(set_attr "type" "branch")
- (set_attr "cannot_copy" "yes")
- (set_attr "length" "4")])
+ (set_attr "cannot_copy" "yes")])
(define_insn "load_macho_picbase_di"
[(set (reg:DI LR_REGNO)
@@ -280,8 +268,7 @@ You should have received a copy of the GNU General Public License
return "bcl 20,31,%0\n%0:";
}
[(set_attr "type" "branch")
- (set_attr "cannot_copy" "yes")
- (set_attr "length" "4")])
+ (set_attr "cannot_copy" "yes")])
(define_expand "macho_correct_pic"
[(set (match_operand 0 "")
@@ -416,8 +403,7 @@ You should have received a copy of the GNU General Public License
return "bcl 20,31,%0\n%0:";
}
[(set_attr "type" "branch")
- (set_attr "cannot_copy" "yes")
- (set_attr "length" "4")])
+ (set_attr "cannot_copy" "yes")])
(define_insn "reload_macho_picbase_di"
[(set (reg:DI LR_REGNO)
@@ -440,8 +426,7 @@ You should have received a copy of the GNU General Public License
return "bcl 20,31,%0\n%0:";
}
[(set_attr "type" "branch")
- (set_attr "cannot_copy" "yes")
- (set_attr "length" "4")])
+ (set_attr "cannot_copy" "yes")])
;; We need to restore the PIC register, at the site of nonlocal label.
diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md
index cd15aa8..9bc98f9 100644
--- a/gcc/config/rs6000/dfp.md
+++ b/gcc/config/rs6000/dfp.md
@@ -37,8 +37,7 @@
|| gpc_reg_operand (operands[1], SDmode))
&& TARGET_HARD_FLOAT"
"stfd%U0%X0 %1,%0"
- [(set_attr "type" "fpstore")
- (set_attr "length" "4")])
+ [(set_attr "type" "fpstore")])
(define_insn "movsd_load"
[(set (match_operand:SD 0 "nonimmediate_operand" "=f")
@@ -48,8 +47,7 @@
|| gpc_reg_operand (operands[1], DDmode))
&& TARGET_HARD_FLOAT"
"lfd%U1%X1 %0,%1"
- [(set_attr "type" "fpload")
- (set_attr "length" "4")])
+ [(set_attr "type" "fpload")])
;; Hardware support for decimal floating point operations.
diff --git a/gcc/config/rs6000/htm.md b/gcc/config/rs6000/htm.md
index 44a52c5..96c8288 100644
--- a/gcc/config/rs6000/htm.md
+++ b/gcc/config/rs6000/htm.md
@@ -72,8 +72,7 @@
(set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"tabort. %0"
- [(set_attr "type" "htmsimple")
- (set_attr "length" "4")])
+ [(set_attr "type" "htmsimple")])
(define_expand "tabort<wd>c"
[(parallel
@@ -98,8 +97,7 @@
(set (match_operand:BLK 4) (unspec:BLK [(match_dup 4)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"tabort<wd>c. %0,%1,%2"
- [(set_attr "type" "htmsimple")
- (set_attr "length" "4")])
+ [(set_attr "type" "htmsimple")])
(define_expand "tabort<wd>ci"
[(parallel
@@ -124,8 +122,7 @@
(set (match_operand:BLK 4) (unspec:BLK [(match_dup 4)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"tabort<wd>ci. %0,%1,%2"
- [(set_attr "type" "htmsimple")
- (set_attr "length" "4")])
+ [(set_attr "type" "htmsimple")])
(define_expand "tbegin"
[(parallel
@@ -146,8 +143,7 @@
(set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"tbegin. %0"
- [(set_attr "type" "htm")
- (set_attr "length" "4")])
+ [(set_attr "type" "htm")])
(define_expand "tcheck"
[(parallel
@@ -166,8 +162,7 @@
(set (match_operand:BLK 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"tcheck %0"
- [(set_attr "type" "htm")
- (set_attr "length" "4")])
+ [(set_attr "type" "htm")])
(define_expand "tend"
[(parallel
@@ -188,8 +183,7 @@
(set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"tend. %0"
- [(set_attr "type" "htm")
- (set_attr "length" "4")])
+ [(set_attr "type" "htm")])
(define_expand "trechkpt"
[(parallel
@@ -208,8 +202,7 @@
(set (match_operand:BLK 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"trechkpt."
- [(set_attr "type" "htmsimple")
- (set_attr "length" "4")])
+ [(set_attr "type" "htmsimple")])
(define_expand "treclaim"
[(parallel
@@ -230,8 +223,7 @@
(set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"treclaim. %0"
- [(set_attr "type" "htmsimple")
- (set_attr "length" "4")])
+ [(set_attr "type" "htmsimple")])
(define_expand "tsr"
[(parallel
@@ -252,8 +244,7 @@
(set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"tsr. %0"
- [(set_attr "type" "htmsimple")
- (set_attr "length" "4")])
+ [(set_attr "type" "htmsimple")])
(define_expand "ttest"
[(parallel
@@ -272,8 +263,7 @@
(set (match_operand:BLK 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))]
"TARGET_HTM"
"tabortwci. 0,1,0"
- [(set_attr "type" "htmsimple")
- (set_attr "length" "4")])
+ [(set_attr "type" "htmsimple")])
(define_insn "htm_mfspr_<mode>"
[(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
@@ -282,8 +272,7 @@
UNSPECV_HTM_MFSPR))]
"TARGET_HTM"
"mfspr %0,%1";
- [(set_attr "type" "htm")
- (set_attr "length" "4")])
+ [(set_attr "type" "htm")])
(define_insn "htm_mtspr_<mode>"
[(set (match_operand:GPR 2 "htm_spr_reg_operand" "")
@@ -292,5 +281,4 @@
UNSPECV_HTM_MTSPR))]
"TARGET_HTM"
"mtspr %1,%0";
- [(set_attr "type" "htm")
- (set_attr "length" "4")])
+ [(set_attr "type" "htm")])
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index d70b01b..c691952 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -243,18 +243,8 @@
;; Is copying of this instruction disallowed?
(define_attr "cannot_copy" "no,yes" (const_string "no"))
-;; Length (in bytes).
-; '(pc)' in the following doesn't include the instruction itself; it is
-; calculated as if the instruction had zero size.
-(define_attr "length" ""
- (if_then_else (eq_attr "type" "branch")
- (if_then_else (and (ge (minus (match_dup 0) (pc))
- (const_int -32768))
- (lt (minus (match_dup 0) (pc))
- (const_int 32764)))
- (const_int 4)
- (const_int 8))
- (const_int 4)))
+;; Length of the instruction (in bytes).
+(define_attr "length" "" (const_int 4))
;; Processor type -- this attribute must exactly match the processor_type
;; enumeration in rs6000-opts.h.
@@ -2388,8 +2378,7 @@
(bswap:HSI (match_operand:HSI 1 "memory_operand" "Z"))))]
"TARGET_POWERPC64"
"l<wd>brx %0,%y1"
- [(set_attr "length" "4")
- (set_attr "type" "load")])
+ [(set_attr "type" "load")])
(define_insn "*bswaphi2_extendsi"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
@@ -2397,8 +2386,7 @@
(bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
""
"lhbrx %0,%y1"
- [(set_attr "length" "4")
- (set_attr "type" "load")])
+ [(set_attr "type" "load")])
;; Separate the bswap patterns into load, store, and gpr<-gpr. This prevents
;; the register allocator from converting a gpr<-gpr swap into a store and then
@@ -6090,8 +6078,7 @@
"@
fcfidu %0,%1
xscvuxddp %x0,%x1"
- [(set_attr "type" "fp")
- (set_attr "length" "4")])
+ [(set_attr "type" "fp")])
(define_insn_and_split "*floatunsdidf2_mem"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d,ws")
@@ -6706,8 +6693,7 @@
(match_operand 2 "" ""))))]
"TARGET_MACHO && ! TARGET_64BIT"
"lwz %0,lo16(%2)(%1)"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
+ [(set_attr "type" "load")])
;; MR LA LWZ LFIWZX LXSIWZX
;; STW STFIWX STXSIWX LI LIS
@@ -9417,8 +9403,7 @@
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGD)))]
"HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
- "addis %0,%1,%2@got@tlsgd@ha"
- [(set_attr "length" "4")])
+ "addis %0,%1,%2@got@tlsgd@ha")
(define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
@@ -9427,8 +9412,7 @@
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGD)))]
"HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
- "addi %0,%1,%2@got@tlsgd@l"
- [(set_attr "length" "4")])
+ "addi %0,%1,%2@got@tlsgd@l")
(define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
@@ -9460,8 +9444,7 @@
}
return "bl %z1(%3@tlsgd)";
}
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
@@ -9553,8 +9536,7 @@
(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
UNSPEC_TLSLD)))]
"HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
- "addis %0,%1,%&@got@tlsld@ha"
- [(set_attr "length" "4")])
+ "addis %0,%1,%&@got@tlsld@ha")
(define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
@@ -9563,8 +9545,7 @@
(match_operand:TLSmode 2 "gpc_reg_operand" "b")]
UNSPEC_TLSLD)))]
"HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
- "addi %0,%1,%&@got@tlsld@l"
- [(set_attr "length" "4")])
+ "addi %0,%1,%&@got@tlsld@l")
(define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
@@ -9594,8 +9575,7 @@
}
return "bl %z1(%&@tlsld)";
}
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
@@ -9650,8 +9630,7 @@
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGOTDTPREL)))]
"HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
- "addis %0,%1,%2@got@dtprel@ha"
- [(set_attr "length" "4")])
+ "addis %0,%1,%2@got@dtprel@ha")
(define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
@@ -9660,8 +9639,7 @@
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGOTDTPREL)))]
"HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
- "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
- [(set_attr "length" "4")])
+ "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)")
(define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
@@ -9719,8 +9697,7 @@
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGOTTPREL)))]
"HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
- "addis %0,%1,%2@got@tprel@ha"
- [(set_attr "length" "4")])
+ "addis %0,%1,%2@got@tprel@ha")
(define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
@@ -9729,8 +9706,7 @@
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGOTTPREL)))]
"HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
- "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
- [(set_attr "length" "4")])
+ "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)")
(define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
[(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
@@ -10038,8 +10014,7 @@
(unspec:SI [(const_int 0)] UNSPEC_TOC))]
"DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
"bl _GLOBAL_OFFSET_TABLE_@local-4"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_expand "load_toc_v4_PIC_1"
[(parallel [(set (reg:SI LR_REGNO)
@@ -10057,7 +10032,6 @@
&& (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
"bcl 20,31,%0\n%0:"
[(set_attr "type" "branch")
- (set_attr "length" "4")
(set_attr "cannot_copy" "yes")])
(define_insn "load_toc_v4_PIC_1_476"
@@ -10075,7 +10049,6 @@
return templ;
}
[(set_attr "type" "branch")
- (set_attr "length" "4")
(set_attr "cannot_copy" "yes")])
(define_expand "load_toc_v4_PIC_1b"
@@ -10659,8 +10632,7 @@
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
"bl %z0"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*call_value_local_aix<mode>"
[(set (match_operand 0 "" "")
@@ -10669,8 +10641,7 @@
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
"bl %z1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
;; Call to AIX abi function which may be in another module.
;; Restore the TOC pointer (r2) after the call.
@@ -11053,8 +11024,7 @@
"@
b %z0
b%T0"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*sibcall_value_aix<mode>"
[(set (match_operand 0 "" "")
@@ -11065,8 +11035,7 @@
"@
b %z1
b%T1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_expand "sibcall_epilogue"
[(use (const_int 0))]
@@ -11117,8 +11086,7 @@
(set (attr "indexed")
(if_then_else (match_operand 0 "indexed_address_mem")
(const_string "yes")
- (const_string "no")))
- (set_attr "length" "4")])
+ (const_string "no")))])
(define_insn "probe_stack_range<P:mode>"
[(set (match_operand:P 0 "register_operand" "=&r")
@@ -11613,51 +11581,6 @@
operands[10] = GEN_INT (sextc);
})
-;; The following two insns don't exist as single insns, but if we provide
-;; them, we can swap an add and compare, which will enable us to overlap more
-;; of the required delay between a compare and branch. We generate code for
-;; them by splitting.
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=y")
- (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "short_cint_operand" "i")))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
- ""
- "#"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
- (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "u_short_cint_operand" "i")))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
- ""
- "#"
- [(set_attr "length" "8")])
-
-(define_split
- [(set (match_operand:CC 3 "cc_reg_operand")
- (compare:CC (match_operand:SI 1 "gpc_reg_operand")
- (match_operand:SI 2 "short_cint_operand")))
- (set (match_operand:SI 0 "gpc_reg_operand")
- (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand")))]
- ""
- [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
-
-(define_split
- [(set (match_operand:CCUNS 3 "cc_reg_operand")
- (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand")
- (match_operand:SI 2 "u_short_cint_operand")))
- (set (match_operand:SI 0 "gpc_reg_operand")
- (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand")))]
- ""
- [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
-
;; Only need to compare second words if first words equal
(define_insn "*cmp<mode>_internal1"
[(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
@@ -12346,7 +12269,14 @@
{
return output_cbranch (operands[1], "%l0", 0, insn);
}
- [(set_attr "type" "branch")])
+ [(set_attr "type" "branch")
+ (set (attr "length")
+ (if_then_else (and (ge (minus (match_dup 0) (pc))
+ (const_int -32768))
+ (lt (minus (match_dup 0) (pc))
+ (const_int 32764)))
+ (const_int 4)
+ (const_int 8)))])
(define_insn ""
[(set (pc)
@@ -12359,8 +12289,7 @@
{
return output_cbranch (operands[0], NULL, 0, insn);
}
- [(set_attr "type" "jmpreg")
- (set_attr "length" "4")])
+ [(set_attr "type" "jmpreg")])
;; Logic on condition register values.
@@ -12716,7 +12645,17 @@
return "<bd_neg> $+8\;b %l0";
}
[(set_attr "type" "branch")
- (set_attr "length" "*,16,20,20")])
+ (set (attr "length")
+ (cond [(eq (symbol_ref "which_alternative") (const_int 0))
+ (if_then_else (and (ge (minus (match_dup 0) (pc))
+ (const_int -32768))
+ (lt (minus (match_dup 0) (pc))
+ (const_int 32764)))
+ (const_int 4)
+ (const_int 8))
+ (eq (symbol_ref "which_alternative") (const_int 1))
+ (const_int 16)]
+ (const_int 20)))])
;; Now the splitter if we could not allocate the CTR register
(define_split
@@ -12795,7 +12734,17 @@
}
}
[(set_attr "type" "branch")
- (set_attr "length" "*,16,20,20")])
+ (set (attr "length")
+ (cond [(eq (symbol_ref "which_alternative") (const_int 0))
+ (if_then_else (and (ge (minus (match_dup 0) (pc))
+ (const_int -32768))
+ (lt (minus (match_dup 0) (pc))
+ (const_int 32764)))
+ (const_int 4)
+ (const_int 8))
+ (eq (symbol_ref "which_alternative") (const_int 1))
+ (const_int 16)]
+ (const_int 20)))])
;; Now the splitter if we could not allocate the CTR register
(define_split
@@ -12968,8 +12917,7 @@
(match_operand:P 3 "gpc_reg_operand" "r"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*save_gpregs_<mode>_r12"
[(match_parallel 0 "any_parallel_operand"
@@ -12980,8 +12928,7 @@
(match_operand:P 3 "gpc_reg_operand" "r"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*save_gpregs_<mode>_r1"
[(match_parallel 0 "any_parallel_operand"
@@ -12992,8 +12939,7 @@
(match_operand:P 3 "gpc_reg_operand" "r"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*save_fpregs_<mode>_r11"
[(match_parallel 0 "any_parallel_operand"
@@ -13004,8 +12950,7 @@
(match_operand:DF 3 "gpc_reg_operand" "d"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*save_fpregs_<mode>_r12"
[(match_parallel 0 "any_parallel_operand"
@@ -13016,8 +12961,7 @@
(match_operand:DF 3 "gpc_reg_operand" "d"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*save_fpregs_<mode>_r1"
[(match_parallel 0 "any_parallel_operand"
@@ -13028,8 +12972,7 @@
(match_operand:DF 3 "gpc_reg_operand" "d"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
; This is to explain that changes to the stack pointer should
; not be moved over loads from or stores to stack memory.
@@ -13146,8 +13089,7 @@
(match_operand:P 3 "memory_operand" "m"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*restore_gpregs_<mode>_r12"
[(match_parallel 0 "any_parallel_operand"
@@ -13158,8 +13100,7 @@
(match_operand:P 3 "memory_operand" "m"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*restore_gpregs_<mode>_r1"
[(match_parallel 0 "any_parallel_operand"
@@ -13170,8 +13111,7 @@
(match_operand:P 3 "memory_operand" "m"))])]
""
"bl %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*return_and_restore_gpregs_<mode>_r11"
[(match_parallel 0 "any_parallel_operand"
@@ -13183,8 +13123,7 @@
(match_operand:P 3 "memory_operand" "m"))])]
""
"b %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*return_and_restore_gpregs_<mode>_r12"
[(match_parallel 0 "any_parallel_operand"
@@ -13196,8 +13135,7 @@
(match_operand:P 3 "memory_operand" "m"))])]
""
"b %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*return_and_restore_gpregs_<mode>_r1"
[(match_parallel 0 "any_parallel_operand"
@@ -13209,8 +13147,7 @@
(match_operand:P 3 "memory_operand" "m"))])]
""
"b %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*return_and_restore_fpregs_<mode>_r11"
[(match_parallel 0 "any_parallel_operand"
@@ -13222,8 +13159,7 @@
(match_operand:DF 3 "memory_operand" "m"))])]
""
"b %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*return_and_restore_fpregs_<mode>_r12"
[(match_parallel 0 "any_parallel_operand"
@@ -13235,8 +13171,7 @@
(match_operand:DF 3 "memory_operand" "m"))])]
""
"b %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*return_and_restore_fpregs_<mode>_r1"
[(match_parallel 0 "any_parallel_operand"
@@ -13248,8 +13183,7 @@
(match_operand:DF 3 "memory_operand" "m"))])]
""
"b %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
[(match_parallel 0 "any_parallel_operand"
@@ -13260,8 +13194,7 @@
(match_operand:DF 3 "memory_operand" "m"))])]
""
"b %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
(define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
[(match_parallel 0 "any_parallel_operand"
@@ -13272,8 +13205,7 @@
(match_operand:DF 3 "memory_operand" "m"))])]
""
"b %1"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
+ [(set_attr "type" "branch")])
; This is used in compiling the unwind routines.
(define_expand "eh_return"
@@ -13868,8 +13800,7 @@
UNSPEC_ADDG6S))]
"TARGET_POPCNTD"
"addg6s %0,%1,%2"
- [(set_attr "type" "integer")
- (set_attr "length" "4")])
+ [(set_attr "type" "integer")])
(define_insn "cdtbcd"
[(set (match_operand:SI 0 "register_operand" "=r")
@@ -13877,8 +13808,7 @@
UNSPEC_CDTBCD))]
"TARGET_POPCNTD"
"cdtbcd %0,%1"
- [(set_attr "type" "integer")
- (set_attr "length" "4")])
+ [(set_attr "type" "integer")])
(define_insn "cbcdtd"
[(set (match_operand:SI 0 "register_operand" "=r")
@@ -13886,8 +13816,7 @@
UNSPEC_CBCDTD))]
"TARGET_POPCNTD"
"cbcdtd %0,%1"
- [(set_attr "type" "integer")
- (set_attr "length" "4")])
+ [(set_attr "type" "integer")])
(define_int_iterator UNSPEC_DIV_EXTEND [UNSPEC_DIVE
UNSPEC_DIVEU])
@@ -13944,8 +13873,7 @@
operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
}
- [(set_attr "type" "fp,fpstore,mffgpr,mftgpr,store")
- (set_attr "length" "4")])
+ [(set_attr "type" "fp,fpstore,mffgpr,mftgpr,store")])
(define_insn_and_split "unpack<mode>_nodm"
[(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m")
@@ -13968,8 +13896,7 @@
operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
}
- [(set_attr "type" "fp,fpstore")
- (set_attr "length" "4")])
+ [(set_attr "type" "fp,fpstore")])
(define_insn_and_split "pack<mode>"
[(set (match_operand:FMOVE128 0 "register_operand" "=&d")
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 25a4883..b07f7f7 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -177,7 +177,7 @@ mno-string
Target RejectNegative Undocumented Ignore
mstring
-Target RejectNegative Undocumented Warn(%<-mstring%> is deprecated)
+Target RejectNegative Undocumented Deprecated
msoft-float
Target Report RejectNegative Mask(SOFT_FLOAT) Var(rs6000_isa_flags)
@@ -483,8 +483,9 @@ mcrypto
Target Report Mask(CRYPTO) Var(rs6000_isa_flags)
Use ISA 2.07 Category:Vector.AES and Category:Vector.SHA2 instructions.
+; We can't use Ignore flag because DIRECT_MOVE mask is still used.
mdirect-move
-Target Undocumented Mask(DIRECT_MOVE) Var(rs6000_isa_flags) Ignore Warn(%qs is deprecated)
+Target Undocumented Mask(DIRECT_MOVE) Var(rs6000_isa_flags) Warn(%qs is deprecated)
mhtm
Target Report Mask(HTM) Var(rs6000_isa_flags)
diff --git a/gcc/config/rs6000/sync.md b/gcc/config/rs6000/sync.md
index 74bc407..ee98049 100644
--- a/gcc/config/rs6000/sync.md
+++ b/gcc/config/rs6000/sync.md
@@ -132,8 +132,7 @@
"TARGET_SYNC_TI
&& !reg_mentioned_p (operands[0], operands[1])"
"lq %0,%1"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
+ [(set_attr "type" "load")])
(define_expand "atomic_load<mode>"
[(set (match_operand:AINT 0 "register_operand") ;; output
@@ -196,8 +195,7 @@
[(match_operand:PTI 1 "quad_int_reg_operand" "r")] UNSPEC_LSQ))]
"TARGET_SYNC_TI"
"stq %1,%0"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
+ [(set_attr "type" "store")])
(define_expand "atomic_store<mode>"
[(set (match_operand:AINT 0 "memory_operand") ;; memory
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index de2fa78..c3c099f 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -3267,8 +3267,7 @@
stfd%U0%X0 %1,%0
stxsd%U0x %x1,%y0
stxsd %1,%0"
- [(set_attr "type" "fpstore")
- (set_attr "length" "4")])
+ [(set_attr "type" "fpstore")])
;; Variable V2DI/V2DF extract shift
(define_insn "vsx_vslo_<mode>"
diff --git a/gcc/cppbuiltin.c b/gcc/cppbuiltin.c
index 8b9ec5d..7591229 100644
--- a/gcc/cppbuiltin.c
+++ b/gcc/cppbuiltin.c
@@ -110,9 +110,6 @@ define_builtin_macros_for_compilation_flags (cpp_reader *pfile)
cpp_define_formatted (pfile, "__FINITE_MATH_ONLY__=%d",
flag_finite_math_only);
-
- if (flag_check_pointer_bounds)
- cpp_define (pfile, "__CHKP__");
}
diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c
index c9edaab..a759826 100644
--- a/gcc/diagnostic-show-locus.c
+++ b/gcc/diagnostic-show-locus.c
@@ -253,7 +253,7 @@ class layout
void print_source_line (linenum_type row, const char *line, int line_width,
line_bounds *lbounds_out);
bool should_print_annotation_line_p (linenum_type row) const;
- void start_annotation_line () const;
+ void start_annotation_line (char margin_char = ' ') const;
void print_annotation_line (linenum_type row, const line_bounds lbounds);
void print_any_labels (linenum_type row);
void print_trailing_fixits (linenum_type row);
@@ -1330,12 +1330,12 @@ layout::should_print_annotation_line_p (linenum_type row) const
margin, which is empty for annotation lines. Otherwise, do nothing. */
void
-layout::start_annotation_line () const
+layout::start_annotation_line (char margin_char) const
{
if (m_show_line_numbers_p)
{
for (int i = 0; i < m_linenum_width; i++)
- pp_space (m_pp);
+ pp_character (m_pp, margin_char);
pp_string (m_pp, " |");
}
}
@@ -1587,7 +1587,7 @@ layout::print_leading_fixits (linenum_type row)
helps them stand out from each other, and from
the surrounding text. */
m_colorizer.set_normal_text ();
- start_annotation_line ();
+ start_annotation_line ('+');
pp_character (m_pp, '+');
m_colorizer.set_fixit_insert ();
/* Print all but the trailing newline of the fix-it hint.
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 59477ce..7e8bcf5 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -629,9 +629,9 @@ void
default_diagnostic_start_span_fn (diagnostic_context *context,
expanded_location exploc)
{
- pp_set_prefix (context->printer,
- diagnostic_get_location_text (context, exploc));
- pp_string (context->printer, "");
+ char *text = diagnostic_get_location_text (context, exploc);
+ pp_string (context->printer, text);
+ free (text);
pp_newline (context->printer);
}
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 20c5773..5b1e695 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -144,7 +144,8 @@ Currently, @file{rtl.def} defines these classes:
An RTX code that represents an actual object, such as a register
(@code{REG}) or a memory location (@code{MEM}, @code{SYMBOL_REF}).
@code{LO_SUM}) is also included; instead, @code{SUBREG} and
-@code{STRICT_LOW_PART} are not in this class, but in class @code{x}.
+@code{STRICT_LOW_PART} are not in this class, but in class
+@code{RTX_EXTRA}.
@item RTX_CONST_OBJ
An RTX code that represents a constant object. @code{HIGH} is also
@@ -166,7 +167,7 @@ An RTX code for a unary arithmetic operation, such as @code{NEG},
@item RTX_COMM_ARITH
An RTX code for a commutative binary operation, such as @code{PLUS} or
@code{AND}. @code{NE} and @code{EQ} are comparisons, so they have class
-@code{<}.
+@code{RTX_COMM_COMPARE}.
@item RTX_BIN_ARITH
An RTX code for a non-commutative binary operation, such as @code{MINUS},
@@ -284,26 +285,28 @@ Some classes of RTX codes always have the same format. For example, it
is safe to assume that all comparison operations have format @code{ee}.
@table @code
-@item 1
+@item RTX_UNARY
All codes of this class have format @code{e}.
-@item <
-@itemx c
-@itemx 2
+@item RTX_BIN_ARITH
+@itemx RTX_COMM_ARITH
+@itemx RTX_COMM_COMPARE
+@itemx RTX_COMPARE
All codes of these classes have format @code{ee}.
-@item b
-@itemx 3
+@item RTX_BITFIELD_OPS
+@itemx RTX_TERNARY
All codes of these classes have format @code{eee}.
-@item i
+@item RTX_INSN
All codes of this class have formats that begin with @code{iuueiee}.
@xref{Insns}. Note that not all RTL objects linked onto an insn chain
-are of class @code{i}.
+are of class @code{RTX_INSN}.
-@item o
-@itemx m
-@itemx x
+@item RTX_CONST_OBJ
+@itemx RTX_OBJ
+@itemx RTX_MATCH
+@itemx RTX_EXTRA
You can make no assumptions about the format of these codes.
@end table
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 5a74131..236f199 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -24240,6 +24240,7 @@ gen_producer_string (void)
case OPT_U:
case OPT_SPECIAL_unknown:
case OPT_SPECIAL_ignore:
+ case OPT_SPECIAL_deprecated:
case OPT_SPECIAL_program_name:
case OPT_SPECIAL_input_file:
case OPT_grecord_gcc_switches:
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 101e7b8..be9f0ec 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -5541,6 +5541,9 @@ emit_store_flag_1 (rtx target, enum rtx_code code, rtx op0, rtx op1,
if (mode == VOIDmode)
mode = GET_MODE (op0);
+ if (CONST_SCALAR_INT_P (op1))
+ canonicalize_comparison (mode, &code, &op1);
+
/* For some comparisons with 1 and -1, we can convert this to
comparisons with zero. This will often produce more opportunities for
store-flag insns. */
@@ -6161,6 +6164,96 @@ emit_store_flag_force (rtx target, enum rtx_code code, rtx op0, rtx op1,
return target;
}
+
+/* Helper function for canonicalize_cmp_for_target. Swap between inclusive
+ and exclusive ranges in order to create an equivalent comparison. See
+ canonicalize_cmp_for_target for the possible cases. */
+
+static enum rtx_code
+equivalent_cmp_code (enum rtx_code code)
+{
+ switch (code)
+ {
+ case GT:
+ return GE;
+ case GE:
+ return GT;
+ case LT:
+ return LE;
+ case LE:
+ return LT;
+ case GTU:
+ return GEU;
+ case GEU:
+ return GTU;
+ case LTU:
+ return LEU;
+ case LEU:
+ return LTU;
+
+ default:
+ return code;
+ }
+}
+
+/* Choose the more appropiate immediate in scalar integer comparisons. The
+ purpose of this is to end up with an immediate which can be loaded into a
+ register in fewer moves, if possible.
+
+ For each integer comparison there exists an equivalent choice:
+ i) a > b or a >= b + 1
+ ii) a <= b or a < b + 1
+ iii) a >= b or a > b - 1
+ iv) a < b or a <= b - 1
+
+ MODE is the mode of the first operand.
+ CODE points to the comparison code.
+ IMM points to the rtx containing the immediate. *IMM must satisfy
+ CONST_SCALAR_INT_P on entry and continues to satisfy CONST_SCALAR_INT_P
+ on exit. */
+
+void
+canonicalize_comparison (machine_mode mode, enum rtx_code *code, rtx *imm)
+{
+ if (!SCALAR_INT_MODE_P (mode))
+ return;
+
+ int to_add = 0;
+ enum signop sgn = unsigned_condition_p (*code) ? UNSIGNED : SIGNED;
+
+ /* Extract the immediate value from the rtx. */
+ wide_int imm_val = rtx_mode_t (*imm, mode);
+
+ if (*code == GT || *code == GTU || *code == LE || *code == LEU)
+ to_add = 1;
+ else if (*code == GE || *code == GEU || *code == LT || *code == LTU)
+ to_add = -1;
+ else
+ return;
+
+ /* Check for overflow/underflow in the case of signed values and
+ wrapping around in the case of unsigned values. If any occur
+ cancel the optimization. */
+ wi::overflow_type overflow = wi::OVF_NONE;
+ wide_int imm_modif = wi::add (imm_val, to_add, sgn, &overflow);
+ if (overflow)
+ return;
+
+ rtx reg = gen_rtx_REG (mode, LAST_VIRTUAL_REGISTER + 1);
+ rtx new_imm = immed_wide_int_const (imm_modif, mode);
+
+ rtx_insn *old_rtx = gen_move_insn (reg, *imm);
+ rtx_insn *new_rtx = gen_move_insn (reg, new_imm);
+
+ /* Update the immediate and the code. */
+ if (insn_cost (old_rtx, true) > insn_cost (new_rtx, true))
+ {
+ *code = equivalent_cmp_code (*code);
+ *imm = new_imm;
+ }
+}
+
+
/* Perform possibly multi-word comparison and conditional jump to LABEL
if ARG1 OP ARG2 true where ARG1 and ARG2 are of mode MODE. This is
diff --git a/gcc/expmed.h b/gcc/expmed.h
index 2890d9c..cc247c4 100644
--- a/gcc/expmed.h
+++ b/gcc/expmed.h
@@ -702,6 +702,8 @@ extern rtx emit_store_flag (rtx, enum rtx_code, rtx, rtx, machine_mode,
extern rtx emit_store_flag_force (rtx, enum rtx_code, rtx, rtx,
machine_mode, int, int);
+extern void canonicalize_comparison (machine_mode, enum rtx_code *, rtx *);
+
/* Choose a minimal N + 1 bit approximation to 1/D that can be used to
replace division by D, and put the least significant N bits of the result
in *MULTIPLIER_PTR and return the most significant bit. */
diff --git a/gcc/expr.c b/gcc/expr.c
index de6709d..c071be6 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2767,6 +2767,7 @@ copy_blkmode_to_reg (machine_mode mode_in, tree src)
/* No current ABI uses variable-sized modes to pass a BLKmnode type. */
fixed_size_mode mode = as_a <fixed_size_mode> (mode_in);
fixed_size_mode dst_mode;
+ scalar_int_mode min_mode;
gcc_assert (TYPE_MODE (TREE_TYPE (src)) == BLKmode);
@@ -2796,6 +2797,7 @@ copy_blkmode_to_reg (machine_mode mode_in, tree src)
n_regs = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
dst_words = XALLOCAVEC (rtx, n_regs);
bitsize = MIN (TYPE_ALIGN (TREE_TYPE (src)), BITS_PER_WORD);
+ min_mode = smallest_int_mode_for_size (bitsize);
/* Copy the structure BITSIZE bits at a time. */
for (bitpos = 0, xbitpos = padding_correction;
@@ -2816,6 +2818,25 @@ copy_blkmode_to_reg (machine_mode mode_in, tree src)
emit_move_insn (dst_word, CONST0_RTX (word_mode));
}
+ /* Find the largest integer mode that can be used to copy all or as
+ many bits as possible of the structure if the target supports larger
+ copies. There are too many corner cases here w.r.t to alignments on
+ the read/writes. So if there is any padding just use single byte
+ operations. */
+ opt_scalar_int_mode mode_iter;
+ if (padding_correction == 0 && !STRICT_ALIGNMENT)
+ {
+ FOR_EACH_MODE_FROM (mode_iter, min_mode)
+ {
+ unsigned int msize = GET_MODE_BITSIZE (mode_iter.require ());
+ if (msize <= ((bytes * BITS_PER_UNIT) - bitpos)
+ && msize <= BITS_PER_WORD)
+ bitsize = msize;
+ else
+ break;
+ }
+ }
+
/* We need a new source operand each time bitpos is on a word
boundary. */
if (bitpos % BITS_PER_WORD == 0)
@@ -11271,10 +11292,12 @@ is_aligning_offset (const_tree offset, const_tree exp)
/* Return the tree node if an ARG corresponds to a string constant or zero
if it doesn't. If we return nonzero, set *PTR_OFFSET to the (possibly
non-constant) offset in bytes within the string that ARG is accessing.
- The type of the offset is sizetype. */
+ The type of the offset is sizetype. If MEM_SIZE is non-zero the storage
+ size of the memory is returned. If MEM_SIZE is zero, the string is
+ only returned when it is properly zero terminated. */
tree
-string_constant (tree arg, tree *ptr_offset)
+string_constant (tree arg, tree *ptr_offset, tree *mem_size)
{
tree array;
STRIP_NOPS (arg);
@@ -11328,7 +11351,7 @@ string_constant (tree arg, tree *ptr_offset)
return NULL_TREE;
tree offset;
- if (tree str = string_constant (arg0, &offset))
+ if (tree str = string_constant (arg0, &offset, mem_size))
{
/* Avoid pointers to arrays (see bug 86622). */
if (POINTER_TYPE_P (TREE_TYPE (arg))
@@ -11368,6 +11391,8 @@ string_constant (tree arg, tree *ptr_offset)
if (TREE_CODE (array) == STRING_CST)
{
*ptr_offset = fold_convert (sizetype, offset);
+ if (mem_size)
+ *mem_size = TYPE_SIZE_UNIT (TREE_TYPE (array));
return array;
}
@@ -11427,7 +11452,9 @@ string_constant (tree arg, tree *ptr_offset)
unsigned HOST_WIDE_INT length = TREE_STRING_LENGTH (init);
length = string_length (TREE_STRING_POINTER (init), charsize,
length / charsize);
- if (compare_tree_int (array_size, length + 1) < 0)
+ if (mem_size)
+ *mem_size = TYPE_SIZE_UNIT (TREE_TYPE (init));
+ else if (compare_tree_int (array_size, length + 1) < 0)
return NULL_TREE;
*ptr_offset = offset;
diff --git a/gcc/expr.h b/gcc/expr.h
index cf047d4..d4d2564 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -288,7 +288,7 @@ expand_normal (tree exp)
/* Return the tree node and offset if a given argument corresponds to
a string constant. */
-extern tree string_constant (tree, tree *);
+extern tree string_constant (tree, tree *, tree * = NULL);
/* Two different ways of generating switch statements. */
extern int try_casesi (tree, tree, tree, tree, rtx, rtx, rtx, profile_probability);
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 42673b5..07341eb 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1275,11 +1275,13 @@ gimple_fold_builtin_memset (gimple_stmt_iterator *gsi, tree c, tree len)
Set *FLEXP to true if the range of the string lengths has been
obtained from the upper bound of an array at the end of a struct.
Such an array may hold a string that's longer than its upper bound
- due to it being used as a poor-man's flexible array member. */
+ due to it being used as a poor-man's flexible array member.
+ ELTSIZE is 1 for normal single byte character strings, and 2 or
+ 4 for wide characer strings. ELTSIZE is by default 1. */
static bool
get_range_strlen (tree arg, tree length[2], bitmap *visited, int type,
- int fuzzy, bool *flexp)
+ int fuzzy, bool *flexp, unsigned eltsize = 1)
{
tree var, val = NULL_TREE;
gimple *def_stmt;
@@ -1300,8 +1302,8 @@ get_range_strlen (tree arg, tree length[2], bitmap *visited, int type,
tree aop0 = TREE_OPERAND (op, 0);
if (TREE_CODE (aop0) == INDIRECT_REF
&& TREE_CODE (TREE_OPERAND (aop0, 0)) == SSA_NAME)
- return get_range_strlen (TREE_OPERAND (aop0, 0),
- length, visited, type, fuzzy, flexp);
+ return get_range_strlen (TREE_OPERAND (aop0, 0), length,
+ visited, type, fuzzy, flexp, eltsize);
}
else if (TREE_CODE (TREE_OPERAND (op, 0)) == COMPONENT_REF && fuzzy)
{
@@ -1329,13 +1331,13 @@ get_range_strlen (tree arg, tree length[2], bitmap *visited, int type,
return false;
}
else
- val = c_strlen (arg, 1);
+ val = c_strlen (arg, 1, eltsize);
if (!val && fuzzy)
{
if (TREE_CODE (arg) == ADDR_EXPR)
return get_range_strlen (TREE_OPERAND (arg, 0), length,
- visited, type, fuzzy, flexp);
+ visited, type, fuzzy, flexp, eltsize);
if (TREE_CODE (arg) == ARRAY_REF)
{
@@ -1477,7 +1479,8 @@ get_range_strlen (tree arg, tree length[2], bitmap *visited, int type,
|| gimple_assign_unary_nop_p (def_stmt))
{
tree rhs = gimple_assign_rhs1 (def_stmt);
- return get_range_strlen (rhs, length, visited, type, fuzzy, flexp);
+ return get_range_strlen (rhs, length, visited, type, fuzzy, flexp,
+ eltsize);
}
else if (gimple_assign_rhs_code (def_stmt) == COND_EXPR)
{
@@ -1486,7 +1489,7 @@ get_range_strlen (tree arg, tree length[2], bitmap *visited, int type,
for (unsigned int i = 0; i < 2; i++)
if (!get_range_strlen (ops[i], length, visited, type, fuzzy,
- flexp))
+ flexp, eltsize))
{
if (fuzzy == 2)
*maxlen = build_all_ones_cst (size_type_node);
@@ -1513,7 +1516,8 @@ get_range_strlen (tree arg, tree length[2], bitmap *visited, int type,
if (arg == gimple_phi_result (def_stmt))
continue;
- if (!get_range_strlen (arg, length, visited, type, fuzzy, flexp))
+ if (!get_range_strlen (arg, length, visited, type, fuzzy, flexp,
+ eltsize))
{
if (fuzzy == 2)
*maxlen = build_all_ones_cst (size_type_node);
@@ -1545,10 +1549,13 @@ get_range_strlen (tree arg, tree length[2], bitmap *visited, int type,
and false if PHIs and COND_EXPRs are to be handled optimistically,
if we can determine string length minimum and maximum; it will use
the minimum from the ones where it can be determined.
- STRICT false should be only used for warning code. */
+ STRICT false should be only used for warning code.
+
+ ELTSIZE is 1 for normal single byte character strings, and 2 or
+ 4 for wide characer strings. ELTSIZE is by default 1. */
bool
-get_range_strlen (tree arg, tree minmaxlen[2], bool strict)
+get_range_strlen (tree arg, tree minmaxlen[2], unsigned eltsize, bool strict)
{
bitmap visited = NULL;
@@ -1557,7 +1564,7 @@ get_range_strlen (tree arg, tree minmaxlen[2], bool strict)
bool flexarray = false;
if (!get_range_strlen (arg, minmaxlen, &visited, 1, strict ? 1 : 2,
- &flexarray))
+ &flexarray, eltsize))
{
minmaxlen[0] = NULL_TREE;
minmaxlen[1] = NULL_TREE;
@@ -3500,7 +3507,7 @@ gimple_fold_builtin_strlen (gimple_stmt_iterator *gsi)
wide_int maxlen;
tree lenrange[2];
- if (!get_range_strlen (gimple_call_arg (stmt, 0), lenrange, true)
+ if (!get_range_strlen (gimple_call_arg (stmt, 0), lenrange, 1, true)
&& lenrange[0] && TREE_CODE (lenrange[0]) == INTEGER_CST
&& lenrange[1] && TREE_CODE (lenrange[1]) == INTEGER_CST)
{
diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h
index 04e9bfa..e3fad83 100644
--- a/gcc/gimple-fold.h
+++ b/gcc/gimple-fold.h
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
extern tree create_tmp_reg_or_ssa_name (tree, gimple *stmt = NULL);
extern tree canonicalize_constructor_val (tree, tree);
extern tree get_symbol_constant_value (tree);
-extern bool get_range_strlen (tree, tree[2], bool = false);
+extern bool get_range_strlen (tree, tree[2], unsigned = 1, bool = false);
extern tree get_maxval_strlen (tree, int);
extern void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
extern bool fold_stmt (gimple_stmt_iterator *);
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 5213e17..b5e1a08 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -211,12 +211,14 @@ struct format_result
the return value optimization. */
bool knownrange;
- /* True if no individual directive resulted in more than 4095 bytes
- of output (the total NUMBER_CHARS_{MIN,MAX} might be greater).
- Implementations are not required to handle directives that produce
- more than 4K bytes (leading to undefined behavior) and so when one
- is found it disables the return value optimization. */
- bool under4k;
+ /* True if no individual directive could fail or result in more than
+ 4095 bytes of output (the total NUMBER_CHARS_{MIN,MAX} might be
+ greater). Implementations are not required to handle directives
+ that produce more than 4K bytes (leading to undefined behavior)
+ and so when one is found it disables the return value optimization.
+ Similarly, directives that can fail (such as wide character
+ directives) disable the optimization. */
+ bool posunder4k;
/* True when a floating point directive has been seen in the format
string. */
@@ -651,7 +653,7 @@ struct fmtresult
fmtresult (unsigned HOST_WIDE_INT min = HOST_WIDE_INT_MAX)
: argmin (), argmax (),
knownrange (min < HOST_WIDE_INT_MAX),
- nullp ()
+ mayfail (), nullp ()
{
range.min = min;
range.max = min;
@@ -665,7 +667,7 @@ struct fmtresult
unsigned HOST_WIDE_INT likely = HOST_WIDE_INT_MAX)
: argmin (), argmax (),
knownrange (min < HOST_WIDE_INT_MAX && max < HOST_WIDE_INT_MAX),
- nullp ()
+ mayfail (), nullp ()
{
range.min = min;
range.max = max;
@@ -695,6 +697,10 @@ struct fmtresult
heuristics that depend on warning levels. */
bool knownrange;
+ /* True for a directive that may fail (such as wide character
+ directives). */
+ bool mayfail;
+
/* True when the argument is a null pointer. */
bool nullp;
};
@@ -2125,12 +2131,12 @@ format_floating (const directive &dir, tree arg, vr_values *)
Used by the format_string function below. */
static fmtresult
-get_string_length (tree str)
+get_string_length (tree str, unsigned eltsize)
{
if (!str)
return fmtresult ();
- if (tree slen = c_strlen (str, 1))
+ if (tree slen = c_strlen (str, 1, eltsize))
{
/* Simply return the length of the string. */
fmtresult res (tree_to_shwi (slen));
@@ -2143,7 +2149,7 @@ get_string_length (tree str)
aren't known to point any such arrays result in LENRANGE[1] set
to SIZE_MAX. */
tree lenrange[2];
- bool flexarray = get_range_strlen (str, lenrange);
+ bool flexarray = get_range_strlen (str, lenrange, eltsize);
if (lenrange [0] || lenrange [1])
{
@@ -2195,7 +2201,7 @@ get_string_length (tree str)
return res;
}
- return get_string_length (NULL_TREE);
+ return fmtresult ();
}
/* Return the minimum and maximum number of characters formatted
@@ -2210,7 +2216,8 @@ format_character (const directive &dir, tree arg, vr_values *vr_values)
res.knownrange = true;
- if (dir.modifier == FMT_LEN_l)
+ if (dir.specifier == 'C'
+ || dir.modifier == FMT_LEN_l)
{
/* A wide character can result in as few as zero bytes. */
res.range.min = 0;
@@ -2225,13 +2232,20 @@ format_character (const directive &dir, tree arg, vr_values *vr_values)
res.range.likely = 0;
res.range.unlikely = 0;
}
- else if (min > 0 && min < 128)
+ else if (min >= 0 && min < 128)
{
+ /* Be conservative if the target execution character set
+ is not a 1-to-1 mapping to the source character set or
+ if the source set is not ASCII. */
+ bool one_2_one_ascii
+ = (target_to_host_charmap[0] == 1 && target_to_host ('a') == 97);
+
/* A wide character in the ASCII range most likely results
in a single byte, and only unlikely in up to MB_LEN_MAX. */
- res.range.max = 1;
+ res.range.max = one_2_one_ascii ? 1 : target_mb_len_max ();;
res.range.likely = 1;
res.range.unlikely = target_mb_len_max ();
+ res.mayfail = !one_2_one_ascii;
}
else
{
@@ -2240,6 +2254,8 @@ format_character (const directive &dir, tree arg, vr_values *vr_values)
res.range.max = target_mb_len_max ();
res.range.likely = 2;
res.range.unlikely = res.range.max;
+ /* Converting such a character may fail. */
+ res.mayfail = true;
}
}
else
@@ -2249,6 +2265,7 @@ format_character (const directive &dir, tree arg, vr_values *vr_values)
res.range.max = target_mb_len_max ();
res.range.likely = 2;
res.range.unlikely = res.range.max;
+ res.mayfail = true;
}
}
else
@@ -2274,7 +2291,8 @@ format_string (const directive &dir, tree arg, vr_values *)
fmtresult res;
/* Compute the range the argument's length can be in. */
- fmtresult slen = get_string_length (arg);
+ int count_by = dir.specifier == 'S' || dir.modifier == FMT_LEN_l ? 4 : 1;
+ fmtresult slen = get_string_length (arg, count_by);
if (slen.range.min == slen.range.max
&& slen.range.min < HOST_WIDE_INT_MAX)
{
@@ -2284,7 +2302,8 @@ format_string (const directive &dir, tree arg, vr_values *)
/* A '%s' directive with a string argument with constant length. */
res.range = slen.range;
- if (dir.modifier == FMT_LEN_l)
+ if (dir.specifier == 'S'
+ || dir.modifier == FMT_LEN_l)
{
/* In the worst case the length of output of a wide string S
is bounded by MB_LEN_MAX * wcslen (S). */
@@ -2310,6 +2329,10 @@ format_string (const directive &dir, tree arg, vr_values *)
/* Even a non-empty wide character string need not convert into
any bytes. */
res.range.min = 0;
+
+ /* A non-empty wide character conversion may fail. */
+ if (slen.range.max > 0)
+ res.mayfail = true;
}
else
{
@@ -2348,7 +2371,8 @@ format_string (const directive &dir, tree arg, vr_values *)
at level 2. This result is adjust upward for width (if it's
specified). */
- if (dir.modifier == FMT_LEN_l)
+ if (dir.specifier == 'S'
+ || dir.modifier == FMT_LEN_l)
{
/* A wide character converts to as few as zero bytes. */
slen.range.min = 0;
@@ -2360,6 +2384,10 @@ format_string (const directive &dir, tree arg, vr_values *)
if (slen.range.likely < target_int_max ())
slen.range.unlikely *= target_mb_len_max ();
+
+ /* A non-empty wide character conversion may fail. */
+ if (slen.range.max > 0)
+ res.mayfail = true;
}
res.range = slen.range;
@@ -2912,11 +2940,14 @@ format_directive (const sprintf_dom_walker::call_info &info,
of 4095 bytes required to be supported? */
bool minunder4k = fmtres.range.min < 4096;
bool maxunder4k = fmtres.range.max < 4096;
- /* Clear UNDER4K in the overall result if the maximum has exceeded
- the 4k (this is necessary to avoid the return valuye optimization
+ /* Clear POSUNDER4K in the overall result if the maximum has exceeded
+ the 4k (this is necessary to avoid the return value optimization
that may not be safe in the maximum case). */
if (!maxunder4k)
- res->under4k = false;
+ res->posunder4k = false;
+ /* Also clear POSUNDER4K if the directive may fail. */
+ if (fmtres.mayfail)
+ res->posunder4k = false;
if (!warned
/* Only warn at level 2. */
@@ -3362,12 +3393,15 @@ parse_directive (sprintf_dom_walker::call_info &info,
dir.fmtfunc = format_none;
break;
+ case 'C':
case 'c':
+ /* POSIX wide character and C/POSIX narrow character. */
dir.fmtfunc = format_character;
break;
case 'S':
case 's':
+ /* POSIX wide string and C/POSIX narrow character string. */
dir.fmtfunc = format_string;
break;
@@ -3525,10 +3559,10 @@ sprintf_dom_walker::compute_format_length (call_info &info,
res->range.min = res->range.max = 0;
/* No directive has been seen yet so the length of output is bounded
- by the known range [0, 0] (with no conversion producing more than
- 4K bytes) until determined otherwise. */
+ by the known range [0, 0] (with no conversion resulting in a failure
+ or producing more than 4K bytes) until determined otherwise. */
res->knownrange = true;
- res->under4k = true;
+ res->posunder4k = true;
res->floating = false;
res->warned = false;
@@ -3596,7 +3630,7 @@ is_call_safe (const sprintf_dom_walker::call_info &info,
const format_result &res, bool under4k,
unsigned HOST_WIDE_INT retval[2])
{
- if (under4k && !res.under4k)
+ if (under4k && !res.posunder4k)
return false;
/* The minimum return value. */
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index cc5f530..09ec7c0 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -107,6 +107,7 @@ lto_write_options (void)
case OPT_dumpbase:
case OPT_SPECIAL_unknown:
case OPT_SPECIAL_ignore:
+ case OPT_SPECIAL_deprecated:
case OPT_SPECIAL_program_name:
case OPT_SPECIAL_input_file:
case OPT_dumpdir:
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index d446786..9cfdfae 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -245,6 +245,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
{
case OPT_SPECIAL_unknown:
case OPT_SPECIAL_ignore:
+ case OPT_SPECIAL_deprecated:
case OPT_SPECIAL_program_name:
case OPT_SPECIAL_input_file:
break;
@@ -285,7 +286,6 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
case OPT_fopenmp:
case OPT_fopenacc:
- case OPT_fcheck_pointer_bounds:
/* For selected options we can merge conservatively. */
for (j = 0; j < *decoded_options_count; ++j)
if ((*decoded_options)[j].opt_index == foption->opt_index)
@@ -293,8 +293,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
if (j == *decoded_options_count)
append_option (decoded_options, decoded_options_count, foption);
/* -fopenmp > -fno-openmp,
- -fopenacc > -fno-openacc,
- -fcheck_pointer_bounds > -fcheck_pointer_bounds */
+ -fopenacc > -fno-openacc */
else if (foption->value > (*decoded_options)[j].value)
(*decoded_options)[j] = *foption;
break;
@@ -557,7 +556,6 @@ append_compiler_options (obstack *argv_obstack, struct cl_decoded_option *opts,
case OPT_Ofast:
case OPT_Og:
case OPT_Os:
- case OPT_fcheck_pointer_bounds:
break;
default:
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index 6611bf3..6f62526 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -156,7 +156,6 @@ function switch_bit_fields (flags)
hwi_flag \
flag_init("ToLower", flags) \
flag_init("Report", flags) \
- flag_init("Deprecated", flags) \
byte_size_flag
sub(", $", "", result)
diff --git a/gcc/optabs.c b/gcc/optabs.c
index cadf467..6052222 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3812,6 +3812,9 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size,
gcc_assert (methods == OPTAB_DIRECT || methods == OPTAB_WIDEN
|| methods == OPTAB_LIB_WIDEN);
+ if (CONST_SCALAR_INT_P (y))
+ canonicalize_comparison (mode, &comparison, &y);
+
/* If we are optimizing, force expensive constants into a register. */
if (CONSTANT_P (x) && optimize
&& (rtx_cost (x, mode, COMPARE, 0, optimize_insn_for_speed_p ())
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 7eaca62..9a79bb8 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -323,8 +323,24 @@ for (i = 0; i < n_opts; i++) {
alias_arg = opt_args("Alias", flags[i])
if (alias_arg == "") {
- if (flag_set_p("Ignore", flags[i]))
- alias_data = "NULL, NULL, OPT_SPECIAL_ignore"
+ if (flag_set_p("Ignore", flags[i])) {
+ alias_data = "NULL, NULL, OPT_SPECIAL_ignore"
+ if (warn_message != "NULL")
+ print "#error Ignored option with Warn"
+ if (var_name(flags[i]) != "")
+ print "#error Ignored option with Var"
+ if (flag_set_p("Report", flags[i]))
+ print "#error Ignored option with Report"
+ }
+ else if (flag_set_p("Deprecated", flags[i])) {
+ alias_data = "NULL, NULL, OPT_SPECIAL_deprecated"
+ if (warn_message != "NULL")
+ print "#error Deprecated option with Warn"
+ if (var_name(flags[i]) != "")
+ print "#error Deprecated option with Var"
+ if (flag_set_p("Report", flags[i]))
+ print "#error Deprecated option with Report"
+ }
else
alias_data = "NULL, NULL, N_OPTS"
if (flag_set_p("Enum.*", flags[i])) {
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index 36f22b8..c2390de 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -493,6 +493,7 @@ for (i = 0; i < n_opts; i++) {
print " N_OPTS,"
print " OPT_SPECIAL_unknown,"
print " OPT_SPECIAL_ignore,"
+print " OPT_SPECIAL_deprecated,"
print " OPT_SPECIAL_program_name,"
print " OPT_SPECIAL_input_file"
print "};"
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 1135644..2b5f638 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -663,13 +663,13 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
{
size_t new_opt_index = option->alias_target;
- if (new_opt_index == OPT_SPECIAL_ignore)
+ if (new_opt_index == OPT_SPECIAL_ignore
+ || new_opt_index == OPT_SPECIAL_deprecated)
{
gcc_assert (option->alias_arg == NULL);
gcc_assert (option->neg_alias_arg == NULL);
opt_index = new_opt_index;
arg = NULL;
- value = 1;
}
else
{
@@ -744,10 +744,6 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
if (!option_ok_for_language (option, lang_mask))
errors |= CL_ERR_WRONG_LANG;
- /* Mark all deprecated options. */
- if (option->cl_deprecated)
- errors |= CL_ERR_DEPRECATED;
-
/* Convert the argument to lowercase if appropriate. */
if (arg && option->cl_tolower)
{
@@ -823,7 +819,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
else
decoded->canonical_option[i] = NULL;
}
- if (opt_index != OPT_SPECIAL_unknown && opt_index != OPT_SPECIAL_ignore)
+ if (opt_index != OPT_SPECIAL_unknown && opt_index != OPT_SPECIAL_ignore
+ && opt_index != OPT_SPECIAL_deprecated)
{
generate_canonical_option (opt_index, arg, value, decoded);
if (separate_args > 1)
@@ -1001,6 +998,7 @@ prune_options (struct cl_decoded_option **decoded_options,
{
case OPT_SPECIAL_unknown:
case OPT_SPECIAL_ignore:
+ case OPT_SPECIAL_deprecated:
case OPT_SPECIAL_program_name:
case OPT_SPECIAL_input_file:
goto keep;
@@ -1324,6 +1322,14 @@ read_cmdline_option (struct gcc_options *opts,
if (decoded->opt_index == OPT_SPECIAL_ignore)
return;
+ if (decoded->opt_index == OPT_SPECIAL_deprecated)
+ {
+ /* Warn only about positive ignored options. */
+ if (decoded->value)
+ warning_at (loc, 0, "switch %qs is no longer supported", opt);
+ return;
+ }
+
option = &cl_options[decoded->opt_index];
if (decoded->errors
@@ -1337,12 +1343,6 @@ read_cmdline_option (struct gcc_options *opts,
return;
}
- if (decoded->errors & CL_ERR_DEPRECATED)
- {
- warning_at (loc, 0, "deprecated command line option %qs", opt);
- return;
- }
-
gcc_assert (!decoded->errors);
if (!handle_option (opts, opts_set, decoded, lang_mask, DK_UNSPECIFIED,
@@ -1619,7 +1619,7 @@ control_warning_option (unsigned int opt_index, int kind, const char *arg,
arg = cl_options[opt_index].alias_arg;
opt_index = cl_options[opt_index].alias_target;
}
- if (opt_index == OPT_SPECIAL_ignore)
+ if (opt_index == OPT_SPECIAL_ignore || opt_index == OPT_SPECIAL_deprecated)
return;
if (dc)
diagnostic_classify_diagnostic (dc, opt_index, (diagnostic_t) kind, loc);
diff --git a/gcc/opts.h b/gcc/opts.h
index 0091fe0..04efda5 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -106,8 +106,6 @@ struct cl_option
BOOL_BITFIELD cl_tolower : 1;
/* Report argument with -fverbose-asm */
BOOL_BITFIELD cl_report : 1;
- /* Deprecated option */
- BOOL_BITFIELD cl_deprecated: 1;
/* Argument is an unsigned integer with an optional byte suffix. */
BOOL_BITFIELD cl_byte_size: 1;
/* Offset of field for this option in struct gcc_options, or
@@ -219,7 +217,6 @@ extern const unsigned int cl_enums_count;
#define CL_ERR_NEGATIVE (1 << 6) /* Negative form of option
not permitted (together
with OPT_SPECIAL_unknown). */
-#define CL_ERR_DEPRECATED (1 << 7) /* Deprecated option. */
/* Structure describing the result of decoding an option. */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index d549b0a..68d3cea 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3310,6 +3310,15 @@ extern enum rtx_code unsigned_condition (enum rtx_code);
extern enum rtx_code signed_condition (enum rtx_code);
extern void mark_jump_label (rtx, rtx_insn *, int);
+/* Return true if integer comparison operator CODE interprets its operands
+ as unsigned. */
+
+inline bool
+unsigned_condition_p (enum rtx_code code)
+{
+ return unsigned_condition (code) == code;
+}
+
/* In jump.c */
extern rtx_insn *delete_related_insns (rtx);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6311e0b..341079b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,104 @@
+2018-08-17 Martin Liska <mliska@suse.cz>
+
+ * g++.dg/opt/mpx.C: Fix scanned pattern.
+ * gcc.target/i386/mpx.c: Likewise.
+ * g++.dg/warn/Wunreachable-code-1.C: Remove.
+ * g++.dg/warn/Wunreachable-code-2.C: Likewise.
+ * gcc.dg/torture/pr52969.c: Likewise.
+ * g++.dg/warn/pr31246-2.C: Likewise.
+ * g++.dg/warn/pr31246.C: Likewise.
+ * gcc.dg/pr33092.c: Likewise.
+ * g++.dg/opt/eh1.C: Remove a deprecated option.
+ * g++.dg/template/inline1.C: Likewise.
+ * g++.dg/tree-ssa/pr81408.C: Likewise.
+ * gcc.dg/pr41837.c: Likewise.
+ * gcc.dg/pr41841.c: Likewise.
+ * gcc.dg/pr42250.c: Likewise.
+ * gcc.dg/pr43084.c: Likewise.
+ * gcc.dg/pr43317.c: Likewise.
+ * gcc.dg/pr51879-18.c: Likewise.
+ * gcc.dg/torture/pr36066.c: Likewise.
+ * gcc.dg/tree-ssa/ifc-8.c: Likewise.
+ * gcc.dg/tree-ssa/ifc-cd.c: Likewise.
+ * gcc.dg/tree-ssa/pr19210-1.c: Likewise.
+ * gcc.dg/tree-ssa/pr45122.c: Likewise.
+ * gcc.target/i386/pr45352-2.c: Likewise.
+ * gcc.target/i386/zee.c: Likewise.
+ * gfortran.dg/auto_char_len_2.f90: Likewise.
+ * gfortran.dg/auto_char_len_4.f90: Likewise.
+ * gfortran.dg/c_ptr_tests_15.f90: Likewise.
+ * gfortran.dg/char_array_structure_constructor.f90: Likewise.
+ * gfortran.dg/gomp/pr47331.f90: Likewise.
+ * gfortran.dg/pr40999.f: Likewise.
+ * gfortran.dg/pr41011.f: Likewise.
+ * gfortran.dg/pr42051.f03: Likewise.
+ * gfortran.dg/pr46804.f90: Likewise.
+ * gfortran.dg/pr83149_1.f90: Likewise.
+ * gfortran.dg/pr83149_b.f90: Likewise.
+ * gfortran.dg/whole_file_1.f90: Likewise.
+ * gfortran.dg/whole_file_10.f90: Likewise.
+ * gfortran.dg/whole_file_11.f90: Likewise.
+ * gfortran.dg/whole_file_12.f90: Likewise.
+ * gfortran.dg/whole_file_13.f90: Likewise.
+ * gfortran.dg/whole_file_14.f90: Likewise.
+ * gfortran.dg/whole_file_15.f90: Likewise.
+ * gfortran.dg/whole_file_16.f90: Likewise.
+ * gfortran.dg/whole_file_17.f90: Likewise.
+ * gfortran.dg/whole_file_18.f90: Likewise.
+ * gfortran.dg/whole_file_19.f90: Likewise.
+ * gfortran.dg/whole_file_2.f90: Likewise.
+ * gfortran.dg/whole_file_20.f03: Likewise.
+ * gfortran.dg/whole_file_3.f90: Likewise.
+ * gfortran.dg/whole_file_4.f90: Likewise.
+ * gfortran.dg/whole_file_5.f90: Likewise.
+ * gfortran.dg/whole_file_6.f90: Likewise.
+ * gfortran.dg/whole_file_7.f90: Likewise.
+ * gfortran.dg/whole_file_8.f90: Likewise.
+ * gfortran.dg/whole_file_9.f90: Likewise.
+ * gcc.dg/vect/vect.exp: Likewise.
+
+2018-08-17 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/86505
+ * gcc.dg/torture/pr86505.c: New testcase.
+
+2018-08-16 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/86853
+ * gcc.dg/tree-ssa/builtin-sprintf-10.c: New test.
+ * gcc.dg/tree-ssa/builtin-sprintf-11.c: New test.
+ * gcc.dg/tree-ssa/builtin-sprintf-warn-18.c: Adjust.
+
+2018-08-16 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/missing-header-fixit-3.c: New test.
+
+2018-08-16 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
+ (test_fixit_insert_newline): Update expected output to show '+'
+ characters in margin of line-insertion fix-it hint.
+
+2018-08-16 Nathan Sidwell <nathan@acm.org>
+
+ * gcc.dg/cpp/macsyntx.c: Adjust expected errors.
+ * gcc.dg/cpp/macsyntx2.c: likewise.
+
+2018-08-15 Uros Bizjak <ubizjak@gmail.com>
+
+ PR testsuite/86745
+ * gcc.target/i386/avx-cvt-2.c: Loosen scan-assembler strings.
+ * gcc.target/i386/avx-cvt-2.c: Ditto.
+
+2018-08-16 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/70693
+ * c-c++-common/Wmisleading-indentation-pr70693.c: New test.
+
+2018-08-16 Vlad Lazar <vlad.lazar@arm.com>
+
+ * gcc.target/aarch64/imm_choice_comparison.c: New test.
+
2018-08-16 Iain Sandoe <iain@sandoe.co.uk>
* gcc.dg/memcmp-1.c (lib_memcmp): Apply __USER_LABEL_PREFIX__.
diff --git a/gcc/testsuite/c-c++-common/Wmisleading-indentation-pr70693.c b/gcc/testsuite/c-c++-common/Wmisleading-indentation-pr70693.c
new file mode 100644
index 0000000..0869b11
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wmisleading-indentation-pr70693.c
@@ -0,0 +1,12 @@
+/* { dg-options "-Wmisleading-indentation" } */
+
+int in_what; /* */
+
+void process_char(char c) {
+ switch( 0 ) {
+ case 0:
+ if( c == '>' ) in_what = 0;
+ break;
+
+ }
+}
diff --git a/gcc/testsuite/g++.dg/opt/eh1.C b/gcc/testsuite/g++.dg/opt/eh1.C
index 63a4d2e..0c3e679 100644
--- a/gcc/testsuite/g++.dg/opt/eh1.C
+++ b/gcc/testsuite/g++.dg/opt/eh1.C
@@ -1,6 +1,6 @@
// PR middle-end/14477
// { dg-do compile }
-// { dg-options "-O2 -fno-default-inline" }
+// { dg-options "-O2" }
struct A
{
diff --git a/gcc/testsuite/g++.dg/opt/mpx.C b/gcc/testsuite/g++.dg/opt/mpx.C
index 6ae0cef..201ee1b 100644
--- a/gcc/testsuite/g++.dg/opt/mpx.C
+++ b/gcc/testsuite/g++.dg/opt/mpx.C
@@ -1,5 +1,5 @@
// { dg-do compile }
// { dg-options "-fcheck-pointer-bounds -fchkp-first-field-has-own-bounds" }
-// { dg-warning "deprecated command line option .-fcheck-pointer-bounds." "" { target *-*-* } 0 }
-// { dg-warning "deprecated command line option .-fchkp-first-field-has-own-bounds." "" { target *-*-* } 0 }
+// { dg-warning ".-fcheck-pointer-bounds. is no longer supported" "" { target *-*-* } 0 }
+// { dg-warning ".-fchkp-first-field-has-own-bounds. is no longer supported" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/g++.dg/template/inline1.C b/gcc/testsuite/g++.dg/template/inline1.C
index c7ae1f5..f941e6c 100644
--- a/gcc/testsuite/g++.dg/template/inline1.C
+++ b/gcc/testsuite/g++.dg/template/inline1.C
@@ -1,5 +1,5 @@
// { dg-do compile }
-// { dg-options "-fno-default-inline -O0" }
+// { dg-options "-O0" }
// { dg-final { scan-assembler-not "\n_?_ZN1X3FooIiEEvT_\[: \t\n\]" } }
// Copyright (C) 2003 Free Software Foundation, Inc.
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
index 60e6e52..89d6e55 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -std=gnu++11 -fopt-info-loop-missed -Wunsafe-loop-optimizations" } */
+/* { dg-options "-O2 -std=gnu++11 -fopt-info-loop-missed" } */
struct p
{
char *ay;
diff --git a/gcc/testsuite/g++.dg/warn/Wunreachable-code-1.C b/gcc/testsuite/g++.dg/warn/Wunreachable-code-1.C
deleted file mode 100644
index 23fc86d..0000000
--- a/gcc/testsuite/g++.dg/warn/Wunreachable-code-1.C
+++ /dev/null
@@ -1,22 +0,0 @@
-/* PR17544 Incorrect -Wunreachable-code warning
- Origin: sebor@roguewave.com
-
- G++ appends a "return 0;" when finishing a function, but it was not
- given a source location. The gimplifier thinks a return statement
- needs a locus so it would add one, making the compiler generated code
- visible to the unreachable code warning. */
-
-/* { dg-do compile } */
-/* { dg-options "-O -Wunreachable-code" } */
-
-int
-main (int argc, char *argv[])
-{
- const char* const s = argc < 2 ? "" : argv [1];
- int i = 0;
- do {
- ++i;
- } while (i < s [0]);
- return i;
-}
-
diff --git a/gcc/testsuite/g++.dg/warn/Wunreachable-code-2.C b/gcc/testsuite/g++.dg/warn/Wunreachable-code-2.C
deleted file mode 100644
index d50f7fe..0000000
--- a/gcc/testsuite/g++.dg/warn/Wunreachable-code-2.C
+++ /dev/null
@@ -1,23 +0,0 @@
-// PR c++/21228
-/* { dg-options "-Wunreachable-code" } */
-
-class testStringBase
-{
-public:
- char *stringPtr;
-};
-
-class testString : public testStringBase
-{
-public:
- testString();
-};
-
-testString::testString()
-{
- stringPtr = (char *) 9;
-}
-
-int main(int argc, char **argv) {
- testString s;
-}
diff --git a/gcc/testsuite/g++.dg/warn/pr31246-2.C b/gcc/testsuite/g++.dg/warn/pr31246-2.C
deleted file mode 100644
index c9a4cae..0000000
--- a/gcc/testsuite/g++.dg/warn/pr31246-2.C
+++ /dev/null
@@ -1,9 +0,0 @@
-// PR 31246
-// { dg-do compile }
-// { dg-options "-Wunreachable-code" }
-#include <new>
-
-int* get_ptr(void* ptr)
-{
- return new(ptr) int();
-}
diff --git a/gcc/testsuite/g++.dg/warn/pr31246.C b/gcc/testsuite/g++.dg/warn/pr31246.C
deleted file mode 100644
index f3603af..0000000
--- a/gcc/testsuite/g++.dg/warn/pr31246.C
+++ /dev/null
@@ -1,9 +0,0 @@
-// PR 31246
-// { dg-do compile }
-// { dg-options "-Wunreachable-code -D_GLIBCXX_DEBUG" }
-#include <vector>
-
-int main()
-{
- std::vector<int>::iterator a;
-}
diff --git a/gcc/testsuite/gcc.dg/missing-header-fixit-3.c b/gcc/testsuite/gcc.dg/missing-header-fixit-3.c
new file mode 100644
index 0000000..8f2fb5b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/missing-header-fixit-3.c
@@ -0,0 +1,27 @@
+/* Example of a fix-it hint that adds a #include directive,
+ adding them to the top of the file, given that there is no
+ pre-existing #include. */
+
+/* { dg-options "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } */
+
+void test (int i, int j)
+{
+ printf ("%i of %i\n", i, j); /* { dg-warning "implicit declaration" } */
+ /* { dg-message "include '<stdio.h>' or provide a declaration of 'printf'" "" { target *-*-* } .-1 } */
+#if 0
+/* { dg-begin-multiline-output "" }
+9 | printf ("%i of %i\n", i, j);
+ | ^~~~~~
+ { dg-end-multiline-output "" } */
+/* { dg-regexp ".*missing-header-fixit-3.c:1:1:" } */
+/* { dg-begin-multiline-output "" }
++ |+#include <stdio.h>
+1 | /* Example of a fix-it hint that adds a #include directive,
+ { dg-end-multiline-output "" } */
+/* { dg-regexp ".*missing-header-fixit-3.c:9:3:" } */
+/* { dg-begin-multiline-output "" }
+9 | printf ("%i of %i\n", i, j);
+ | ^~~~~~
+ { dg-end-multiline-output "" } */
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
index 89213eb..f2bbc58 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
@@ -111,7 +111,7 @@ void test_fixit_insert_newline (void)
x = b;
}
/* { dg-begin-multiline-output "" }
- |+ break;
++++ |+ break;
110 | case 'b':
| ^~~~~~~~
{ dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/pr33092.c b/gcc/testsuite/gcc.dg/pr33092.c
deleted file mode 100644
index 8f48fab..0000000
--- a/gcc/testsuite/gcc.dg/pr33092.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O1 -fno-tree-salias" } */
-int foo ()
-{
- return 0;
-}
diff --git a/gcc/testsuite/gcc.dg/pr41837.c b/gcc/testsuite/gcc.dg/pr41837.c
index 1ff9915..de6bd06 100644
--- a/gcc/testsuite/gcc.dg/pr41837.c
+++ b/gcc/testsuite/gcc.dg/pr41837.c
@@ -1,6 +1,6 @@
/* PR middle-end/41837 */
/* { dg-do compile } */
-/* { dg-options "-fipa-struct-reorg -O -fwhole-program -fprofile-generate" } */
+/* { dg-options "-O -fwhole-program -fprofile-generate" } */
typedef struct { int a, b; } T1;
typedef struct S1 *T2;
diff --git a/gcc/testsuite/gcc.dg/pr41841.c b/gcc/testsuite/gcc.dg/pr41841.c
index 595bc75..8bce4e6 100644
--- a/gcc/testsuite/gcc.dg/pr41841.c
+++ b/gcc/testsuite/gcc.dg/pr41841.c
@@ -1,6 +1,6 @@
/* PR tree-optimization/41841 */
/* { dg-do compile } */
-/* { dg-options "-O -fipa-struct-reorg -fwhole-program -fipa-cp" } */
+/* { dg-options "-O -fwhole-program -fipa-cp" } */
typedef struct S *T;
typedef struct { } *U;
diff --git a/gcc/testsuite/gcc.dg/pr42250.c b/gcc/testsuite/gcc.dg/pr42250.c
index 3ba8e84..21b29ba 100644
--- a/gcc/testsuite/gcc.dg/pr42250.c
+++ b/gcc/testsuite/gcc.dg/pr42250.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fipa-struct-reorg" } */
+/* { dg-options "-O2" } */
extern double log10 (double __x);
extern double ceil (double __x);
diff --git a/gcc/testsuite/gcc.dg/pr43084.c b/gcc/testsuite/gcc.dg/pr43084.c
index 2afc484..f70ed86 100644
--- a/gcc/testsuite/gcc.dg/pr43084.c
+++ b/gcc/testsuite/gcc.dg/pr43084.c
@@ -1,6 +1,6 @@
/* PR debug/43084 */
/* { dg-do compile } */
-/* { dg-options "-O1 -fipa-struct-reorg -fwhole-program -fcompare-debug" } */
+/* { dg-options "-O1 -fwhole-program -fcompare-debug" } */
/* { dg-xfail-if "" { powerpc-ibm-aix* } } */
struct S
diff --git a/gcc/testsuite/gcc.dg/pr43317.c b/gcc/testsuite/gcc.dg/pr43317.c
index cc5832a..de81c44 100644
--- a/gcc/testsuite/gcc.dg/pr43317.c
+++ b/gcc/testsuite/gcc.dg/pr43317.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fipa-struct-reorg -fwhole-program -g" } */
+/* { dg-options "-O -fwhole-program -g" } */
extern void *malloc(__SIZE_TYPE__);
diff --git a/gcc/testsuite/gcc.dg/pr51879-18.c b/gcc/testsuite/gcc.dg/pr51879-18.c
index 2944bea..1601225 100644
--- a/gcc/testsuite/gcc.dg/pr51879-18.c
+++ b/gcc/testsuite/gcc.dg/pr51879-18.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre -fno-tree-copy-prop -fno-tree-dominator-opts -fno-tree-copyrename" } */
+/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre -fno-tree-copy-prop -fno-tree-dominator-opts" } */
extern int foo (void);
diff --git a/gcc/testsuite/gcc.dg/torture/pr36066.c b/gcc/testsuite/gcc.dg/torture/pr36066.c
index 0e1d1ce..547806a 100644
--- a/gcc/testsuite/gcc.dg/torture/pr36066.c
+++ b/gcc/testsuite/gcc.dg/torture/pr36066.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-funsafe-loop-optimizations -ftree-vrp" } */
+/* { dg-options "-ftree-vrp" } */
typedef int FLAC__int32;
typedef int FLAC__bool;
diff --git a/gcc/testsuite/gcc.dg/torture/pr52969.c b/gcc/testsuite/gcc.dg/torture/pr52969.c
deleted file mode 100644
index 05331d9..0000000
--- a/gcc/testsuite/gcc.dg/torture/pr52969.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-ftree-loop-if-convert-stores" } */
-
-int a, b;
-float xsum[100];
-void foo (float *cluster)
-{
- int j;
- for (; a ; ++j) {
- xsum[j] = cluster[j];
- if (xsum[j] > 0)
- xsum[j] = 0;
- }
- if (xsum[0])
- b = 0;
-}
diff --git a/gcc/testsuite/gcc.dg/torture/pr86505.c b/gcc/testsuite/gcc.dg/torture/pr86505.c
new file mode 100644
index 0000000..db102d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr86505.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+
+static inline __attribute__(( __always_inline__)) int
+funA(unsigned int param, ...)
+{
+ return __builtin_va_arg_pack_len();
+}
+
+static inline __attribute__(( __always_inline__)) int
+funB(unsigned int param, ...)
+{
+ return funA(param, 2, 4, __builtin_va_arg_pack());
+}
+
+int
+testBuiltin(void)
+{
+ int rc = funB(0,1,2);
+ if (rc != 4)
+ return 1;
+ return 0;
+}
+
+int
+main()
+{
+ int rc = testBuiltin();
+ if (rc == 1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c
new file mode 100644
index 0000000..837b6f4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c
@@ -0,0 +1,119 @@
+/* PR tree-optimization/86853 - sprintf optimization for wide strings
+ doesn't account for conversion failure​
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fdump-tree-optimized" } */
+
+typedef __SIZE_TYPE__ size_t;
+typedef __WCHAR_TYPE__ wchar_t;
+
+extern int snprintf (char*, size_t, const char*, ...);
+
+#define CONCAT(x, y) x ## y
+#define CAT(x, y) CONCAT (x, y)
+#define FAILNAME(name) CAT (call_ ## name ##_on_line_, __LINE__)
+
+#define FAIL(name) do { \
+ extern void FAILNAME (name) (void); \
+ FAILNAME (name)(); \
+ } while (0)
+
+/* Macro to emit a call to funcation named
+ call_in_true_branch_not_eliminated_on_line_NNN()
+ for each call that's expected to be eliminated. The dg-final
+ scan-tree-dump-time directive at the bottom of the test verifies
+ that no such call appears in output. */
+#define ELIM(expr) \
+ if (!(expr)) FAIL (in_true_branch_not_eliminated); else (void)0
+
+/* Macro to emit a call to a function named
+ call_made_in_{true,false}_branch_on_line_NNN()
+ for each call that's expected to be retained. The dg-final
+ scan-tree-dump-time directive at the bottom of the test verifies
+ that the expected number of both kinds of calls appears in output
+ (a pair for each line with the invocation of the KEEP() macro. */
+#define KEEP(expr) \
+ if (expr) \
+ FAIL (made_in_true_branch); \
+ else \
+ FAIL (made_in_false_branch)
+
+
+extern wchar_t wc;
+extern wchar_t ws[];
+
+const wchar_t ws3[] = L"12\xff";
+
+/* Verify that the following calls are eliminated. */
+
+void elim_wide_char_call (void)
+{
+ ELIM (snprintf (0, 0, "%lc", L'\0'));
+ ELIM (snprintf (0, 0, "%lc", L'1'));
+ ELIM (snprintf (0, 0, "%lc", L'a'));
+ ELIM (snprintf (0, 0, "%lc", ws3[0]));
+ ELIM (snprintf (0, 0, "%lc", ws3[1]));
+ ELIM (snprintf (0, 0, "%lc", ws3[3]));
+
+ ELIM (snprintf (0, 0, "%C", L'\0'));
+ ELIM (snprintf (0, 0, "%C", L'9'));
+ ELIM (snprintf (0, 0, "%C", L'z'));
+ ELIM (snprintf (0, 0, "%C", ws3[0]));
+ ELIM (snprintf (0, 0, "%C", ws3[1]));
+ ELIM (snprintf (0, 0, "%C", ws3[3]));
+
+ /* Verify an unknown character value within the ASCII range. */
+ if (wc < 1 || 127 < wc)
+ wc = 0;
+
+ ELIM (snprintf (0, 0, "%C", wc));
+ ELIM (snprintf (0, 0, "%C", wc));
+}
+
+void elim_wide_string_call (void)
+{
+ ELIM (snprintf (0, 0, "%ls", L""));
+}
+
+
+#line 1000
+
+ /* Verify that the following calls are not eliminated. */
+
+void keep_wide_char_call (void)
+{
+ KEEP (snprintf (0, 0, "%lc", L'\xff'));
+ KEEP (snprintf (0, 0, "%lc", L'\xffff'));
+ KEEP (snprintf (0, 0, "%lc", wc));
+ KEEP (snprintf (0, 0, "%lc", ws3[2]));
+
+ KEEP (snprintf (0, 0, "%C", L'\xff'));
+ KEEP (snprintf (0, 0, "%C", L'\xffff'));
+ KEEP (snprintf (0, 0, "%C", wc));
+ KEEP (snprintf (0, 0, "%C", ws3[2]));
+
+ /* Verify an unknown character value outside the ASCII range
+ (with 128 being the only one). */
+ if (wc < 32 || 128 < wc)
+ wc = 32;
+
+ KEEP (snprintf (0, 0, "%lc", wc));
+ KEEP (snprintf (0, 0, "%C", wc));
+}
+
+void keep_wide_string_call (void)
+{
+ KEEP (snprintf (0, 0, "%ls", L"\xff"));
+ KEEP (snprintf (0, 0, "%ls", L"\xffff"));
+ KEEP (snprintf (0, 0, "%ls", ws));
+ KEEP (snprintf (0, 0, "%ls", ws3));
+
+ KEEP (snprintf (0, 0, "%S", L"\xff"));
+ KEEP (snprintf (0, 0, "%S", L"\xffff"));
+ KEEP (snprintf (0, 0, "%S", ws));
+ KEEP (snprintf (0, 0, "%S", ws3));
+}
+
+/* { dg-final { scan-tree-dump-times "call_made_in_true_branch_not_eliminated" 0 "optimized" } }
+
+ { dg-final { scan-tree-dump-times "call_made_in_true_branch_on_line_1\[0-9\]\[0-9\]\[0-9\]" 18 "optimized" } }
+ { dg-final { scan-tree-dump-times "call_made_in_false_branch_on_line_1\[0-9\]\[0-9\]\[0-9\]" 18 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-11.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-11.c
new file mode 100644
index 0000000..e1effe6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-11.c
@@ -0,0 +1,65 @@
+/* PR tree-optimization/86853 - sprintf optimization for wide strings
+ doesn't account for conversion failure​
+ Exercise wide character handling in an EBCDIC execution charset.
+ { dg-do compile }
+ { dg-require-iconv "IBM1047" }
+ { dg-options "-O2 -Wall -Wno-format -Wformat-overflow -fexec-charset=IBM1047 -fdump-tree-optimized" } */
+
+typedef __WCHAR_TYPE__ wchar_t;
+
+/* Exercise wide character constants. */
+
+void test_lc_cst (void)
+{
+ /* IBM1047 0x30 maps to ASCII 0x94 which neeed not be representable
+ in the current locale (and the snprintf() call may fail). Verify
+ that snprintf() doesn't assume it is. */
+ wchar_t wc = 0x30;
+
+ int n = __builtin_snprintf (0, 0, "%lc", wc);
+ if (n < 0)
+ __builtin_abort ();
+}
+
+void test_C_cst (void)
+{
+ /* Same as above but for %C and 0x31 which maps to 0x95. */
+ wchar_t wc = 0x31;
+
+ int n = __builtin_snprintf (0, 0, "%C", wc);
+ if (n < 0)
+ __builtin_abort ();
+}
+
+/* Exercise wide character values in known ranges. */
+
+void test_lc_range (wchar_t wc)
+{
+ if (wc < 0x40 || 0x49 < wc)
+ wc = 0x40;
+
+ int n = __builtin_snprintf (0, 0, "%lc", wc);
+ if (n < 0)
+ __builtin_abort ();
+}
+
+void test_C_range (wchar_t wc)
+{
+ if (wc < 0x41 || 0x48 < wc)
+ wc = 0x41;
+
+ int n = __builtin_snprintf (0, 0, "%C", wc);
+ if (n < 0)
+ __builtin_abort ();
+}
+
+/* Exercise unknown wide character values. */
+
+void test_var (wchar_t wc)
+{
+ int n = __builtin_snprintf (0, 0, "%lc", wc);
+ if (n < 0)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-times "abort" 5 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c
index 961fa48..7064f8a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c
@@ -18,7 +18,7 @@ void test_characters ()
T ("%A", 0.0); /* { dg-warning ".%A. directive writing between 6 and 20 " } */
T ("%a", 0.0); /* { dg-warning ".%a. directive writing between 6 and 20 " } */
- T ("%C", 'a'); /* { dg-warning ".%C. directive writing 1 byte" "bug 80537" { xfail *-*-* } } */
+ T ("%C", L'a'); /* { dg-warning ".%C. directive writing up to 6 bytes" } */
T ("%c", 'a'); /* { dg-warning ".%c. directive writing 1 byte" } */
T ("%d", 12); /* { dg-warning ".%d. directive writing 2 bytes" } */
@@ -93,7 +93,8 @@ void test_characters ()
T ("%x", 1234); /* { dg-warning ".%x. directive writing 3 bytes" } */
T ("%#X", 1235); /* { dg-warning ".%#X. directive writing 5 bytes" } */
- T ("%S", L"1"); /* { dg-warning ".%S. directive writing 1 byte" } */
+ T ("%S", L"1"); /* { dg-warning ".%S. directive writing up to 6 bytes" } */
+ T ("%ls", L"12"); /* { dg-warning ".%ls. directive writing up to 12 bytes" } */
T ("%-s", "1"); /* { dg-warning ".%-s. directive writing 1 byte" } */
/* Verify that characters in the source character set appear in
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-8.c
index c200748..c537580 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ifc-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-8.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-Ofast -fdump-tree-ifcvt-details-blocks -ftree-loop-if-convert-stores" } */
+/* { dg-options "-Ofast -fdump-tree-ifcvt-details-blocks" } */
/* { dg-require-visibility "" } */
#define LEN 4096
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c
index 4932cd7..fce3b77 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-cd.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fdump-tree-ifcvt-details-blocks-details -ftree-loop-if-convert-stores" } */
+/* { dg-options "-O3 -fdump-tree-ifcvt-details-blocks-details" } */
void foo (int *x1, int *x2, int *x3, int *x4, int *y)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c
index 0fa5600..9162d15 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fopt-info-loop-missed -Wunsafe-loop-optimizations" } */
+/* { dg-options "-O2 -fopt-info-loop-missed" } */
extern void g(void);
void
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr45122.c b/gcc/testsuite/gcc.dg/tree-ssa/pr45122.c
index e979b76..969fe0e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr45122.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr45122.c
@@ -2,7 +2,7 @@
/* PR tree-optimization/45122 */
/* { dg-do run } */
-/* { dg-options "-O2 -funsafe-loop-optimizations" } */
+/* { dg-options "-O2" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp
index 369ece7..fc5c1b8 100644
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -262,13 +262,6 @@ et-dg-runtest dg-runtest [lsort \
[glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
"" $DEFAULT_VECTCFLAGS
-# -ftree-loop-if-convert-stores
-set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
-lappend DEFAULT_VECTCFLAGS "-ftree-loop-if-convert-stores"
-et-dg-runtest dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/if-cvt-stores-vect-*.\[cS\]]] \
- "" $DEFAULT_VECTCFLAGS
-
# With -O3.
# Don't allow IPA cloning, because it throws our counts out of whack.
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
diff --git a/gcc/testsuite/gcc.target/aarch64/imm_choice_comparison.c b/gcc/testsuite/gcc.target/aarch64/imm_choice_comparison.c
new file mode 100644
index 0000000..ebc44d6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/imm_choice_comparison.c
@@ -0,0 +1,54 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* Go from four moves to two. */
+
+int
+foo (long long x)
+{
+ return x <= 0x1999999999999998;
+}
+
+int
+GT (unsigned int x)
+{
+ return x > 0xfefffffe;
+}
+
+int
+LE (unsigned int x)
+{
+ return x <= 0xfefffffe;
+}
+
+int
+GE (long long x)
+{
+ return x >= 0xff000000;
+}
+
+int
+LT (int x)
+{
+ return x < 0xff000000;
+}
+
+/* Optimize the immediate in conditionals. */
+
+int
+check (int x, int y)
+{
+ if (x > y && GT (x))
+ return 100;
+
+ return x;
+}
+
+int
+tern (int x)
+{
+ return x >= 0xff000000 ? 5 : -3;
+}
+
+/* baz produces one movk instruction. */
+/* { dg-final { scan-assembler-times "movk" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-cvt-2.c b/gcc/testsuite/gcc.target/i386/avx-cvt-2.c
index 1fbcf6e..672ce06 100644
--- a/gcc/testsuite/gcc.target/i386/avx-cvt-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx-cvt-2.c
@@ -4,9 +4,9 @@
#include "avx-cvt-1.c"
/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 6 "vect" } } */
-/* { dg-final { scan-assembler "vcvttpd2dq(y\[^\n\r\]*%xmm|\[^\n\r\]*xmm\[^\n\r\]*YMMWORD PTR)" } } */
-/* { dg-final { scan-assembler "vcvtdq2ps\[^\n\r\]*ymm" } } */
-/* { dg-final { scan-assembler "vcvtps2pd\[^\n\r\]*(%xmm\[^\n\r\]*%ymm|ymm\[^\n\r\]*xmm)" } } */
-/* { dg-final { scan-assembler "vcvttps2dq\[^\n\r\]*ymm" } } */
-/* { dg-final { scan-assembler "vcvtdq2pd\[^\n\r\]*(%xmm\[^\n\r\]*%ymm|ymm\[^\n\r\]*xmm)" } } */
-/* { dg-final { scan-assembler "vcvtpd2ps(y\[^\n\r\]*%xmm|\[^\n\r\]*xmm\[^\n\r\]*YMMWORD PTR)" } } */
+/* { dg-final { scan-assembler "vcvttpd2dq" } } */
+/* { dg-final { scan-assembler "vcvtdq2ps" } } */
+/* { dg-final { scan-assembler "vcvtps2pd" } } */
+/* { dg-final { scan-assembler "vcvttps2dq" } } */
+/* { dg-final { scan-assembler "vcvtdq2pd" } } */
+/* { dg-final { scan-assembler "vcvtpd2ps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx2-cvt-2.c b/gcc/testsuite/gcc.target/i386/avx2-cvt-2.c
index d37809d..633a1cd 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-cvt-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-cvt-2.c
@@ -4,9 +4,9 @@
#include "avx2-cvt-1.c"
/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 6 "vect" } } */
-/* { dg-final { scan-assembler "vcvttpd2dq(y\[^\n\r\]*%xmm|\[^\n\r\]*xmm\[^\n\r\]*YMMWORD PTR)" } } */
-/* { dg-final { scan-assembler "vcvtdq2ps\[^\n\r\]*ymm" } } */
-/* { dg-final { scan-assembler "vcvtps2pd\[^\n\r\]*(%xmm\[^\n\r\]*%ymm|ymm\[^\n\r\]*xmm)" } } */
-/* { dg-final { scan-assembler "vcvttps2dq\[^\n\r\]*ymm" } } */
-/* { dg-final { scan-assembler "vcvtdq2pd\[^\n\r\]*(%xmm\[^\n\r\]*%ymm|ymm\[^\n\r\]*xmm)" } } */
-/* { dg-final { scan-assembler "vcvtpd2ps(y\[^\n\r\]*%xmm|\[^\n\r\]*xmm\[^\n\r\]*YMMWORD PTR)" } } */
+/* { dg-final { scan-assembler "vcvttpd2dq" } } */
+/* { dg-final { scan-assembler "vcvtdq2ps" } } */
+/* { dg-final { scan-assembler "vcvtps2pd" } } */
+/* { dg-final { scan-assembler "vcvttps2dq" } } */
+/* { dg-final { scan-assembler "vcvtdq2pd" } } */
+/* { dg-final { scan-assembler "vcvtpd2ps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/mpx.c b/gcc/testsuite/gcc.target/i386/mpx.c
index f152ae9..2be96d4 100644
--- a/gcc/testsuite/gcc.target/i386/mpx.c
+++ b/gcc/testsuite/gcc.target/i386/mpx.c
@@ -1,3 +1,3 @@
/* { dg-do compile } */
// { dg-options "-mmpx" }
-// { dg-warning "deprecated command line option .-mmpx." "" { target *-*-* } 0 }
+// { dg-warning "switch .-mmpx. is no longer supported" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/gcc.target/i386/pr45352-2.c b/gcc/testsuite/gcc.target/i386/pr45352-2.c
index 47e428c..216c506 100644
--- a/gcc/testsuite/gcc.target/i386/pr45352-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr45352-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -mtune=amdfam10 -fexpensive-optimizations -fgcse -foptimize-register-move -freorder-blocks -fschedule-insns2 -funswitch-loops -fgcse-las -fselective-scheduling2 -fsel-sched-pipelining -funroll-all-loops" } */
+/* { dg-options "-O1 -mtune=amdfam10 -fexpensive-optimizations -fgcse -freorder-blocks -fschedule-insns2 -funswitch-loops -fgcse-las -fselective-scheduling2 -fsel-sched-pipelining -funroll-all-loops" } */
typedef char uint8_t;
typedef int uint32_t;
diff --git a/gcc/testsuite/gcc.target/i386/zee.c b/gcc/testsuite/gcc.target/i386/zee.c
index 920e056..608f7c9 100644
--- a/gcc/testsuite/gcc.target/i386/zee.c
+++ b/gcc/testsuite/gcc.target/i386/zee.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-O2 -fzee" } */
+/* { dg-options "-O2" } */
/* { dg-final { scan-assembler-not "mov\[\\t \]+\(%\[\^,\]+\),\[\\t \]*\\1" } } */
int mask[100];
int foo(unsigned x)
diff --git a/gcc/testsuite/gfortran.dg/auto_char_len_2.f90 b/gcc/testsuite/gfortran.dg/auto_char_len_2.f90
index 95825c4..e103b6d 100644
--- a/gcc/testsuite/gfortran.dg/auto_char_len_2.f90
+++ b/gcc/testsuite/gfortran.dg/auto_char_len_2.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
+! { dg-options "" }
!
! PR fortran/41235
!
diff --git a/gcc/testsuite/gfortran.dg/auto_char_len_4.f90 b/gcc/testsuite/gfortran.dg/auto_char_len_4.f90
index 72ee845..16789fa 100644
--- a/gcc/testsuite/gfortran.dg/auto_char_len_4.f90
+++ b/gcc/testsuite/gfortran.dg/auto_char_len_4.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-pedantic -fwhole-file" }
!
! Tests the fix for PR25087, in which the following invalid code
! was not detected.
diff --git a/gcc/testsuite/gfortran.dg/c_ptr_tests_15.f90 b/gcc/testsuite/gfortran.dg/c_ptr_tests_15.f90
index 40d1ba3..ced8c59 100644
--- a/gcc/testsuite/gfortran.dg/c_ptr_tests_15.f90
+++ b/gcc/testsuite/gfortran.dg/c_ptr_tests_15.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-fwhole-file -fdump-tree-original" }
+! { dg-options "-fdump-tree-original" }
!
! PR fortran/43042 - fix ICE with c_null_ptr when using
! -fwhole-file (or -flto, which implies -fwhole-file).
diff --git a/gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90 b/gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90
index b675571..ae567dc 100644
--- a/gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90
+++ b/gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90
@@ -1,5 +1,4 @@
! { dg-do run }
-! { dg-options "-fwhole-file" }
!
! PR fortran/19107
! -fwhole-file flag added for PR fortran/44945
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr47331.f90 b/gcc/testsuite/gfortran.dg/gomp/pr47331.f90
index 71713e0..6c29356 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr47331.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr47331.f90
@@ -1,6 +1,6 @@
! PR fortran/47331
! { dg-do compile }
-! { dg-options "-fopenmp -fwhole-file" }
+! { dg-options "-fopenmp" }
subroutine foo
!$omp parallel
diff --git a/gcc/testsuite/gfortran.dg/pr40999.f b/gcc/testsuite/gfortran.dg/pr40999.f
index b6fa85a..7ebb632 100644
--- a/gcc/testsuite/gfortran.dg/pr40999.f
+++ b/gcc/testsuite/gfortran.dg/pr40999.f
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-O3 -fwhole-file" }
+! { dg-options "-O3" }
SUBROUTINE ZLARFG( ALPHA )
COMPLEX*16 ZLADIV
diff --git a/gcc/testsuite/gfortran.dg/pr41011.f b/gcc/testsuite/gfortran.dg/pr41011.f
index 4ad4a8f..83e85fb 100644
--- a/gcc/testsuite/gfortran.dg/pr41011.f
+++ b/gcc/testsuite/gfortran.dg/pr41011.f
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-O3 -fwhole-file" }
+! { dg-options "-O3" }
CALL UVSET(NX,NY,NZ,HVAR,ZET,NP,DZ,DKM,UM,VM,UG,VG,TM,DCDX, ! { dg-warning "Rank mismatch" }
*ITY,ISH,NSMT,F)
CALL DCTDX(NX,NY,NX1,NFILT,C(MLAG),DCDX(MLAG),HELP,HELPA,
diff --git a/gcc/testsuite/gfortran.dg/pr42051.f03 b/gcc/testsuite/gfortran.dg/pr42051.f03
index 7a5be63..8f30e32 100644
--- a/gcc/testsuite/gfortran.dg/pr42051.f03
+++ b/gcc/testsuite/gfortran.dg/pr42051.f03
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fno-whole-file" }
!
! PR fortran/42051
! PR fortran/44064
diff --git a/gcc/testsuite/gfortran.dg/pr46804.f90 b/gcc/testsuite/gfortran.dg/pr46804.f90
index 9297b73..38e4a7e 100644
--- a/gcc/testsuite/gfortran.dg/pr46804.f90
+++ b/gcc/testsuite/gfortran.dg/pr46804.f90
@@ -1,6 +1,6 @@
! PR rtl-optimization/46804
! { dg-do run }
-! { dg-options "-O -fPIC -fexpensive-optimizations -fgcse -foptimize-register-move -fpeel-loops -fno-tree-loop-optimize" }
+! { dg-options "-O -fPIC -fexpensive-optimizations -fgcse -fpeel-loops -fno-tree-loop-optimize" }
program main
integer, parameter :: n1 = 2, n2 = 3, n3 = 4, slen = 3
diff --git a/gcc/testsuite/gfortran.dg/pr83149_1.f90 b/gcc/testsuite/gfortran.dg/pr83149_1.f90
index 3a8f5d5..5b00996 100644
--- a/gcc/testsuite/gfortran.dg/pr83149_1.f90
+++ b/gcc/testsuite/gfortran.dg/pr83149_1.f90
@@ -1,6 +1,5 @@
! Compiled with pr83149.f90
! { dg-do run }
-! { dg-options "-fno-whole-file" }
! { dg-compile-aux-modules "pr83149.f90" }
! { dg-additional-sources pr83149.f90 }
!
diff --git a/gcc/testsuite/gfortran.dg/pr83149_b.f90 b/gcc/testsuite/gfortran.dg/pr83149_b.f90
index f67ffd9..9013617 100644
--- a/gcc/testsuite/gfortran.dg/pr83149_b.f90
+++ b/gcc/testsuite/gfortran.dg/pr83149_b.f90
@@ -1,6 +1,5 @@
! Compiled with pr83149_a.f90
! { dg-do run }
-! { dg-options "-fno-whole-file" }
! { dg-compile-aux-modules "pr83149_a.f90" }
! { dg-additional-sources pr83149_a.f90 }
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_1.f90 b/gcc/testsuite/gfortran.dg/whole_file_1.f90
index 598c9d3..bceb250 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_1.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_1.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
+! { dg-options "" }
! Tests the fix for PR22571 in which the derived types in a, b
! c and d were not detected to be different. In e and f, they
! are the same because they are sequence types.
diff --git a/gcc/testsuite/gfortran.dg/whole_file_10.f90 b/gcc/testsuite/gfortran.dg/whole_file_10.f90
index fb100bb..4d47d9d 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_10.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_10.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
! Test the fix for the fifth problem in PR40011, where the
! entries were not resolved, resulting in a segfault.
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_11.f90 b/gcc/testsuite/gfortran.dg/whole_file_11.f90
index d01b210..9574849 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_11.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_11.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
!
! Tests the fix PR40011 comment 16 in which the derived type lists in
! different program units were getting mixed up.
diff --git a/gcc/testsuite/gfortran.dg/whole_file_12.f90 b/gcc/testsuite/gfortran.dg/whole_file_12.f90
index 150ac5f..23ea102 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_12.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_12.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
!
! Tests the fix PR40011 comment 17 in which the explicit interface was
! being ignored and the missing argument was not correctly handled, which
diff --git a/gcc/testsuite/gfortran.dg/whole_file_13.f90 b/gcc/testsuite/gfortran.dg/whole_file_13.f90
index d0a954f..ffa31c8 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_13.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_13.f90
@@ -1,5 +1,4 @@
! { dg-do run }
-! { dg-options "-fwhole-file -O3" }
! Check that the TYPE_CANONICAL is being correctly set
! for the derived types, when whole file compiling.
! (based on import.f90)
diff --git a/gcc/testsuite/gfortran.dg/whole_file_14.f90 b/gcc/testsuite/gfortran.dg/whole_file_14.f90
index 030e8cd..52c2e7a 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_14.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_14.f90
@@ -1,5 +1,5 @@
! { dg-do run }
-! { dg-options "-fwhole-file -O3" }
+! { dg-options "-O3" }
! Check that the derived types are correctly substituted when
! whole file compiling.
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_15.f90 b/gcc/testsuite/gfortran.dg/whole_file_15.f90
index 9988757..fd9f62d 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_15.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_15.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
! Test the fix for PR43450 in which the use of 'replica_env_type'
! caused an ICE in ep_types
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_16.f90 b/gcc/testsuite/gfortran.dg/whole_file_16.f90
index 6c910f4..c45251e 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_16.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_16.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
!
! PR fortran/31346
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_17.f90 b/gcc/testsuite/gfortran.dg/whole_file_17.f90
index a2a9d15..d0e07dd 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_17.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_17.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-pedantic -fwhole-file" }
+! { dg-options "-pedantic" }
!
! PR fortran/30668
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_18.f90 b/gcc/testsuite/gfortran.dg/whole_file_18.f90
index c483c7d..9d0229a 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_18.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_18.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-fwhole-file -Wno-unused-dummy-argument" }
+! { dg-options "-Wno-unused-dummy-argument" }
!
! PR fortran/34260
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_19.f90 b/gcc/testsuite/gfortran.dg/whole_file_19.f90
index cd69f92..184e028 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_19.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_19.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
! Test the fix for pr40011 comment #42, in which the subroutine
! would just get lost with -fwhole-file.
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_2.f90 b/gcc/testsuite/gfortran.dg/whole_file_2.f90
index c5255a9..60163f4 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_2.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_2.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
+! { dg-options "" }
! Tests the fix for PR26227 in which the interface mismatches
! below were not detected.
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_20.f03 b/gcc/testsuite/gfortran.dg/whole_file_20.f03
index b3f77e4..fd53422 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_20.f03
+++ b/gcc/testsuite/gfortran.dg/whole_file_20.f03
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-fwhole-file -fcoarray=single" }
+! { dg-options "-fcoarray=single" }
!
! Procedures with dummy arguments that are coarrays or polymorphic
! must have an explicit interface in the calling routine.
diff --git a/gcc/testsuite/gfortran.dg/whole_file_3.f90 b/gcc/testsuite/gfortran.dg/whole_file_3.f90
index 242280c..9b4f5a7 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_3.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_3.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
+! { dg-options "" }
! Tests the fix for PR26227 in which the interface mismatches
! below were not detected.
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_4.f90 b/gcc/testsuite/gfortran.dg/whole_file_4.f90
index 671bc2d..2dfb33d 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_4.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_4.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-fwhole-file -std=legacy" }
+! { dg-options "-std=legacy" }
! Tests the fix for PR24886 in which the mismatch between the
! character lengths of the actual and formal arguments of
! 'foo' was not detected.
diff --git a/gcc/testsuite/gfortran.dg/whole_file_5.f90 b/gcc/testsuite/gfortran.dg/whole_file_5.f90
index fa4f06d..61612d4 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_5.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_5.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-O3 -fwhole-file -fdump-tree-optimized" }
+! { dg-options "-O3 -fdump-tree-optimized" }
! { dg-add-options bind_pic_locally }
!
! Check that inlining of functions declared BEFORE usage works.
diff --git a/gcc/testsuite/gfortran.dg/whole_file_6.f90 b/gcc/testsuite/gfortran.dg/whole_file_6.f90
index 771215d..fb961f3 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_6.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_6.f90
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "-O3 -fwhole-file -fdump-tree-optimized" }
+! { dg-options "-O3 -fdump-tree-optimized" }
! { dg-add-options bind_pic_locally }
!
! Check that inlining of functions declared AFTER usage works.
diff --git a/gcc/testsuite/gfortran.dg/whole_file_7.f90 b/gcc/testsuite/gfortran.dg/whole_file_7.f90
index 32253043..80609ca 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_7.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_7.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
! Test the fixes for the first two problems in PR40011
!
! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
diff --git a/gcc/testsuite/gfortran.dg/whole_file_8.f90 b/gcc/testsuite/gfortran.dg/whole_file_8.f90
index 6ea319a..db05c99 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_8.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_8.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
! Test the fix for the third problem in PR40011, where false
! type/rank mismatches were found in the main program calls.
!
diff --git a/gcc/testsuite/gfortran.dg/whole_file_9.f90 b/gcc/testsuite/gfortran.dg/whole_file_9.f90
index 64dce42..17e7059 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_9.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_9.f90
@@ -1,5 +1,4 @@
! { dg-do compile }
-! { dg-options "-fwhole-file" }
! Test the fix for the fourth problem in PR40011, where the
! entries were not resolved, resulting in a segfault.
!
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 6a16ce5..21464d6 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1940,8 +1940,7 @@ copy_bb (copy_body_data *id, basic_block bb,
&& id->call_stmt
&& (decl = gimple_call_fndecl (stmt))
&& DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN
- && ! gimple_call_va_arg_pack_p (id->call_stmt))
+ && DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN)
{
/* __builtin_va_arg_pack_len () should be replaced by
the number of anonymous arguments. */
@@ -1952,10 +1951,22 @@ copy_bb (copy_body_data *id, basic_block bb,
for (p = DECL_ARGUMENTS (id->src_fn); p; p = DECL_CHAIN (p))
nargs--;
- count = build_int_cst (integer_type_node, nargs);
- new_stmt = gimple_build_assign (gimple_call_lhs (stmt), count);
- gsi_replace (&copy_gsi, new_stmt, false);
- stmt = new_stmt;
+ if (!gimple_call_va_arg_pack_p (id->call_stmt))
+ {
+ count = build_int_cst (integer_type_node, nargs);
+ new_stmt = gimple_build_assign (gimple_call_lhs (stmt), count);
+ gsi_replace (&copy_gsi, new_stmt, false);
+ stmt = new_stmt;
+ }
+ else if (nargs != 0)
+ {
+ tree newlhs = create_tmp_reg_or_ssa_name (integer_type_node);
+ count = build_int_cst (integer_type_node, nargs);
+ new_stmt = gimple_build_assign (gimple_call_lhs (stmt),
+ PLUS_EXPR, newlhs, count);
+ gimple_call_set_lhs (stmt, newlhs);
+ gsi_insert_after (&copy_gsi, new_stmt, GSI_NEW_STMT);
+ }
}
else if (call_stmt
&& id->call_stmt
diff --git a/gcc/wide-int-range.cc b/gcc/wide-int-range.cc
index 3491d89..726ec63 100644
--- a/gcc/wide-int-range.cc
+++ b/gcc/wide-int-range.cc
@@ -323,7 +323,7 @@ wide_int_range_lshift (wide_int &res_lb, wide_int &res_ub,
/* Transform left shifts by constants into multiplies. */
if (wi::eq_p (vr1_lb, vr1_ub))
{
- int shift = wi::extract_uhwi (vr1_ub, 0, vr1_ub.get_precision ());
+ unsigned shift = vr1_ub.to_uhwi ();
wide_int tmp = wi::set_bit_in_zero (shift, prec);
return wide_int_range_multiplicative_op (res_lb, res_ub,
MULT_EXPR, sign, prec,
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 2bab8a7..978b32e 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,6 +1,26 @@
+2018-08-17 Nathan Sidwell <nathan@acm.org>
+
+ * cpp-id-data.h (uchar, UC): Move to internal.h
+ (struct cpp_macro): Move to cpplib.h.
+ * internal.h (uchar, UC): From cpp-id-data.h.
+ * include/cpplib.h (struct cpp_macro): From cpp-id-data.h.
+
2018-08-16 Nathan Sidwell <nathan@acm.org>
- libcpp/
+ * internal.h (_cpp_save_parameter): Take parmno, not macro.
+ (_cpp_unsave_parameters): Declare.
+ * macro.c (_cpp_save_parameter): Take parm number, not macro.
+ Return true on success.
+ (_cpp_unsave_parameters): New.
+ (parse_params): Take parm_no and variadic pointers, not macro.
+ Reimplement parsing logic.
+ (create_iso_definition): Adjust parse_params changes. Call
+ _cpp_unsave_parameters here.
+ (_cpp_create_definition): Don't unsave params here.
+ * traditional.c (scan_parameters): Take n_param pointer, adjust.
+ (_cpp_create_trad_definition): Ajust scan_parameters change. Call
+ _cpp_unsave_parameters.
+
* include/cpplib.h (cpp_user_macro_p, cpp_builtin_macro_p)
(cpp_macro_p): New inlines.
* directives.c (do_pragma_poison): Use cpp_macro_p.
diff --git a/libcpp/include/cpp-id-data.h b/libcpp/include/cpp-id-data.h
deleted file mode 100644
index d2fc4b6..0000000
--- a/libcpp/include/cpp-id-data.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Structures that hang off cpp_identifier, for PCH.
- Copyright (C) 1986-2018 Free Software Foundation, Inc.
-
-This program 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 program 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 program; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-#include "cpplib.h"
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 910b6dc..9535d08 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -3047,7 +3047,6 @@ _cpp_free_definition (cpp_hashnode *h)
/* Save parameter NODE (spelling SPELLING) to the parameter list of
macro MACRO. Returns true on success, false on failure. */
-
bool
_cpp_save_parameter (cpp_reader *pfile, unsigned n, cpp_hashnode *node,
cpp_hashnode *spelling)
@@ -3086,7 +3085,6 @@ _cpp_save_parameter (cpp_reader *pfile, unsigned n, cpp_hashnode *node,
}
/* Restore the parameters to their previous state. */
-
void
_cpp_unsave_parameters (cpp_reader *pfile, unsigned n)
{
@@ -3427,6 +3425,7 @@ create_iso_definition (cpp_reader *pfile)
goto out;
}
+ /* We're committed to winning now. */
ok = true;
/* Don't count the CPP_EOF. */
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ce8ccaf..9477a33 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,19 @@
+2018-08-16 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/tr1/legendre_function.tcc (__sph_legendre): Avoid warning
+ about signed/unsigned comparison.
+
+ * include/std/ostream (basic_ostream::sentry::~sentry): Suppress
+ deprecation warnings for using uncaught_exception().
+
+ PR libstdc++/86447
+ * src/c++11/cow-stdexcept.cc [_GLIBCXX_FULLY_DYNAMIC_STRING]
+ (logic_error::logic_error(logic_error&&))
+ (logic_error::operator=(logic_error&&))
+ (runtime_error::runtime_error(runtime_error&&))
+ (runtime_error::operator=(runtime_error&&)): Copy strings instead of
+ moving, to avoid allocating empty reps for moved-from strings.
+
2018-08-15 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/regex: Remove begin/end macros for namespace.
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 448a928..2099294 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -444,6 +444,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit
sentry(basic_ostream<_CharT, _Traits>& __os);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/**
* @brief Possibly flushes the stream.
*
@@ -461,6 +463,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_os.setstate(ios_base::badbit);
}
}
+#pragma GCC diagnostic pop
/**
* @brief Quick status checking.
diff --git a/libstdc++-v3/include/tr1/legendre_function.tcc b/libstdc++-v3/include/tr1/legendre_function.tcc
index 85ca796..e75414c 100644
--- a/libstdc++-v3/include/tr1/legendre_function.tcc
+++ b/libstdc++-v3/include/tr1/legendre_function.tcc
@@ -284,7 +284,7 @@ namespace tr1
_Tp __y_lm = _Tp(0);
// Compute Y_l^m, l > m+1, upward recursion on l.
- for ( int __ll = __m + 2; __ll <= __l; ++__ll)
+ for (unsigned int __ll = __m + 2; __ll <= __l; ++__ll)
{
const _Tp __rat1 = _Tp(__ll - __m) / _Tp(__ll + __m);
const _Tp __rat2 = _Tp(__ll - __m - 1) / _Tp(__ll + __m - 1);
diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc
index 54859d5..d271be5 100644
--- a/libstdc++-v3/src/c++11/cow-stdexcept.cc
+++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc
@@ -57,6 +57,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// These operations are noexcept even though copying a COW string is not,
// but we know that the string member in an exception has not been "leaked"
// so copying is a simple reference count increment.
+ // For the fully dynamic string moves are not noexcept (due to needing to
+ // allocate an empty string) so we just define the moves as copies here.
logic_error::logic_error(const logic_error& e) noexcept
: exception(e), _M_msg(e._M_msg) { }
@@ -64,10 +66,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
logic_error& logic_error::operator=(const logic_error& e) noexcept
{ _M_msg = e._M_msg; return *this; }
+#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
logic_error::logic_error(logic_error&& e) noexcept = default;
logic_error&
logic_error::operator=(logic_error&& e) noexcept = default;
+#else
+ logic_error::logic_error(logic_error&& e) noexcept
+ : exception(e), _M_msg(e._M_msg) { }
+
+ logic_error&
+ logic_error::operator=(logic_error&& e) noexcept
+ { _M_msg = e._M_msg; return *this; }
+#endif
runtime_error::runtime_error(const runtime_error& e) noexcept
: exception(e), _M_msg(e._M_msg) { }
@@ -76,10 +87,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
runtime_error::operator=(const runtime_error& e) noexcept
{ _M_msg = e._M_msg; return *this; }
+#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
runtime_error::runtime_error(runtime_error&& e) noexcept = default;
runtime_error&
runtime_error::operator=(runtime_error&& e) noexcept = default;
+#else
+ runtime_error::runtime_error(runtime_error&& e) noexcept
+ : exception(e), _M_msg(e._M_msg) { }
+
+ runtime_error&
+ runtime_error::operator=(runtime_error&& e) noexcept
+ { _M_msg = e._M_msg; return *this; }
+#endif
// New C++11 constructors: