aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2018-11-08 22:04:26 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-11-08 22:04:26 +0100
commit306e92f648617a8af71b0702664e8c81b6e886f2 (patch)
tree58006b3eb40a7c084a482eab7a707c898a2fb274 /gcc
parentd0803c9e8be97c24e8216ab66753dfbc32428662 (diff)
parentdfe2a550e8879f9af11e8e2c7c4eb10ea626a7e6 (diff)
downloadgcc-306e92f648617a8af71b0702664e8c81b6e886f2.zip
gcc-306e92f648617a8af71b0702664e8c81b6e886f2.tar.gz
gcc-306e92f648617a8af71b0702664e8c81b6e886f2.tar.bz2
svn merge -r265884:265929 svn+ssh://gcc.gnu.org/svn/gcc/trunk
From-SVN: r265936
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog120
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in1
-rw-r--r--gcc/ada/ChangeLog23
-rw-r--r--gcc/ada/fe.h2
-rw-r--r--gcc/ada/gcc-interface/decl.c18
-rw-r--r--gcc/ada/gcc-interface/misc.c14
-rw-r--r--gcc/ada/gcc-interface/trans.c51
-rw-r--r--gcc/ada/gcc-interface/utils.c26
-rw-r--r--gcc/c-family/ChangeLog14
-rw-r--r--gcc/c-family/c-format.c59
-rw-r--r--gcc/c-family/c-format.h1
-rw-r--r--gcc/cgraph.c67
-rw-r--r--gcc/cgraph.h23
-rw-r--r--gcc/cgraphclones.c4
-rw-r--r--gcc/common.opt4
-rwxr-xr-xgcc/configure2
-rw-r--r--gcc/doc/extend.texi2
-rw-r--r--gcc/doc/invoke.texi77
-rw-r--r--gcc/dump-context.h8
-rw-r--r--gcc/dumpfile.c115
-rw-r--r--gcc/expr.c3
-rw-r--r--gcc/ipa-inline.c191
-rw-r--r--gcc/predict.c8
-rw-r--r--gcc/pretty-print.c6
-rw-r--r--gcc/pretty-print.h1
-rw-r--r--gcc/selftest-run-tests.c1
-rw-r--r--gcc/selftest.h1
-rw-r--r--gcc/stor-layout.c21
-rw-r--r--gcc/testsuite/ChangeLog146
-rw-r--r--gcc/testsuite/c-c++-common/patchable_function_entry-decl.c2
-rw-r--r--gcc/testsuite/c-c++-common/patchable_function_entry-default.c2
-rw-r--r--gcc/testsuite/c-c++-common/patchable_function_entry-definition.c2
-rw-r--r--gcc/testsuite/c-c++-common/pr27336.c1
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-12.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/imm-devirt-1.C2
-rw-r--r--gcc/testsuite/g++.dg/lto/pr87906_0.C10
-rw-r--r--gcc/testsuite/g++.dg/lto/pr87906_1.C8
-rw-r--r--gcc/testsuite/g++.dg/other/pr87916.C45
-rw-r--r--gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C2
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/inline-1.C2
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/inline-2.C2
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/inline-3.C2
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/inline-4.C32
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr65595.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wno-attribute-warning.c8
-rw-r--r--gcc/testsuite/gcc.dg/addr_equal-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-10.c2
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/builtin-stringop-chk-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/format/gcc_diag-10.c7
-rw-r--r--gcc/testsuite/gcc.dg/ipa/fopt-info-inline-1.c44
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inline-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inline-7.c6
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inlinehint-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/dump-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/dump-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr26570.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr71969-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr71969-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr87811-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr87811.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr87874.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr87929.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/inline-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/inline-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/inline-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/inline-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-20.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr78154.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp111.c1
-rw-r--r--gcc/testsuite/gcc.target/mips/mips.exp17
-rw-r--r--gcc/testsuite/gcc.target/msp430/pr87691.c41
-rw-r--r--gcc/testsuite/gfortran.dg/pr79966.f902
-rw-r--r--gcc/testsuite/gnat.dg/null_pointer_deref1.adb4
-rw-r--r--gcc/testsuite/gnat.dg/null_pointer_deref2.adb3
-rw-r--r--gcc/testsuite/gnat.dg/null_pointer_deref3.adb3
-rw-r--r--gcc/testsuite/gnat.dg/opt74.adb13
-rw-r--r--gcc/testsuite/gnat.dg/opt74_pkg.adb16
-rw-r--r--gcc/testsuite/gnat.dg/opt74_pkg.ads7
-rw-r--r--gcc/testsuite/gnat.dg/warn12.adb48
-rw-r--r--gcc/testsuite/gnat.dg/warn12_pkg.ads21
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp8
-rw-r--r--gcc/tree-complex.c2
-rw-r--r--gcc/tree-data-ref.c2
-rw-r--r--gcc/tree-data-ref.h11
-rw-r--r--gcc/tree-inline.c20
-rw-r--r--gcc/tree-ssa-phiopt.c25
90 files changed, 1135 insertions, 393 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5d30e60..c3e77f3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,123 @@
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ PR ipa/86395
+ * doc/invoke.texi (-fdump-ipa-): Document the "-optimized",
+ "-missed", "-note", and "-all" sub-options.
+ * ipa-inline.c (caller_growth_limits): Port from fprintf to dump
+ API.
+ (can_early_inline_edge_p): Likewise.
+ (want_early_inline_function_p): Likewise.
+ (want_inline_self_recursive_call_p): Likewise.
+ (recursive_inlining): Likewise.
+ (inline_small_functions): Likewise.
+ (flatten_function): Likewise.
+ (ipa_inline): Likewise.
+ (inline_always_inline_functions): Likewise.
+ (early_inline_small_functions): Likewise.
+ (early_inliner): Likewise.
+ * tree-inline.c (expand_call_inline): Likewise.
+
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ * pretty-print.c (pp_format): Handle %f.
+ (selftest::test_pp_format): Add test of %f.
+ * pretty-print.h (pp_double): New macro.
+
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ * dump-context.h (ASSERT_IS_CGRAPH_NODE): New macro.
+ * dumpfile.c (make_item_for_dump_cgraph_node): Move to before...
+ (dump_pretty_printer::decode_format): Implement "%C" for
+ cgraph_node *.
+ (selftest::test_capture_of_dump_calls): Rename "where" to
+ "stmt_loc". Convert test_decl to a function decl and set its
+ location. Add a symbol_table_test RAII instance and a
+ cgraph_node, using it to test "%C" and dump_symtab_node.
+
+2018-11-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR middle-end/87916
+ * cgraphclones.c (duplicate_thunk_for_node): Also set DECL_IGNORED_P.
+
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ * cgraph.c: Include "selftest.h".
+ (saved_symtab): New variable.
+ (selftest::symbol_table_test::symbol_table_test): New ctor.
+ (selftest::symbol_table_test::~symbol_table_test): New dtor.
+ (selftest::test_symbol_table_test): New test.
+ (selftest::cgraph_c_tests): New.
+ * cgraph.h (saved_symtab): New decl.
+ (selftest::symbol_table_test): New class.
+ * selftest-run-tests.c (selftest::run_tests): Call
+ selftest::cgraph_c_tests.
+ * selftest.h (selftest::cgraph_c_tests): New decl.
+
+2018-11-08 Richard Biener <rguenther@suse.de>
+
+ * tree-data-ref.h (lambda_int): New typedef.
+ (lambda_vector_gcd): Adjust.
+ (lambda_vector_new): Likewise.
+ (lambda_matrix_new): Likewise.
+ * tree-data-ref.c (print_lambda_vector): Adjust.
+
+2018-11-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87929
+ * tree-complex.c (expand_complex_comparison): Clean EH.
+
+2018-11-08 Martin Liska <mliska@suse.cz>
+
+ * doc/extend.texi: Reword.
+ * predict.c (expr_expected_value_1): Likewise.
+
+2018-11-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87913
+ * tree-ssa-phiopt.c (minmax_replacement): Turn EQ/NE compares
+ of extreme values to ordered comparisons.
+
+2018-11-07 Sandra Loosemore <sandra@codesourcery.com>
+
+ PR middle-end/42726
+ * doc/invoke.texi (Code Gen Options): Clarify -fno-common behavior.
+
+2018-11-07 Sandra Loosemore <sandra@codesourcery.com>
+
+ * doc/invoke.texi: Remove leading dash from @opindex entries
+ throughout the file.
+
+2018-11-07 Sandra Loosemore <sandra@codesourcery.com>
+
+ PR driver/80828
+ * doc/invoke.texi (Option Summary): Add -e and --entry.
+ (Link Options): Likewise.
+
+2018-11-07 Nathan Sidwell <nathan@acm.org>
+
+ PR 87926
+ * Makefile.in (bitmap.o-warn): Add -Wno-error to unbreak
+ --disable-checking bootstrap.
+
+2018-11-07 Hafiz Abid Qadeer <abidh@codesourcery.com>
+
+ * configure: Regenerated.
+
+2018-11-07 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ PR c/87691
+ * stor-layout.c (compute_record_mode): Set TYPE_MODE of UNION_TYPE
+ to the mode of the widest field iff the widest field has mode class
+ MODE_INT, or MODE_PARTIAL_INT and the union would be passed by
+ reference.
+
+2018-11-07 Nikolai Merinov <n.merinov@inango-systems.com>
+
+ * common.opt: Add -Wattribute-warning.
+ * doc/invoke.texi: Add documentation for -Wno-attribute-warning.
+ * expr.c (expand_expr_real_1): Add new attribute to warning_at
+ call to allow user configure behavior of "warning" attribute.
+
2018-11-07 Segher Boessenkool <segher@kernel.crashing.org>
* target.def: Put @: after every vs., e.g., and i.e. where it is
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index dccc962..6277b96 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20181107
+20181108
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 74e9895..16c9ed6 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -221,6 +221,7 @@ libgcov-merge-tool.o-warn = -Wno-error
gimple-match.o-warn = -Wno-unused
generic-match.o-warn = -Wno-unused
dfp.o-warn = -Wno-strict-aliasing
+bitmap.o-warn = -Wno-error # PR 87926
# All warnings have to be shut off in stage1 if the compiler used then
# isn't gcc; configure determines that. WARN_CFLAGS will be either
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 7366612..ee8ba62 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,26 @@
+2018-11-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * fe.h (Suppress_Checks): Declare.
+ * gcc-interface/misc.c (gnat_init_gcc_eh): Set -fnon-call-exceptions
+ only if checks are not suppressed and -faggressive-loop-optimizations
+ only if they are.
+ * gcc-interface/trans.c (struct loop_info_d): Remove has_checks and
+ warned_aggressive_loop_optimizations fields.
+ (gigi): Do not clear warn_aggressive_loop_optimizations here.
+ (Raise_Error_to_gnu): Do not set has_checks.
+ (gnat_to_gnu) <N_Indexed_Component>: Remove support for aggressive
+ loop optimizations.
+
+2018-11-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (components_to_record): Remove obsolete kludge.
+ * gcc-interface/utils.c (make_packable_type): Set TYPE_PACKED on the
+ new type but do not take into account the setting on the old type for
+ the new fields. Rename a local variable.
+ (finish_record_type): Clear DECL_BIT_FIELD_TYPE on a variant part at
+ offset 0, if any.
+ (create_field_decl): Tweak comment.
+
2018-10-22 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (unchecked_convert): Use local variables for
diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
index b0ccbdc..d4c4265 100644
--- a/gcc/ada/fe.h
+++ b/gcc/ada/fe.h
@@ -193,6 +193,7 @@ extern Boolean In_Same_Source_Unit (Node_Id, Node_Id);
#define GNAT_Mode opt__gnat_mode
#define List_Representation_Info opt__list_representation_info
#define No_Strict_Aliasing_CP opt__no_strict_aliasing
+#define Suppress_Checks opt__suppress_checks
typedef enum {
Front_End_SJLJ, Back_End_ZCX, Back_End_SJLJ
@@ -207,6 +208,7 @@ extern Boolean Generate_SCO_Instance_Table;
extern Boolean GNAT_Mode;
extern Int List_Representation_Info;
extern Boolean No_Strict_Aliasing_CP;
+extern Boolean Suppress_Checks;
#define ZCX_Exceptions opt__zcx_exceptions
#define SJLJ_Exceptions opt__sjlj_exceptions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index c658aac..d8fb8ee 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -8146,23 +8146,7 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type,
/* Chain the variant part at the end of the field list. */
if (gnu_variant_part)
- {
- /* We make an exception if the variant part is at offset 0, has a fixed
- size, and there is a single rep'ed field placed after it because, in
- this case, there is an obvious order of increasing position. */
- if (variants_have_rep
- && TREE_CODE (DECL_SIZE_UNIT (gnu_variant_part)) == INTEGER_CST
- && gnu_rep_list
- && gnu_field_list == gnu_rep_list
- && !tree_int_cst_lt (DECL_FIELD_OFFSET (gnu_rep_list),
- DECL_SIZE_UNIT (gnu_variant_part)))
- {
- DECL_CHAIN (gnu_variant_part) = gnu_field_list;
- gnu_field_list = gnu_variant_part;
- }
- else
- gnu_field_list = chainon (gnu_field_list, gnu_variant_part);
- }
+ gnu_field_list = chainon (gnu_field_list, gnu_variant_part);
if (cancel_alignment)
SET_TYPE_ALIGN (gnu_record_type, 0);
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 98ec277..eadbd36 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -392,7 +392,7 @@ gnat_init_gcc_eh (void)
using_eh_for_cleanups ();
/* Turn on -fexceptions, -fnon-call-exceptions and -fdelete-dead-exceptions.
- The first one triggers the generation of the necessary exception tables.
+ The first one activates the support for exceptions in the compiler.
The second one is useful for two reasons: 1/ we map some asynchronous
signals like SEGV to exceptions, so we need to ensure that the insns
which can lead to such signals are correctly attached to the exception
@@ -402,10 +402,18 @@ gnat_init_gcc_eh (void)
for such calls to actually raise in Ada.
The third one is an optimization that makes it possible to delete dead
instructions that may throw exceptions, most notably loads and stores,
- as permitted in Ada. */
+ as permitted in Ada.
+ Turn off -faggressive-loop-optimizations because it may optimize away
+ out-of-bound array accesses that we want to be able to catch.
+ If checks are disabled, we use the same settings as the C++ compiler. */
flag_exceptions = 1;
- flag_non_call_exceptions = 1;
flag_delete_dead_exceptions = 1;
+ if (!Suppress_Checks)
+ {
+ flag_non_call_exceptions = 1;
+ flag_aggressive_loop_optimizations = 0;
+ warn_aggressive_loop_optimizations = 0;
+ }
init_eh ();
}
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index ce2d43f..2cd7102 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -198,8 +198,6 @@ struct GTY(()) loop_info_d {
tree high_bound;
vec<range_check_info, va_gc> *checks;
bool artificial;
- bool has_checks;
- bool warned_aggressive_loop_optimizations;
};
typedef struct loop_info_d *loop_info;
@@ -679,10 +677,6 @@ gigi (Node_Id gnat_root,
/* Now translate the compilation unit proper. */
Compilation_Unit_to_gnu (gnat_root);
- /* Disable -Waggressive-loop-optimizations since we implement our own
- version of the warning. */
- warn_aggressive_loop_optimizations = 0;
-
/* Then process the N_Validate_Unchecked_Conversion nodes. We do this at
the very end to avoid having to second-guess the front-end when we run
into dummy nodes during the regular processing. */
@@ -5720,7 +5714,6 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
rci->inserted_cond
= build1 (SAVE_EXPR, boolean_type_node, boolean_true_node);
vec_safe_push (loop->checks, rci);
- loop->has_checks = true;
gnu_cond = build_noreturn_cond (gnat_to_gnu (gnat_cond));
if (flag_unswitch_loops)
gnu_cond = build_binary_op (TRUTH_ANDIF_EXPR,
@@ -5733,14 +5726,6 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
gnu_cond,
rci->inserted_cond);
}
-
- /* Or else, if aggressive loop optimizations are enabled, we just
- record that there are checks applied to iteration variables. */
- else if (optimize
- && flag_aggressive_loop_optimizations
- && inside_loop_p ()
- && (loop = find_loop_for (gnu_index)))
- loop->has_checks = true;
}
break;
@@ -6359,45 +6344,9 @@ gnat_to_gnu (Node_Id gnat_node)
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
gnat_temp = gnat_expr_array[i];
gnu_expr = maybe_character_value (gnat_to_gnu (gnat_temp));
- struct loop_info_d *loop;
gnu_result
= build_binary_op (ARRAY_REF, NULL_TREE, gnu_result, gnu_expr);
-
- /* Array accesses are bound-checked so they cannot trap, but this
- is valid only if they are not hoisted ahead of the check. We
- need to mark them as no-trap to get decent loop optimizations
- in the presence of -fnon-call-exceptions, so we do it when we
- know that the original expression had no side-effects. */
- if (TREE_CODE (gnu_result) == ARRAY_REF
- && !(Nkind (gnat_temp) == N_Identifier
- && Ekind (Entity (gnat_temp)) == E_Constant))
- TREE_THIS_NOTRAP (gnu_result) = 1;
-
- /* If aggressive loop optimizations are enabled, we warn for loops
- overrunning a simple array of size 1 not at the end of a record.
- This is aimed to catch misuses of the trailing array idiom. */
- if (optimize
- && flag_aggressive_loop_optimizations
- && inside_loop_p ()
- && TREE_CODE (TREE_TYPE (gnu_type)) != ARRAY_TYPE
- && TREE_CODE (gnu_array_object) != ARRAY_REF
- && tree_int_cst_equal (TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_type)),
- TYPE_MAX_VALUE (TYPE_DOMAIN (gnu_type)))
- && !array_at_struct_end_p (gnu_result)
- && (loop = find_loop_for (gnu_expr))
- && !loop->artificial
- && !loop->has_checks
- && tree_int_cst_equal (TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_type)),
- loop->low_bound)
- && can_be_lower_p (loop->low_bound, loop->high_bound)
- && !loop->warned_aggressive_loop_optimizations
- && warning (OPT_Waggressive_loop_optimizations,
- "out-of-bounds access may be optimized away"))
- {
- inform (EXPR_LOCATION (loop->stmt), "containing loop");
- loop->warned_aggressive_loop_optimizations = true;
- }
}
gnu_result_type = get_unpadded_type (Etype (gnat_node));
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index e7dfb41..05959d6 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -973,6 +973,7 @@ make_packable_type (tree type, bool in_record, unsigned int max_align)
Note that we rely on the pointer equality created here for
TYPE_NAME to look through conversions in various places. */
TYPE_NAME (new_type) = TYPE_NAME (type);
+ TYPE_PACKED (new_type) = 1;
TYPE_JUSTIFIED_MODULAR_P (new_type) = TYPE_JUSTIFIED_MODULAR_P (type);
TYPE_CONTAINS_TEMPLATE_P (new_type) = TYPE_CONTAINS_TEMPLATE_P (type);
TYPE_REVERSE_STORAGE_ORDER (new_type) = TYPE_REVERSE_STORAGE_ORDER (type);
@@ -1018,7 +1019,7 @@ make_packable_type (tree type, bool in_record, unsigned int max_align)
for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
{
tree new_field_type = TREE_TYPE (field);
- tree new_field, new_size;
+ tree new_field, new_field_size;
if (RECORD_OR_UNION_TYPE_P (new_field_type)
&& !TYPE_FAT_POINTER_P (new_field_type)
@@ -1034,14 +1035,15 @@ make_packable_type (tree type, bool in_record, unsigned int max_align)
&& !TYPE_FAT_POINTER_P (new_field_type)
&& !TYPE_CONTAINS_TEMPLATE_P (new_field_type)
&& TYPE_ADA_SIZE (new_field_type))
- new_size = TYPE_ADA_SIZE (new_field_type);
+ new_field_size = TYPE_ADA_SIZE (new_field_type);
else
- new_size = DECL_SIZE (field);
+ new_field_size = DECL_SIZE (field);
+ /* This is a layout with full representation, alignment and size clauses
+ so we simply pass 0 as PACKED like gnat_to_gnu_field in this case. */
new_field
= create_field_decl (DECL_NAME (field), new_field_type, new_type,
- new_size, bit_position (field),
- TYPE_PACKED (type),
+ new_field_size, bit_position (field), 0,
!DECL_NONADDRESSABLE_P (field));
DECL_INTERNAL_P (new_field) = DECL_INTERNAL_P (field);
@@ -1896,6 +1898,14 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
DECL_BIT_FIELD (field) = 0;
}
+ /* Clear DECL_BIT_FIELD_TYPE for a variant part at offset 0, it's simply
+ not supported by the DECL_BIT_FIELD_REPRESENTATIVE machinery because
+ the variant part is always the last field in the list. */
+ if (DECL_INTERNAL_P (field)
+ && TREE_CODE (TREE_TYPE (field)) == QUAL_UNION_TYPE
+ && integer_zerop (pos))
+ DECL_BIT_FIELD_TYPE (field) = NULL_TREE;
+
/* If we still have DECL_BIT_FIELD set at this point, we know that the
field is technically not addressable. Except that it can actually
be addressed if it is BLKmode and happens to be properly aligned. */
@@ -2725,9 +2735,9 @@ create_field_decl (tree name, tree type, tree record_type, tree size, tree pos,
size = round_up (size, BITS_PER_UNIT);
}
- /* If we may, according to ADDRESSABLE, make a bitfield if a size is
+ /* If we may, according to ADDRESSABLE, make a bitfield when the size is
specified for two reasons: first if the size differs from the natural
- size. Second, if the alignment is insufficient. There are a number of
+ size; second, if the alignment is insufficient. There are a number of
ways the latter can be true.
We never make a bitfield if the type of the field has a nonconstant size,
@@ -2735,7 +2745,7 @@ create_field_decl (tree name, tree type, tree record_type, tree size, tree pos,
We do *preventively* make a bitfield when there might be the need for it
but we don't have all the necessary information to decide, as is the case
- of a field with no specified position in a packed record.
+ of a field in a packed record.
We also don't look at STRICT_ALIGNMENT here, and rely on later processing
in layout_decl or finish_record_type to clear the bit_field indication if
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index fbafb9d..ac23539 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,17 @@
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ * c-format.c (gcc_dump_printf_char_table): Add entry for %f.
+
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ * c-format.c (local_cgraph_node_ptr_node): New variable.
+ (gcc_dump_printf_char_table): Add entry for %C.
+ (get_pointer_to_named_type): New function, taken from the handling
+ code for "gimple *" from...
+ (init_dynamic_diag_info): ...here. Add handling for
+ "cgraph_node *".
+ * c-format.h (T_CGRAPH_NODE): New.
+
2018-10-19 Jason Merrill <jason@redhat.com>
* c-cppbuiltin.c (c_cpp_builtins): Add
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index dc937c6..6613092 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -60,6 +60,7 @@ struct function_format_info
/* Initialized in init_dynamic_diag_info. */
static GTY(()) tree local_tree_type_node;
static GTY(()) tree local_gimple_ptr_node;
+static GTY(()) tree local_cgraph_node_ptr_node;
static GTY(()) tree locus;
static bool decode_format_attr (tree, function_format_info *, int);
@@ -803,9 +804,15 @@ static const format_char_info gcc_dump_printf_char_table[] =
/* E and G require a "gimple *" argument at runtime. */
{ "EG", 1, STD_C89, { T89_G, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "\"", NULL },
+ /* C requires a "cgraph_node *" argument at runtime. */
+ { "C", 1, STD_C89, { T_CGRAPH_NODE, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "\"", NULL },
+
/* T requires a "tree" at runtime. */
{ "T", 1, STD_C89, { T89_T, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "\"", NULL },
+ /* %f requires a "double"; it doesn't support modifiers. */
+ { "f", 0, STD_C89, { T89_D, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "\"", NULL },
+
{ NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
};
@@ -3882,6 +3889,33 @@ init_dynamic_gfc_info (void)
}
}
+/* Lookup the type named NAME and return a pointer-to-NAME type if found.
+ Otherwise, return void_type_node if NAME has not been used yet, or NULL_TREE if
+ NAME is not a type (issuing an error). */
+
+static tree
+get_pointer_to_named_type (const char *name)
+{
+ tree result;
+ if ((result = maybe_get_identifier (name)))
+ {
+ result = identifier_global_value (result);
+ if (result)
+ {
+ if (TREE_CODE (result) != TYPE_DECL)
+ {
+ error ("%qs is not defined as a type", name);
+ result = NULL_TREE;
+ }
+ else
+ result = TREE_TYPE (result);
+ }
+ }
+ else
+ result = void_type_node;
+ return result;
+}
+
/* Determine the types of "tree" and "location_t" in the code being
compiled for use in GCC's diagnostic custom format attributes. You
must have set dynamic_format_types before calling this function. */
@@ -3935,25 +3969,12 @@ init_dynamic_diag_info (void)
/* Similar to the above but for gimple*. */
if (!local_gimple_ptr_node
|| local_gimple_ptr_node == void_type_node)
- {
- if ((local_gimple_ptr_node = maybe_get_identifier ("gimple")))
- {
- local_gimple_ptr_node
- = identifier_global_value (local_gimple_ptr_node);
- if (local_gimple_ptr_node)
- {
- if (TREE_CODE (local_gimple_ptr_node) != TYPE_DECL)
- {
- error ("%<gimple%> is not defined as a type");
- local_gimple_ptr_node = 0;
- }
- else
- local_gimple_ptr_node = TREE_TYPE (local_gimple_ptr_node);
- }
- }
- else
- local_gimple_ptr_node = void_type_node;
- }
+ local_gimple_ptr_node = get_pointer_to_named_type ("gimple");
+
+ /* Similar to the above but for cgraph_node*. */
+ if (!local_cgraph_node_ptr_node
+ || local_cgraph_node_ptr_node == void_type_node)
+ local_cgraph_node_ptr_node = get_pointer_to_named_type ("cgraph_node");
static tree hwi;
diff --git a/gcc/c-family/c-format.h b/gcc/c-family/c-format.h
index d984d10..eabb4f0 100644
--- a/gcc/c-family/c-format.h
+++ b/gcc/c-family/c-format.h
@@ -299,6 +299,7 @@ struct format_kind_info
#define T99_UC { STD_C99, NULL, T_UC }
#define T_V &void_type_node
#define T89_G { STD_C89, NULL, &local_gimple_ptr_node }
+#define T_CGRAPH_NODE { STD_C89, NULL, &local_cgraph_node_ptr_node }
#define T89_T { STD_C89, NULL, &local_tree_type_node }
#define T89_V { STD_C89, NULL, T_V }
#define T_W &wchar_type_node
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index b432f7e..b3dd429 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimplify.h"
#include "stringpool.h"
#include "attribs.h"
+#include "selftest.h"
/* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. */
#include "tree-pass.h"
@@ -3765,4 +3766,70 @@ cgraph_edge::sreal_frequency ()
: caller->count);
}
+/* A stashed copy of "symtab" for use by selftest::symbol_table_test.
+ This needs to be a global so that it can be a GC root, and thus
+ prevent the stashed copy from being garbage-collected if the GC runs
+ during a symbol_table_test. */
+
+symbol_table *saved_symtab;
+
+#if CHECKING_P
+
+namespace selftest {
+
+/* class selftest::symbol_table_test. */
+
+/* Constructor. Store the old value of symtab, and create a new one. */
+
+symbol_table_test::symbol_table_test ()
+{
+ gcc_assert (saved_symtab == NULL);
+ saved_symtab = symtab;
+ symtab = new (ggc_cleared_alloc <symbol_table> ()) symbol_table ();
+}
+
+/* Destructor. Restore the old value of symtab. */
+
+symbol_table_test::~symbol_table_test ()
+{
+ gcc_assert (saved_symtab != NULL);
+ symtab = saved_symtab;
+ saved_symtab = NULL;
+}
+
+/* Verify that symbol_table_test works. */
+
+static void
+test_symbol_table_test ()
+{
+ /* Simulate running two selftests involving symbol tables. */
+ for (int i = 0; i < 2; i++)
+ {
+ symbol_table_test stt;
+ tree test_decl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL,
+ get_identifier ("test_decl"),
+ build_function_type_list (void_type_node,
+ NULL_TREE));
+ cgraph_node *node = cgraph_node::get_create (test_decl);
+ gcc_assert (node);
+
+ /* Verify that the node has order 0 on both iterations,
+ and thus that nodes have predictable dump names in selftests. */
+ ASSERT_EQ (node->order, 0);
+ ASSERT_STREQ (node->dump_name (), "test_decl/0");
+ }
+}
+
+/* Run all of the selftests within this file. */
+
+void
+cgraph_c_tests ()
+{
+ test_symbol_table_test ();
+}
+
+} // namespace selftest
+
+#endif /* CHECKING_P */
+
#include "gt-cgraph.h"
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index c13d798..0215522 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -3353,4 +3353,27 @@ xstrdup_for_dump (const char *transient_str)
return ggc_strdup (transient_str);
}
+extern GTY(()) symbol_table *saved_symtab;
+
+#if CHECKING_P
+
+namespace selftest {
+
+/* An RAII-style class for use in selftests for temporarily using a different
+ symbol_table, so that such tests can be isolated from each other. */
+
+class symbol_table_test
+{
+ public:
+ /* Constructor. Override "symtab". */
+ symbol_table_test ();
+
+ /* Destructor. Restore the saved_symtab. */
+ ~symbol_table_test ();
+};
+
+} // namespace selftest
+
+#endif /* CHECKING_P */
+
#endif /* GCC_CGRAPH_H */
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index e17959c..0fbc7a9 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -321,6 +321,10 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
"artificial_thunk");
SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
+ /* We need to force DECL_IGNORED_P because the new thunk is created after
+ early debug was run. */
+ DECL_IGNORED_P (new_decl) = 1;
+
new_thunk = cgraph_node::create (new_decl);
set_new_clone_decl_and_node_flags (new_thunk);
new_thunk->definition = true;
diff --git a/gcc/common.opt b/gcc/common.opt
index 2971dc2..5a5d332 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -571,6 +571,10 @@ Wcpp
Common Var(warn_cpp) Init(1) Warning
Warn when a #warning directive is encountered.
+Wattribute-warning
+Common Var(warn_attribute_warning) Init(1) Warning
+Warn about uses of __attribute__((warning)) declarations.
+
Wdeprecated-declarations
Common Var(warn_deprecated_decl) Init(1) Warning
Warn about uses of __attribute__((deprecated)) declarations.
diff --git a/gcc/configure b/gcc/configure
index a24221d..b814484 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -10833,7 +10833,7 @@ rm -f core conftest.err conftest.$ac_objext \
if test "$am_cv_func_iconv" != yes; then
am_save_CPPFLAGS="$CPPFLAGS"
am_save_LIBS="$LIBS"
- CPPFLAGS="$LIBS $INCICONV"
+ CPPFLAGS="$CPPFLAGS $INCICONV"
LIBS="$LIBS $LIBICONV"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 8de92da..dc8fc6e 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -12047,7 +12047,7 @@ This function has the same semantics as @code{__builtin_expect},
but the caller provides the expected probability that @var{exp} == @var{c}.
The last argument, @var{probability}, is a floating-point value in the
range 0.0 to 1.0, inclusive. The @var{probability} argument must be
-a compiler time constant.
+constant floating-point expression.
@end deftypefn
@deftypefn {Built-in Function} void __builtin_trap (void)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 5f67982..24136eb 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -292,6 +292,7 @@ Objective-C and Objective-C++ Dialects}.
-Wclobbered -Wcomment -Wconditionally-supported @gol
-Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
-Wdelete-incomplete @gol
+-Wno-attribute-warning @gol
-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
-Wdisabled-optimization @gol
-Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
@@ -523,6 +524,7 @@ Objective-C and Objective-C++ Dialects}.
@xref{Link Options,,Options for Linking}.
@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
-nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
+-e @var{entry} --entry=@var{entry} @gol
-pie -pthread -r -rdynamic @gol
-s -static -static-pie -static-libgcc -static-libstdc++ @gol
-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
@@ -2932,7 +2934,7 @@ union U @{
@item -Wabi-tag @r{(C++ and Objective-C++ only)}
@opindex Wabi-tag
-@opindex -Wabi-tag
+@opindex Wabi-tag
Warn when a type with an ABI tag is used in a context that does not
have that ABI tag. See @ref{C++ Attributes} for more information
about ABI tags.
@@ -3843,7 +3845,7 @@ a left margin is printed, showing line numbers. This option suppresses this
left margin.
@item -fdiagnostics-minimum-margin-width=@var{width}
-@opindex -fdiagnostics-minimum-margin-width
+@opindex fdiagnostics-minimum-margin-width
This option controls the minimum width of the left margin printed by
@option{-fdiagnostics-show-line-numbers}. It defaults to 6.
@@ -5732,8 +5734,8 @@ larger.
This option warns on all uses of @code{alloca} in the source.
@item -Walloca-larger-than=@var{byte-size}
-@opindex -Walloca-larger-than=
-@opindex -Wno-alloca-larger-than
+@opindex Walloca-larger-than=
+@opindex Wno-alloca-larger-than
This option warns on calls to @code{alloca} with an integer argument whose
value is either zero, or that is not bounded by a controlling predicate
that limits its value to at most @var{byte-size}. It also warns for calls
@@ -6659,8 +6661,8 @@ real to lower precision real values. This option is also enabled by
@option{-Wconversion}.
@item -Wno-scalar-storage-order
-@opindex -Wno-scalar-storage-order
-@opindex -Wscalar-storage-order
+@opindex Wno-scalar-storage-order
+@opindex Wscalar-storage-order
Do not warn on suspicious constructs involving reverse scalar storage order.
@item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
@@ -6978,6 +6980,15 @@ confused with the digit 0, and so is not the default, but may be
useful as a local coding convention if the programming environment
cannot be fixed to display these characters distinctly.
+@item -Wno-attribute-warning
+@opindex Wno-attribute-warning
+@opindex Wattribute-warning
+Do not warn about usage of functions (@pxref{Function Attributes})
+declared with @code{warning} attribute. By default, this warning is
+enabled. @option{-Wno-attribute-warning} can be used to disable the
+warning or @option{-Wno-error=attribute-warning} can be used to
+disable the error when compiled with @option{-Werror} flag.
+
@item -Wno-deprecated
@opindex Wno-deprecated
@opindex Wdeprecated
@@ -7252,8 +7263,8 @@ Warn if a variable-length array is used in the code.
the variable-length array.
@item -Wvla-larger-than=@var{byte-size}
-@opindex -Wvla-larger-than=
-@opindex -Wno-vla-larger-than
+@opindex Wvla-larger-than=
+@opindex Wno-vla-larger-than
If this option is used, the compiler will warn for declarations of
variable-length arrays whose size is either unbounded, or bounded
by an argument that allows the array size to exceed @var{byte-size}
@@ -8931,13 +8942,13 @@ it may significantly increase code size
This flag is enabled by default at @option{-O3}.
@item -fipa-bit-cp
-@opindex -fipa-bit-cp
+@opindex fipa-bit-cp
When enabled, perform interprocedural bitwise constant
propagation. This flag is enabled by default at @option{-O2}. It
requires that @option{-fipa-cp} is enabled.
@item -fipa-vrp
-@opindex -fipa-vrp
+@opindex fipa-vrp
When enabled, perform interprocedural propagation of value
ranges. This flag is enabled by default at @option{-O2}. It requires
that @option{-fipa-cp} is enabled.
@@ -12548,7 +12559,7 @@ object file names should not be used as arguments. @xref{Overall
Options}.
@item -flinker-output=@var{type}
-@opindex -flinker-output
+@opindex flinker-output
This option controls the code generation of the link time optimizer. By
default the linker output is determined by the linker plugin automatically. For
debugging the compiler and in the case of incremental linking to non-lto object
@@ -12702,6 +12713,15 @@ library subroutines.
constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
GNU Compiler Collection (GCC) Internals}.)
+@item -e @var{entry}
+@itemx --entry=@var{entry}
+@opindex e
+@opindex entry
+
+Specify that the program entry point is @var{entry}. The argument is
+interpreted by the linker; the GNU linker accepts either a symbol name
+or an address.
+
@item -pie
@opindex pie
Produce a dynamically linked position independent executable on targets
@@ -13274,7 +13294,7 @@ C, and on some targets may carry a speed or code size penalty on
variable references.
The @option{-fno-common} option specifies that the compiler should instead
-place uninitialized global variables in the data section of the object file.
+place uninitialized global variables in the BSS section of the object file.
This inhibits the merging of tentative definitions by the linker so
you get a multiple-definition error if the same
variable is defined in more than one compilation unit.
@@ -14065,6 +14085,7 @@ instruction numbers for the links to the previous and next instructions
in a sequence.
@item -fdump-ipa-@var{switch}
+@itemx -fdump-ipa-@var{switch}-@var{options}
@opindex fdump-ipa
Control the dumping at various stages of inter-procedural analysis
language tree to a file. The file name is generated by appending a
@@ -14085,6 +14106,18 @@ Dump after function inlining.
@end table
+Additionally, the options @option{-optimized}, @option{-missed},
+@option{-note}, and @option{-all} can be provided, with the same meaning
+as for @option{-fopt-info}, defaulting to @option{-optimized}.
+
+For example, @option{-fdump-ipa-inline-optimized-missed} will emit
+information on callsites that were inlined, along with callsites
+that were not inlined.
+
+By default, the dump will contain messages about successful
+optimizations (equivalent to @option {-optimized}) together with
+low-level details about the analysis.
+
@item -fdump-lang-all
@itemx -fdump-lang-@var{switch}
@itemx -fdump-lang-@var{switch}-@var{options}
@@ -15085,8 +15118,8 @@ single precision and to 32 bits for double precision.
@item -mlow-precision-sqrt
@itemx -mno-low-precision-sqrt
-@opindex -mlow-precision-sqrt
-@opindex -mno-low-precision-sqrt
+@opindex mlow-precision-sqrt
+@opindex mno-low-precision-sqrt
Enable or disable the square root approximation.
This option only has an effect if @option{-ffast-math} or
@option{-funsafe-math-optimizations} is used as well. Enabling this reduces
@@ -15096,8 +15129,8 @@ If enabled, it implies @option{-mlow-precision-recip-sqrt}.
@item -mlow-precision-div
@itemx -mno-low-precision-div
-@opindex -mlow-precision-div
-@opindex -mno-low-precision-div
+@opindex mlow-precision-div
+@opindex mno-low-precision-div
Enable or disable the division approximation.
This option only has an effect if @option{-ffast-math} or
@option{-funsafe-math-optimizations} is used as well. Enabling this reduces
@@ -18089,11 +18122,11 @@ Specify the C-SKY target processor. Valid values for @var{cpu} are:
@item -mbig-endian
@opindex mbig-endian
@itemx -EB
-@opindex -EB
+@opindex EB
@itemx -mlittle-endian
@opindex mlittle-endian
@itemx -EL
-@opindex -EL
+@opindex EL
Select big- or little-endian code. The default is little-endian.
@@ -27930,7 +27963,7 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@opindex mvaes
@need 200
@itemx -mwaitpkg
-@opindex -mwaitpkg
+@opindex mwaitpkg
@need 200
@itemx -mvpclmulqdq
@opindex mvpclmulqdq
@@ -28516,7 +28549,7 @@ prevents the compiler from using floating-point, vector, mask and bound
registers.
@item -mindirect-branch=@var{choice}
-@opindex -mindirect-branch
+@opindex mindirect-branch
Convert indirect call and jump with @var{choice}. The default is
@samp{keep}, which keeps indirect call and jump unmodified.
@samp{thunk} converts indirect call and jump to call and return thunk.
@@ -28536,7 +28569,7 @@ Note that @option{-mindirect-branch=thunk-extern} is incompatible with
to disable control-flow check.
@item -mfunction-return=@var{choice}
-@opindex -mfunction-return
+@opindex mfunction-return
Convert function return with @var{choice}. The default is @samp{keep},
which keeps function return unmodified. @samp{thunk} converts function
return to call and return thunk. @samp{thunk-inline} converts function
@@ -28553,7 +28586,7 @@ not be reachable in the large code model.
@item -mindirect-branch-register
-@opindex -mindirect-branch-register
+@opindex mindirect-branch-register
Force indirect call and jump via register.
@end table
diff --git a/gcc/dump-context.h b/gcc/dump-context.h
index 3a45f23..ace139c 100644
--- a/gcc/dump-context.h
+++ b/gcc/dump-context.h
@@ -251,6 +251,14 @@ verify_item (const location &loc,
(EXPECTED_LOCATION), (EXPECTED_TEXT)); \
SELFTEST_END_STMT
+/* Verify that ITEM is a symtab node, with the expected values. */
+
+#define ASSERT_IS_SYMTAB_NODE(ITEM, EXPECTED_LOCATION, EXPECTED_TEXT) \
+ SELFTEST_BEGIN_STMT \
+ verify_item (SELFTEST_LOCATION, (ITEM), OPTINFO_ITEM_KIND_SYMTAB_NODE, \
+ (EXPECTED_LOCATION), (EXPECTED_TEXT)); \
+ SELFTEST_END_STMT
+
} // namespace selftest
#endif /* CHECKING_P */
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 0b140ff..09c2490 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -748,6 +748,18 @@ dump_context::dump_generic_expr_loc (dump_flags_t dump_kind,
dump_generic_expr (dump_kind, extra_dump_flags, t);
}
+/* Make an item for the given dump call. */
+
+static optinfo_item *
+make_item_for_dump_symtab_node (symtab_node *node)
+{
+ location_t loc = DECL_SOURCE_LOCATION (node->decl);
+ optinfo_item *item
+ = new optinfo_item (OPTINFO_ITEM_KIND_SYMTAB_NODE, loc,
+ xstrdup (node->dump_name ()));
+ return item;
+}
+
/* dump_pretty_printer's ctor. */
dump_pretty_printer::dump_pretty_printer (dump_context *context,
@@ -881,6 +893,8 @@ dump_pretty_printer::format_decoder_cb (pretty_printer *pp, text_info *text,
Supported format codes (in addition to the standard pretty_printer ones)
are:
+ %C: cgraph_node *:
+ Equivalent to: dump_symtab_node (MSG_*, node)
%E: gimple *:
Equivalent to: dump_gimple_expr (MSG_*, TDF_SLIM, stmt, 0)
%G: gimple *:
@@ -888,7 +902,9 @@ dump_pretty_printer::format_decoder_cb (pretty_printer *pp, text_info *text,
%T: tree:
Equivalent to: dump_generic_expr (MSG_*, arg, TDF_SLIM).
- FIXME: add symtab_node?
+ TODO: add a format code that can handle (symtab_node*) *and* both
+ subclasses (presumably means teaching -Wformat about non-virtual
+ subclasses).
These format codes build optinfo_item instances, thus capturing metadata
about the arguments being dumped, as well as the textual output. */
@@ -901,6 +917,16 @@ dump_pretty_printer::decode_format (text_info *text, const char *spec,
for later use (to capture metadata, rather than plain text). */
switch (*spec)
{
+ case 'C':
+ {
+ cgraph_node *node = va_arg (*text->args_ptr, cgraph_node *);
+
+ /* Make an item for the node, and stash it. */
+ optinfo_item *item = make_item_for_dump_symtab_node (node);
+ stash_item (buffer_ptr, item);
+ return true;
+ }
+
case 'E':
{
gimple *stmt = va_arg (*text->args_ptr, gimple *);
@@ -1023,18 +1049,6 @@ dump_context::dump_dec (dump_flags_t dump_kind, const poly_int<N, C> &value)
delete item;
}
-/* Make an item for the given dump call. */
-
-static optinfo_item *
-make_item_for_dump_symtab_node (symtab_node *node)
-{
- location_t loc = DECL_SOURCE_LOCATION (node->decl);
- optinfo_item *item
- = new optinfo_item (OPTINFO_ITEM_KIND_SYMTAB_NODE, loc,
- xstrdup (node->dump_name ()));
- return item;
-}
-
/* Output the name of NODE on appropriate dump streams. */
void
@@ -2067,18 +2081,26 @@ test_capture_of_dump_calls (const line_table_case &case_)
linemap_add (line_table, LC_ENTER, false, "test.txt", 0);
linemap_line_start (line_table, 5, 100);
linemap_add (line_table, LC_LEAVE, false, NULL, 0);
- location_t where = linemap_position_for_column (line_table, 10);
- if (where > LINE_MAP_MAX_LOCATION_WITH_COLS)
+ location_t decl_loc = linemap_position_for_column (line_table, 8);
+ location_t stmt_loc = linemap_position_for_column (line_table, 10);
+ if (stmt_loc > LINE_MAP_MAX_LOCATION_WITH_COLS)
return;
- dump_location_t loc = dump_location_t::from_location_t (where);
+ dump_location_t loc = dump_location_t::from_location_t (stmt_loc);
gimple *stmt = gimple_build_return (NULL);
- gimple_set_location (stmt, where);
+ gimple_set_location (stmt, stmt_loc);
- tree test_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+ tree test_decl = build_decl (decl_loc, FUNCTION_DECL,
get_identifier ("test_decl"),
- integer_type_node);
+ build_function_type_list (void_type_node,
+ NULL_TREE));
+
+ symbol_table_test tmp_symtab;
+
+ cgraph_node *node = cgraph_node::get_create (test_decl);
+ gcc_assert (node);
+
/* Run all tests twice, with and then without optinfo enabled, to ensure
that immediate destinations vs optinfo-based destinations both
work, independently of each other, with no leaks. */
@@ -2135,7 +2157,7 @@ test_capture_of_dump_calls (const line_table_case &case_)
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 2);
ASSERT_IS_TEXT (info->get_item (0), "gimple: ");
- ASSERT_IS_GIMPLE (info->get_item (1), where, "return;");
+ ASSERT_IS_GIMPLE (info->get_item (1), stmt_loc, "return;");
}
}
@@ -2153,7 +2175,25 @@ test_capture_of_dump_calls (const line_table_case &case_)
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 2);
ASSERT_IS_TEXT (info->get_item (0), "gimple: ");
- ASSERT_IS_GIMPLE (info->get_item (1), where, "return;\n");
+ ASSERT_IS_GIMPLE (info->get_item (1), stmt_loc, "return;\n");
+ }
+ }
+
+ /* Test of dump_printf with %C. */
+ {
+ temp_dump_context tmp (with_optinfo, true,
+ MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
+ dump_printf (MSG_NOTE, "node: %C", node);
+
+ ASSERT_DUMPED_TEXT_EQ (tmp, "node: test_decl/0");
+ if (with_optinfo)
+ {
+ optinfo *info = tmp.get_pending_optinfo ();
+ ASSERT_TRUE (info != NULL);
+ ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
+ ASSERT_EQ (info->num_items (), 2);
+ ASSERT_IS_TEXT (info->get_item (0), "node: ");
+ ASSERT_IS_SYMTAB_NODE (info->get_item (1), decl_loc, "test_decl/0");
}
}
@@ -2184,8 +2224,8 @@ test_capture_of_dump_calls (const line_table_case &case_)
ASSERT_IS_TEXT (info->get_item (2), " and ");
ASSERT_IS_TREE (info->get_item (3), UNKNOWN_LOCATION, "test_decl");
ASSERT_IS_TEXT (info->get_item (4), " 42 consecutive ");
- ASSERT_IS_GIMPLE (info->get_item (5), where, "return;");
- ASSERT_IS_GIMPLE (info->get_item (6), where, "return;");
+ ASSERT_IS_GIMPLE (info->get_item (5), stmt_loc, "return;");
+ ASSERT_IS_GIMPLE (info->get_item (6), stmt_loc, "return;");
ASSERT_IS_TEXT (info->get_item (7), " after\n");
}
}
@@ -2202,7 +2242,7 @@ test_capture_of_dump_calls (const line_table_case &case_)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
- ASSERT_EQ (info->get_location_t (), where);
+ ASSERT_EQ (info->get_location_t (), stmt_loc);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 2);
ASSERT_IS_TEXT (info->get_item (0), "test of tree: ");
@@ -2221,7 +2261,7 @@ test_capture_of_dump_calls (const line_table_case &case_)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
- ASSERT_EQ (info->get_location_t (), where);
+ ASSERT_EQ (info->get_location_t (), stmt_loc);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_TREE (info->get_item (0), UNKNOWN_LOCATION, "1");
@@ -2242,7 +2282,7 @@ test_capture_of_dump_calls (const line_table_case &case_)
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
- ASSERT_IS_GIMPLE (info->get_item (0), where, "return;\n");
+ ASSERT_IS_GIMPLE (info->get_item (0), stmt_loc, "return;\n");
}
}
@@ -2258,7 +2298,7 @@ test_capture_of_dump_calls (const line_table_case &case_)
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
- ASSERT_IS_GIMPLE (info->get_item (0), where, "return;\n");
+ ASSERT_IS_GIMPLE (info->get_item (0), stmt_loc, "return;\n");
}
}
@@ -2274,7 +2314,7 @@ test_capture_of_dump_calls (const line_table_case &case_)
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
- ASSERT_IS_GIMPLE (info->get_item (0), where, "return;");
+ ASSERT_IS_GIMPLE (info->get_item (0), stmt_loc, "return;");
}
}
@@ -2290,11 +2330,28 @@ test_capture_of_dump_calls (const line_table_case &case_)
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
- ASSERT_IS_GIMPLE (info->get_item (0), where, "return;");
+ ASSERT_IS_GIMPLE (info->get_item (0), stmt_loc, "return;");
}
}
}
+ /* symtab_node. */
+ {
+ temp_dump_context tmp (with_optinfo, true,
+ MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
+ dump_symtab_node (MSG_NOTE, node);
+
+ ASSERT_DUMPED_TEXT_EQ (tmp, "test_decl/0");
+ if (with_optinfo)
+ {
+ optinfo *info = tmp.get_pending_optinfo ();
+ ASSERT_TRUE (info != NULL);
+ ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
+ ASSERT_EQ (info->num_items (), 1);
+ ASSERT_IS_SYMTAB_NODE (info->get_item (0), decl_loc, "test_decl/0");
+ }
+ }
+
/* poly_int. */
{
temp_dump_context tmp (with_optinfo, true,
diff --git a/gcc/expr.c b/gcc/expr.c
index 03e5dc4..6341c5a 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10930,7 +10930,8 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
DECL_ATTRIBUTES (fndecl))) != NULL)
{
const char *ident = lang_hooks.decl_printable_name (fndecl, 1);
- warning_at (tree_nonartificial_location (exp), 0,
+ warning_at (tree_nonartificial_location (exp),
+ OPT_Wattribute_warning,
"%Kcall to %qs declared with attribute warning: %s",
exp, identifier_to_locale (ident),
TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index bcd1653..e04ede7 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -227,20 +227,21 @@ caller_growth_limits (struct cgraph_edge *e)
static void
report_inline_failed_reason (struct cgraph_edge *e)
{
- if (dump_file)
+ if (dump_enabled_p ())
{
- fprintf (dump_file, " not inlinable: %s -> %s, %s\n",
- e->caller->dump_name (),
- e->callee->dump_name (),
- cgraph_inline_failed_string (e->inline_failed));
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ " not inlinable: %C -> %C, %s\n",
+ e->caller, e->callee,
+ cgraph_inline_failed_string (e->inline_failed));
if ((e->inline_failed == CIF_TARGET_OPTION_MISMATCH
|| e->inline_failed == CIF_OPTIMIZATION_MISMATCH)
&& e->caller->lto_file_data
&& e->callee->ultimate_alias_target ()->lto_file_data)
{
- fprintf (dump_file, " LTO objects: %s, %s\n",
- e->caller->lto_file_data->file_name,
- e->callee->ultimate_alias_target ()->lto_file_data->file_name);
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ " LTO objects: %s, %s\n",
+ e->caller->lto_file_data->file_name,
+ e->callee->ultimate_alias_target ()->lto_file_data->file_name);
}
if (e->inline_failed == CIF_TARGET_OPTION_MISMATCH)
cl_target_option_print_diff
@@ -569,8 +570,9 @@ can_early_inline_edge_p (struct cgraph_edge *e)
if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (e->caller->decl))
|| !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (callee->decl)))
{
- if (dump_file)
- fprintf (dump_file, " edge not inlinable: not in SSA form\n");
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ " edge not inlinable: not in SSA form\n");
return false;
}
if (!can_inline_edge_p (e, true, true)
@@ -630,34 +632,34 @@ want_early_inline_function_p (struct cgraph_edge *e)
else if (!e->maybe_hot_p ()
&& growth > 0)
{
- if (dump_file)
- fprintf (dump_file, " will not early inline: %s->%s, "
- "call is cold and code would grow by %i\n",
- e->caller->dump_name (),
- callee->dump_name (),
- growth);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ " will not early inline: %C->%C, "
+ "call is cold and code would grow by %i\n",
+ e->caller, callee,
+ growth);
want_inline = false;
}
else if (growth > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS))
{
- if (dump_file)
- fprintf (dump_file, " will not early inline: %s->%s, "
- "growth %i exceeds --param early-inlining-insns\n",
- e->caller->dump_name (),
- callee->dump_name (),
- growth);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ " will not early inline: %C->%C, "
+ "growth %i exceeds --param early-inlining-insns\n",
+ e->caller, callee,
+ growth);
want_inline = false;
}
else if ((n = num_calls (callee)) != 0
&& growth * (n + 1) > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS))
{
- if (dump_file)
- fprintf (dump_file, " will not early inline: %s->%s, "
- "growth %i exceeds --param early-inlining-insns "
- "divided by number of calls\n",
- e->caller->dump_name (),
- callee->dump_name (),
- growth);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ " will not early inline: %C->%C, "
+ "growth %i exceeds --param early-inlining-insns "
+ "divided by number of calls\n",
+ e->caller, callee,
+ growth);
want_inline = false;
}
}
@@ -936,8 +938,9 @@ want_inline_self_recursive_call_p (struct cgraph_edge *edge,
want_inline = false;
}
}
- if (!want_inline && dump_file)
- fprintf (dump_file, " not inlining recursively: %s\n", reason);
+ if (!want_inline && dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, edge->call_stmt,
+ " not inlining recursively: %s\n", reason);
return want_inline;
}
@@ -1562,14 +1565,14 @@ recursive_inlining (struct cgraph_edge *edge,
if (!master_clone)
return false;
- if (dump_file)
- fprintf (dump_file,
- "\n Inlined %i times, "
- "body grown from size %i to %i, time %f to %f\n", n,
- ipa_fn_summaries->get (master_clone)->size,
- ipa_fn_summaries->get (node)->size,
- ipa_fn_summaries->get (master_clone)->time.to_double (),
- ipa_fn_summaries->get (node)->time.to_double ());
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, edge->call_stmt,
+ "\n Inlined %i times, "
+ "body grown from size %i to %i, time %f to %f\n", n,
+ ipa_fn_summaries->get (master_clone)->size,
+ ipa_fn_summaries->get (node)->size,
+ ipa_fn_summaries->get (master_clone)->time.to_double (),
+ ipa_fn_summaries->get (node)->time.to_double ());
/* Remove master clone we used for inlining. We rely that clones inlined
into master clone gets queued just before master clone so we don't
@@ -2078,17 +2081,20 @@ inline_small_functions (void)
update_callee_keys (&edge_heap, n, updated_nodes);
bitmap_clear (updated_nodes);
- if (dump_file)
+ if (dump_enabled_p ())
{
ipa_fn_summary *s = ipa_fn_summaries->get (edge->caller);
- fprintf (dump_file,
- " Inlined %s into %s which now has time %f and size %i, "
- "net change of %+i.\n",
- xstrdup_for_dump (edge->callee->name ()),
- xstrdup_for_dump (edge->caller->name ()),
- s->time.to_double (),
- s->size,
- overall_size - old_size);
+
+ /* dump_printf can't handle %+i. */
+ char buf_net_change[100];
+ snprintf (buf_net_change, sizeof buf_net_change, "%+i",
+ overall_size - old_size);
+
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, edge->call_stmt,
+ " Inlined %C into %C which now has time %f and "
+ "size %i, net change of %s.\n",
+ edge->callee, edge->caller,
+ s->time.to_double (), s->size, buf_net_change);
}
if (min_size > overall_size)
{
@@ -2101,11 +2107,11 @@ inline_small_functions (void)
}
free_growth_caches ();
- if (dump_file)
- fprintf (dump_file,
- "Unit growth for small function inlining: %i->%i (%i%%)\n",
- initial_size, overall_size,
- initial_size ? overall_size * 100 / (initial_size) - 100: 0);
+ if (dump_enabled_p ())
+ dump_printf (MSG_NOTE,
+ "Unit growth for small function inlining: %i->%i (%i%%)\n",
+ initial_size, overall_size,
+ initial_size ? overall_size * 100 / (initial_size) - 100: 0);
symtab->remove_edge_removal_hook (edge_removal_hook_holder);
}
@@ -2130,11 +2136,10 @@ flatten_function (struct cgraph_node *node, bool early)
/* We've hit cycle? It is time to give up. */
if (callee->aux)
{
- if (dump_file)
- fprintf (dump_file,
- "Not inlining %s into %s to avoid cycle.\n",
- xstrdup_for_dump (callee->name ()),
- xstrdup_for_dump (e->caller->name ()));
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ "Not inlining %C into %C to avoid cycle.\n",
+ callee, e->caller);
if (cgraph_inline_failed_type (e->inline_failed) != CIF_FINAL_ERROR)
e->inline_failed = CIF_RECURSIVE_INLINING;
continue;
@@ -2159,25 +2164,27 @@ flatten_function (struct cgraph_node *node, bool early)
if (e->recursive_p ())
{
- if (dump_file)
- fprintf (dump_file, "Not inlining: recursive call.\n");
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ "Not inlining: recursive call.\n");
continue;
}
if (gimple_in_ssa_p (DECL_STRUCT_FUNCTION (node->decl))
!= gimple_in_ssa_p (DECL_STRUCT_FUNCTION (callee->decl)))
{
- if (dump_file)
- fprintf (dump_file, "Not inlining: SSA form does not match.\n");
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ "Not inlining: SSA form does not match.\n");
continue;
}
/* Inline the edge and flatten the inline clone. Avoid
recursing through the original node if the node was cloned. */
- if (dump_file)
- fprintf (dump_file, " Inlining %s into %s.\n",
- xstrdup_for_dump (callee->name ()),
- xstrdup_for_dump (e->caller->name ()));
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, e->call_stmt,
+ " Inlining %C into %C.\n",
+ callee, e->caller);
orig_callee = callee;
inline_call (e, true, NULL, NULL, false);
if (e->callee != orig_callee)
@@ -2589,13 +2596,12 @@ ipa_inline (void)
/* Free ipa-prop structures if they are no longer needed. */
ipa_free_all_structures_after_iinln ();
+ if (dump_enabled_p ())
+ dump_printf (MSG_NOTE,
+ "\nInlined %i calls, eliminated %i functions\n\n",
+ ncalls_inlined, nfunctions_inlined);
if (dump_file)
- {
- fprintf (dump_file,
- "\nInlined %i calls, eliminated %i functions\n\n",
- ncalls_inlined, nfunctions_inlined);
- dump_inline_stats ();
- }
+ dump_inline_stats ();
if (dump_file)
ipa_dump_fn_summaries (dump_file);
@@ -2618,9 +2624,10 @@ inline_always_inline_functions (struct cgraph_node *node)
if (e->recursive_p ())
{
- if (dump_file)
- fprintf (dump_file, " Not inlining recursive call to %s.\n",
- e->callee->name ());
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ " Not inlining recursive call to %C.\n",
+ e->callee);
e->inline_failed = CIF_RECURSIVE_INLINING;
continue;
}
@@ -2636,10 +2643,10 @@ inline_always_inline_functions (struct cgraph_node *node)
continue;
}
- if (dump_file)
- fprintf (dump_file, " Inlining %s into %s (always_inline).\n",
- xstrdup_for_dump (e->callee->name ()),
- xstrdup_for_dump (e->caller->name ()));
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, e->call_stmt,
+ " Inlining %C into %C (always_inline).\n",
+ e->callee, e->caller);
inline_call (e, true, NULL, NULL, false);
inlined = true;
}
@@ -2675,27 +2682,29 @@ early_inline_small_functions (struct cgraph_node *node)
&& !opt_for_fn (node->decl, flag_inline_functions))
continue;
- if (dump_file)
- fprintf (dump_file, "Considering inline candidate %s.\n",
- callee->name ());
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, e->call_stmt,
+ "Considering inline candidate %C.\n",
+ callee);
if (!can_early_inline_edge_p (e))
continue;
if (e->recursive_p ())
{
- if (dump_file)
- fprintf (dump_file, " Not inlining: recursive call.\n");
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, e->call_stmt,
+ " Not inlining: recursive call.\n");
continue;
}
if (!want_early_inline_function_p (e))
continue;
- if (dump_file)
- fprintf (dump_file, " Inlining %s into %s.\n",
- xstrdup_for_dump (callee->name ()),
- xstrdup_for_dump (e->caller->name ()));
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, e->call_stmt,
+ " Inlining %C into %C.\n",
+ callee, e->caller);
inline_call (e, true, NULL, NULL, false);
inlined = true;
}
@@ -2755,9 +2764,9 @@ early_inliner (function *fun)
{
/* When the function is marked to be flattened, recursively inline
all calls in it. */
- if (dump_file)
- fprintf (dump_file,
- "Flattening %s\n", node->name ());
+ if (dump_enabled_p ())
+ dump_printf (MSG_OPTIMIZED_LOCATIONS,
+ "Flattening %C\n", node);
flatten_function (node, true);
inlined = true;
}
diff --git a/gcc/predict.c b/gcc/predict.c
index 80a8d68..8482737 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2470,8 +2470,8 @@ expr_expected_value_1 (tree type, tree op0, enum tree_code code,
if (TREE_CODE (r) != REAL_CST)
{
error_at (gimple_location (def),
- "probability argument %qE must be a compile "
- "time constant", prob);
+ "probability %qE must be "
+ "constant floating-point expression", prob);
return NULL;
}
HOST_WIDE_INT probi
@@ -2483,8 +2483,8 @@ expr_expected_value_1 (tree type, tree op0, enum tree_code code,
}
else
error_at (gimple_location (def),
- "probability argument %qE must be a in the "
- "range 0.0 to 1.0", prob);
+ "probability %qE is outside "
+ "the range [0.0, 1.0]", prob);
return gimple_call_arg (def, 1);
}
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index 7dd900b..19ef75b 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -977,6 +977,7 @@ pp_indent (pretty_printer *pp)
%ld, %li, %lo, %lu, %lx: long versions of the above.
%lld, %lli, %llo, %llu, %llx: long long versions.
%wd, %wi, %wo, %wu, %wx: HOST_WIDE_INT versions.
+ %f: double
%c: character.
%s: string.
%p: pointer (printed in a host-dependent manner).
@@ -1307,6 +1308,10 @@ pp_format (pretty_printer *pp, text_info *text)
(pp, *text->args_ptr, precision, unsigned, "u");
break;
+ case 'f':
+ pp_double (pp, va_arg (*text->args_ptr, double));
+ break;
+
case 'Z':
{
int *v = va_arg (*text->args_ptr, int *);
@@ -2160,6 +2165,7 @@ test_pp_format ()
ASSERT_PP_FORMAT_2 ("17 12345678", "%wo %x", (HOST_WIDE_INT)15, 0x12345678);
ASSERT_PP_FORMAT_2 ("0xcafebabe 12345678", "%wx %x", (HOST_WIDE_INT)0xcafebabe,
0x12345678);
+ ASSERT_PP_FORMAT_2 ("1.000000 12345678", "%f %x", 1.0, 0x12345678);
ASSERT_PP_FORMAT_2 ("A 12345678", "%c %x", 'A', 0x12345678);
ASSERT_PP_FORMAT_2 ("hello world 12345678", "%s %x", "hello world",
0x12345678);
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index 2decc51..a6e60f1 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -330,6 +330,7 @@ pp_get_prefix (const pretty_printer *pp) { return pp->prefix; }
pp_string (PP, pp_buffer (PP)->digit_buffer); \
} \
while (0)
+#define pp_double(PP, F) pp_scalar (PP, "%f", F)
#define pp_pointer(PP, P) pp_scalar (PP, "%p", P)
#define pp_identifier(PP, ID) pp_string (PP, (pp_translate_identifiers (PP) \
diff --git a/gcc/selftest-run-tests.c b/gcc/selftest-run-tests.c
index 562ada7..6d65d24 100644
--- a/gcc/selftest-run-tests.c
+++ b/gcc/selftest-run-tests.c
@@ -73,6 +73,7 @@ selftest::run_tests ()
unique_ptr_tests_cc_tests ();
opt_proposer_c_tests ();
json_cc_tests ();
+ cgraph_c_tests ();
optinfo_emit_json_cc_tests ();
opt_problem_cc_tests ();
diff --git a/gcc/selftest.h b/gcc/selftest.h
index 8da7c4a..4e4c755 100644
--- a/gcc/selftest.h
+++ b/gcc/selftest.h
@@ -215,6 +215,7 @@ class test_runner
alphabetical order. */
extern void attribute_c_tests ();
extern void bitmap_c_tests ();
+extern void cgraph_c_tests ();
extern void diagnostic_c_tests ();
extern void diagnostic_show_locus_c_tests ();
extern void dumpfile_c_tests ();
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 42df257..4f32317 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1834,7 +1834,13 @@ compute_record_mode (tree type)
/* If this field is the whole struct, remember its mode so
that, say, we can put a double in a class into a DF
register instead of forcing it to live in the stack. */
- if (simple_cst_equal (TYPE_SIZE (type), DECL_SIZE (field)))
+ if (simple_cst_equal (TYPE_SIZE (type), DECL_SIZE (field))
+ /* Partial int types (e.g. __int20) may have TYPE_SIZE equal to
+ wider types (e.g. int32), despite precision being less. Ensure
+ that the TYPE_MODE of the struct does not get set to the partial
+ int mode if there is a wider type also in the struct. */
+ && known_gt (GET_MODE_PRECISION (DECL_MODE (field)),
+ GET_MODE_PRECISION (mode)))
mode = DECL_MODE (field);
/* With some targets, it is sub-optimal to access an aligned
@@ -1844,10 +1850,17 @@ compute_record_mode (tree type)
}
/* If we only have one real field; use its mode if that mode's size
- matches the type's size. This only applies to RECORD_TYPE. This
- does not apply to unions. */
+ matches the type's size. This generally only applies to RECORD_TYPE.
+ For UNION_TYPE, if the widest field is MODE_INT then use that mode.
+ If the widest field is MODE_PARTIAL_INT, and the union will be passed
+ by reference, then use that mode. */
poly_uint64 type_size;
- if (TREE_CODE (type) == RECORD_TYPE
+ if ((TREE_CODE (type) == RECORD_TYPE
+ || (TREE_CODE (type) == UNION_TYPE
+ && (GET_MODE_CLASS (mode) == MODE_INT
+ || (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT
+ && targetm.calls.pass_by_reference (pack_cumulative_args (0),
+ mode, type, 0)))))
&& mode != VOIDmode
&& poly_int_tree_p (TYPE_SIZE (type), &type_size)
&& known_eq (GET_MODE_BITSIZE (mode), type_size))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9bb807e..5d24473 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,149 @@
+2018-11-08 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.dg/pr87874.c (em): Declare uint64_max as
+ const unsigned long long int.
+
+2018-11-08 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ * gcc.dg/attr-alloc_size-10.c: Fix calculation of USHRT_MAX to prevent
+ integer overflow when sizeof(short) == sizeof(int).
+ * gcc.dg/attr-alloc_size-11.c: Likewise.
+ * gcc.dg/attr-alloc_size-3.c: Likewise.
+ * gcc.dg/attr-alloc_size-5.c: Likewise.
+ * gcc.dg/builtin-stringop-chk-7.c: Likewise.
+
+2018-11-08 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ * c-c++-common/patchable_function_entry-decl.c: Add regex to search for
+ uppercase "NOP" instructions in assembler output.
+ * c-c++-common/patchable_function_entry-default.c: Likewise.
+ * c-c++-common/patchable_function_entry-definition.c: Likewise.
+
+2018-11-08 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ * c-c++-common/pr27336.c: Skip test if the target keeps null pointer
+ checks.
+ * gcc.dg/addr_equal-1.c: Likewise.
+ * gcc.dg/tree-ssa/pr78154.c: Likewise.
+ * gcc.dg/tree-ssa/vrp111.c: Likewise.
+
+2018-11-08 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ * lib/gcc-dg.exp (gcc-dg-prune): Add new regexps for when the size of
+ an output section is too large for a memory region, or a memory
+ region overflows.
+
+2018-11-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/null_pointer_deref1.adb: Remove -gnatp and add pragma.
+ * gnat.dg/null_pointer_deref2.adb: Likewise.
+ * gnat.dg/null_pointer_deref3.adb: Likewise.
+ * gnat.dg/opt74.adb: New test.
+ * gnat.dg/opt74_pkg.ad[sb]: New helper.
+ * gnat.dg/warn12.adb: Delete.
+ * gnat.dg/warn12_pkg.ads: Likewise.
+
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ PR ipa/86395
+ * g++.dg/ipa/devirt-12.C: Add "-all" suffix to
+ "-fdump-ipa-inline".
+ * g++.dg/ipa/imm-devirt-1.C: Add "-optimized" suffix to
+ "-fdump-tree-einline".
+ * g++.dg/tree-prof/inline_mismatch_args.C: Add "-all" suffix to
+ "-fdump-tree-einline".
+ * g++.dg/tree-ssa/inline-1.C: Add "-optimized" suffix to
+ "-fdump-tree-einline".
+ * g++.dg/tree-ssa/inline-2.C: Likewise.
+ * g++.dg/tree-ssa/inline-3.C: Likewise.
+ * g++.dg/tree-ssa/inline-4.C: New test, based on inline-1.C, but
+ using "-fopt-info-inline".
+ * gcc.dg/ipa/fopt-info-inline-1.c: New test.
+ * gcc.dg/ipa/inline-4.c: Add "-all" suffix to
+ "-fdump-ipa-inline". Add "-fopt-info-inline" and dg-optimized
+ directive.
+ * gcc.dg/ipa/inline-7.c: Add "-optimized" suffix to
+ "-fdump-tree-einline". Add "-fopt-info-inline" and dg-optimized
+ directive. Update scan-tree-dump-times to reflect /order
+ suffixes.
+ * gcc.dg/ipa/inlinehint-4.c: Update scan-tree-dump-times to
+ reflect /order suffixes.
+ * gcc.dg/plugin/dump-1.c: Add "-loop" to "-fopt-info-note" to
+ avoid getting extra messages from inliner.
+ * gcc.dg/plugin/dump-2.c: Likewise.
+ * gcc.dg/pr26570.c: Add dg-prune-output to ignore new
+ "function body not available" missed optimization messages.
+ * gcc.dg/pr71969-2.c: Update scan-tree-dump-times to reflect
+ /order suffixes.
+ * gcc.dg/pr71969-3.c: Likewise.
+ * gcc.dg/tree-ssa/inline-11.c: Add "-all" suffix to
+ "-fdump-tree-einline".
+ * gcc.dg/tree-ssa/inline-3.c: Add "-optimized" suffix to
+ "-fdump-tree-einline". Update scan-tree-dump-times to reflect
+ /order suffixes.
+ * gcc.dg/tree-ssa/inline-4.c: Add "-optimized" suffix to
+ "-fdump-tree-einline". Add "-fopt-info-inline" and dg-optimized
+ directive.
+ * gcc.dg/tree-ssa/inline-8.c: Add "-optimized" suffix to
+ "-fdump-tree-einline".
+ * gfortran.dg/pr79966.f90: Update scan-ipa-dump to reflect /order
+ suffixes.
+
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/format/gcc_diag-10.c: Add coverage for %f.
+
+2018-11-08 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/format/gcc_diag-10.c (cgraph_node): New typedef.
+ (test_dump): Add testing of %C.
+
+2018-11-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g++.dg/other/pr87916.C: New test.
+
+2018-11-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87929
+ * gcc.dg/pr87929.c: New testcase.
+
+2018-11-08 Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/pr87811.c: Update scanned pattern.
+ * gcc.dg/pr87811-2.c: Likewise.
+
+2018-11-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * g++.dg/lto/pr87906_0.C: Use moon instead of possibly predefined
+ sun.
+ * g++.dg/lto/pr87906_1.C: Likewise.
+
+2018-11-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87913
+ * gcc.dg/tree-ssa/phi-opt-20.c: New testcase.
+
+2018-11-08 Chenghua Xu <paul.hua.gm@gmail.com>
+
+ * gcc.target/mips/mips.exp (mips-dg-options):
+ Add mips_option_dependency msoft-float vs no-mmi and
+ mips16/micromips vs no-mmi/ext/ext2 only gcc
+ config with Loongson target.
+
+2018-11-07 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ * gcc.c-torture/compile/pr65595.c: Change type of "num" argument to
+ memcpy from "unsigned long" to __SIZE_TYPE__.
+
+2018-11-07 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ PR c/87691
+ * gcc.target/msp430/pr87691.c: New test.
+
+2018-11-07 Nikolai Merinov <n.merinov@inango-systems.com>
+
+ * gcc.dg/Wno-attribute-warning.c: New test.
+
2018-11-07 Nathan Sidwell <nathan@acm.org>
PR c++/87904
diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c b/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c
index 32e2c06..3bfb756 100644
--- a/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c
+++ b/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c
@@ -1,6 +1,6 @@
/* { dg-do compile { target { ! nvptx*-*-* } } } */
/* { dg-options "-O2 -fpatchable-function-entry=3,1" } */
-/* { dg-final { scan-assembler-times "nop" 2 { target { ! { alpha*-*-* visium-*-* } } } } } */
+/* { dg-final { scan-assembler-times "nop|NOP" 2 { target { ! { alpha*-*-* visium-*-* } } } } } */
/* { dg-final { scan-assembler-times "bis" 2 { target alpha*-*-* } } } */
/* { dg-final { scan-assembler-times "nop" 3 { target visium-*-* } } } */
diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-default.c b/gcc/testsuite/c-c++-common/patchable_function_entry-default.c
index be88e43..bd7c6e9 100644
--- a/gcc/testsuite/c-c++-common/patchable_function_entry-default.c
+++ b/gcc/testsuite/c-c++-common/patchable_function_entry-default.c
@@ -1,6 +1,6 @@
/* { dg-do compile { target { ! nvptx*-*-* } } } */
/* { dg-options "-O2 -fpatchable-function-entry=3,1" } */
-/* { dg-final { scan-assembler-times "nop" 3 { target { ! { alpha*-*-* visium-*-* } } } } } */
+/* { dg-final { scan-assembler-times "nop|NOP" 3 { target { ! { alpha*-*-* visium-*-* } } } } } */
/* { dg-final { scan-assembler-times "bis" 3 { target alpha*-*-* } } } */
/* { dg-final { scan-assembler-times "nop" 4 { target visium-*-* } } } */
diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c b/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c
index af18dbc..7091138 100644
--- a/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c
+++ b/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c
@@ -1,6 +1,6 @@
/* { dg-do compile { target { ! nvptx*-*-* } } } */
/* { dg-options "-O2 -fpatchable-function-entry=3,1" } */
-/* { dg-final { scan-assembler-times "nop" 1 { target { ! { alpha*-*-* visium-*-* } } } } } */
+/* { dg-final { scan-assembler-times "nop|NOP" 1 { target { ! { alpha*-*-* visium-*-* } } } } } */
/* { dg-final { scan-assembler-times "bis" 1 { target alpha*-*-* } } } */
/* { dg-final { scan-assembler-times "nop" 2 { target visium-*-* } } } */
diff --git a/gcc/testsuite/c-c++-common/pr27336.c b/gcc/testsuite/c-c++-common/pr27336.c
index ce68559..4ecc232 100644
--- a/gcc/testsuite/c-c++-common/pr27336.c
+++ b/gcc/testsuite/c-c++-common/pr27336.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdelete-null-pointer-checks -fdump-tree-vrp1" } */
+/* { dg-skip-if "" { keeps_null_pointer_checks } } */
struct B { int x; };
extern void g3(struct B *that) __attribute__((nonnull));
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-12.C b/gcc/testsuite/g++.dg/ipa/devirt-12.C
index 93ce251..60271a0 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-12.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-12.C
@@ -1,5 +1,5 @@
// { dg-do compile { target c++11 } }
-// { dg-options "-O -fdump-ipa-inline" }
+// { dg-options "-O -fdump-ipa-inline-all" }
class Foo
{
diff --git a/gcc/testsuite/g++.dg/ipa/imm-devirt-1.C b/gcc/testsuite/g++.dg/ipa/imm-devirt-1.C
index 37b7d87..00ac61e7 100644
--- a/gcc/testsuite/g++.dg/ipa/imm-devirt-1.C
+++ b/gcc/testsuite/g++.dg/ipa/imm-devirt-1.C
@@ -1,7 +1,7 @@
/* Verify that virtual calls are folded even early inlining puts them into one
function with the definition. */
/* { dg-do run } */
-/* { dg-options "-O2 -fdump-tree-einline" } */
+/* { dg-options "-O2 -fdump-tree-einline-optimized" } */
extern "C" void abort (void);
diff --git a/gcc/testsuite/g++.dg/lto/pr87906_0.C b/gcc/testsuite/g++.dg/lto/pr87906_0.C
index 08e7ed3..31b62da 100644
--- a/gcc/testsuite/g++.dg/lto/pr87906_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr87906_0.C
@@ -3,13 +3,13 @@
// { dg-extra-ld-options "-shared -nostdlib" }
namespace com {
-namespace sun {
+namespace moon {
namespace star {}
-} // namespace sun
+} // namespace moon
} // namespace com
-namespace a = com::sun::star;
+namespace a = com::moon::star;
namespace com {
-namespace sun {
+namespace moon {
namespace star {
namespace uno {
class a {
@@ -28,7 +28,7 @@ class c {
class RuntimeException : b {};
} // namespace uno
} // namespace star
-} // namespace sun
+} // namespace moon
} // namespace com
template <typename> void d(int) { throw a::uno::RuntimeException(); }
int f;
diff --git a/gcc/testsuite/g++.dg/lto/pr87906_1.C b/gcc/testsuite/g++.dg/lto/pr87906_1.C
index ee5849f..5610876 100644
--- a/gcc/testsuite/g++.dg/lto/pr87906_1.C
+++ b/gcc/testsuite/g++.dg/lto/pr87906_1.C
@@ -1,5 +1,5 @@
namespace com {
-namespace sun {
+namespace moon {
namespace star {
namespace uno {
class a {
@@ -15,9 +15,9 @@ class RuntimeException : b {};
} // namespace uno
class C : uno::RuntimeException {};
} // namespace star
-} // namespace sun
+} // namespace moon
} // namespace com
-using com::sun::star::C;
-using com::sun::star::uno::RuntimeException;
+using com::moon::star::C;
+using com::moon::star::uno::RuntimeException;
void d() { throw RuntimeException(); }
void e() { C(); }
diff --git a/gcc/testsuite/g++.dg/other/pr87916.C b/gcc/testsuite/g++.dg/other/pr87916.C
new file mode 100644
index 0000000..5c69478
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr87916.C
@@ -0,0 +1,45 @@
+// PR middle-end/87916
+// Testcase by Martin Liška <marxin@gcc.gnu.org>
+
+// { dg-do compile }
+// { dg-options "-O2 -g" }
+// { dg-additional-options "-fPIC" { target fpic } }
+
+struct a {
+ virtual ~a();
+};
+template <typename b> class c {
+public:
+ class d {
+ public:
+ d(c);
+ b *operator->();
+ };
+};
+int e, f;
+class g {
+public:
+ class h {
+ public:
+ virtual void j(g &, int &, bool) = 0;
+ };
+ c<h> k();
+ int *l();
+ int *m();
+};
+int *g::l() try {
+ for (c<h>::d i(k());;)
+ i->j(*this, e, true);
+} catch (int) {
+ return 0;
+}
+int *g::m() try {
+ for (c<h>::d i(k());;)
+ i->j(*this, f, false);
+} catch (int) {
+ return 0;
+}
+struct n : a, g::h {
+ void o();
+ void j(g &, int &, bool) { o(); }
+};
diff --git a/gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C b/gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C
index 2156cec..b65d915 100644
--- a/gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C
+++ b/gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fdump-tree-einline" } */
+/* { dg-options "-O2 -fdump-tree-einline-all" } */
class DocId {
public:
DocId() { }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/inline-1.C b/gcc/testsuite/g++.dg/tree-ssa/inline-1.C
index 4497fac..9c49ddb 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/inline-1.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/inline-1.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=3" } */
+/* { dg-options "-O2 -fdump-tree-einline-optimized --param max-early-inliner-iterations=3" } */
/* { dg-add-options bind_pic_locally } */
namespace std {
diff --git a/gcc/testsuite/g++.dg/tree-ssa/inline-2.C b/gcc/testsuite/g++.dg/tree-ssa/inline-2.C
index 79f807c..b72f652 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/inline-2.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/inline-2.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=3" } */
+/* { dg-options "-O2 -fdump-tree-einline-optimized --param max-early-inliner-iterations=3" } */
/* { dg-add-options bind_pic_locally } */
namespace std {
diff --git a/gcc/testsuite/g++.dg/tree-ssa/inline-3.C b/gcc/testsuite/g++.dg/tree-ssa/inline-3.C
index 0ad366e..131f12d 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/inline-3.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/inline-3.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=5" } */
+/* { dg-options "-O2 -fdump-tree-einline-optimized --param max-early-inliner-iterations=5" } */
/* { dg-add-options bind_pic_locally } */
#include <algorithm>
diff --git a/gcc/testsuite/g++.dg/tree-ssa/inline-4.C b/gcc/testsuite/g++.dg/tree-ssa/inline-4.C
new file mode 100644
index 0000000..1dd8140
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/inline-4.C
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopt-info-inline --param max-early-inliner-iterations=3" } */
+/* { dg-add-options bind_pic_locally } */
+
+namespace std {
+ extern "C" int puts(const char *s);
+}
+
+template <class T, class E> void
+foreach (T b, T e, void (*ptr)(E))
+{
+ for (; b != e; b++)
+ ptr(*b); // { dg-optimized "Inlining void inline_me\[^\\n\]* into int main\[^\\n\]*" }
+}
+
+void
+inline_me (char *x)
+{
+ std::puts(x);
+}
+
+static void
+inline_me_too (char *x)
+{
+ std::puts(x);
+}
+
+int main(int argc, char **argv)
+{
+ foreach (argv, argv + argc, inline_me); // { dg-optimized "Inlining void foreach\[^\\n\]* into int main\[^\\n\]*" }
+ foreach (argv, argv + argc, inline_me_too); // { dg-optimized "Inlining void foreach\[^\\n\]* into int main\[^\\n\]*" }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr65595.c b/gcc/testsuite/gcc.c-torture/compile/pr65595.c
index 0ab7161..b6a0aa4 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr65595.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr65595.c
@@ -1,4 +1,4 @@
-extern void *memcpy(void *, const void *, unsigned long);
+extern void *memcpy(void *, const void *, __SIZE_TYPE__);
struct in6_addr {
struct {
int u6_addr32[4];
diff --git a/gcc/testsuite/gcc.dg/Wno-attribute-warning.c b/gcc/testsuite/gcc.dg/Wno-attribute-warning.c
new file mode 100644
index 0000000..2475304
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wno-attribute-warning.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-Werror -Wno-error=attribute-warning" } */
+
+int f1(void) __attribute__ ((warning("Please avoid f1")));
+int func1(void)
+{
+ return f1(); /* { dg-warning "'f1' declared with attribute warning: Please avoid f1" } */
+}
diff --git a/gcc/testsuite/gcc.dg/addr_equal-1.c b/gcc/testsuite/gcc.dg/addr_equal-1.c
index 70fa354..18b0dc9 100644
--- a/gcc/testsuite/gcc.dg/addr_equal-1.c
+++ b/gcc/testsuite/gcc.dg/addr_equal-1.c
@@ -4,6 +4,7 @@
/* { dg-require-alias "" } */
/* { dg-options "-O2 -fdelete-null-pointer-checks" } */
/* { dg-skip-if "" { powerpc-ibm-aix* } } */
+/* { dg-skip-if "function pointers can be NULL" { keeps_null_pointer_checks } } */
void abort (void);
extern int undef_var0, undef_var1;
extern __attribute__ ((weak)) int weak_undef_var0;
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-10.c b/gcc/testsuite/gcc.dg/attr-alloc_size-10.c
index 4080717..071c6aa 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-10.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-10.c
@@ -13,7 +13,7 @@
#define SHRT_MAX __SHRT_MAX__
#define SHRT_MIN (-SHRT_MAX - 1)
-#define USHRT_MAX (SHRT_MAX * 2 + 1)
+#define USHRT_MAX (SHRT_MAX * 2U + 1)
#define INT_MAX __INT_MAX__
#define INT_MIN (-INT_MAX - 1)
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-11.c b/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
index 301a06f..7f2fc49 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
@@ -11,7 +11,7 @@
#define SHRT_MAX __SHRT_MAX__
#define SHRT_MIN (-SHRT_MAX - 1)
-#define USHRT_MAX (SHRT_MAX * 2 + 1)
+#define USHRT_MAX (SHRT_MAX * 2U + 1)
#define INT_MAX __INT_MAX__
#define INT_MIN (-INT_MAX - 1)
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-3.c b/gcc/testsuite/gcc.dg/attr-alloc_size-3.c
index 96ff077..7e8c22f 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-3.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-3.c
@@ -14,7 +14,7 @@
#define SHRT_MAX __SHRT_MAX__
#define SHRT_MIN (-SHRT_MAX - 1)
-#define USHRT_MAX (SHRT_MAX * 2 + 1)
+#define USHRT_MAX (SHRT_MAX * 2U + 1)
#define INT_MAX __INT_MAX__
#define INT_MIN (-INT_MAX - 1)
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-5.c b/gcc/testsuite/gcc.dg/attr-alloc_size-5.c
index f9884ed..26ee43f 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-5.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-5.c
@@ -12,7 +12,7 @@
#define SHRT_MAX __SHRT_MAX__
#define SHRT_MIN (-SHRT_MAX - 1)
-#define USHRT_MAX (SHRT_MAX * 2 + 1)
+#define USHRT_MAX (SHRT_MAX * 2U + 1)
#define INT_MAX __INT_MAX__
#define INT_MIN (-INT_MAX - 1)
diff --git a/gcc/testsuite/gcc.dg/builtin-stringop-chk-7.c b/gcc/testsuite/gcc.dg/builtin-stringop-chk-7.c
index 173e4ff..d3908a2 100644
--- a/gcc/testsuite/gcc.dg/builtin-stringop-chk-7.c
+++ b/gcc/testsuite/gcc.dg/builtin-stringop-chk-7.c
@@ -9,7 +9,7 @@
#define UCHAR_MAX (SCHAR_MAX * 2 + 1)
#define SHRT_MAX __SHRT_MAX__
-#define USHRT_MAX (SHRT_MAX * 2 + 1)
+#define USHRT_MAX (SHRT_MAX * 2U + 1)
#define INT_MAX __INT_MAX__
#define UINT_MAX (INT_MAX * 2U + 1)
diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-10.c b/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
index 2f6a002..ba2629b 100644
--- a/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
+++ b/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
@@ -20,7 +20,7 @@ typedef union tree_node *tree;
typedef struct gimple gimple;
/* Likewise for gimple. */
-typedef struct gimple gimple;
+typedef struct cgraph_node cgraph_node;
#define FORMAT(kind) __attribute__ ((format (__gcc_## kind ##__, 1, 2)))
@@ -162,7 +162,7 @@ void test_cxxdiag (tree t, gimple *gc)
cxxdiag ("%<%X%>", t);
}
-void test_dump (tree t, gimple *stmt)
+void test_dump (tree t, gimple *stmt, cgraph_node *node)
{
dump ("%<"); /* { dg-warning "unterminated quoting directive" } */
dump ("%>"); /* { dg-warning "unmatched quoting directive " } */
@@ -182,4 +182,7 @@ void test_dump (tree t, gimple *stmt)
dump ("%E", stmt);
dump ("%T", t);
dump ("%G", stmt);
+ dump ("%C", node);
+ dump ("%f", 1.0);
+ dump ("%4.2f", 1.0); /* { dg-warning "format" } */
}
diff --git a/gcc/testsuite/gcc.dg/ipa/fopt-info-inline-1.c b/gcc/testsuite/gcc.dg/ipa/fopt-info-inline-1.c
new file mode 100644
index 0000000..4032ad1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/fopt-info-inline-1.c
@@ -0,0 +1,44 @@
+/* { dg-options "-O3 -fopt-info-inline-optimized-missed" } */
+
+static int foo (int a)
+{
+ return a + 10;
+}
+
+static int bar (int b)
+{
+ return b - 20;
+}
+
+static int boo (int a, int b)
+{
+ return (foo (a) /* { dg-optimized "Inlining foo/\[0-9\]+ into boo/\[0-9\]+" } */
+ + bar (b)); /* { dg-optimized "Inlining bar/\[0-9\]+ into boo/\[0-9\]+" } */
+}
+
+extern int v_a, v_b;
+extern int result;
+
+int compute ()
+{
+ result = boo (v_a, v_b); /* { dg-optimized "Inlining boo/\[0-9\]+ into compute/\[0-9\]+" } */
+
+ return result;
+}
+
+extern void not_available(int);
+
+int __attribute__ ((noinline,noclone)) get_input(void)
+{
+ return 1;
+}
+
+int test_1 ()
+{
+ return get_input (); /* { dg-missed "not inlinable: test_1/\[0-9\]+ -> get_input/\[0-9\]+, function not inlinable" } */
+}
+
+void test_2 (int v)
+{
+ not_available (1); /* { dg-missed "not inlinable: test_2/\[0-9\]+ -> not_available/\[0-9\]+, function body not available" } */
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/inline-4.c b/gcc/testsuite/gcc.dg/ipa/inline-4.c
index fdb4465..db4cfc6 100644
--- a/gcc/testsuite/gcc.dg/ipa/inline-4.c
+++ b/gcc/testsuite/gcc.dg/ipa/inline-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-Os -c -fdump-ipa-inline -fno-early-inlining -fno-partial-inlining -fno-ipa-cp" } */
+/* { dg-options "-Os -c -fdump-ipa-inline-all -fopt-info-inline -fno-early-inlining -fno-partial-inlining -fno-ipa-cp" } */
/* { dg-add-options bind_pic_locally } */
void work_hard (void);
@@ -20,7 +20,7 @@ void do_something (int shall_i_work)
}
int foo (int invariant)
{
- do_something (0);
+ do_something (0); // { dg-optimized "Inlined do_something/\[0-9]+ into foo/\[0-9]+" }
do_something (1);
}
diff --git a/gcc/testsuite/gcc.dg/ipa/inline-7.c b/gcc/testsuite/gcc.dg/ipa/inline-7.c
index 5002aa0..7dabb14 100644
--- a/gcc/testsuite/gcc.dg/ipa/inline-7.c
+++ b/gcc/testsuite/gcc.dg/ipa/inline-7.c
@@ -1,6 +1,6 @@
/* Check that early inliner works out that a is empty of parameter 0. */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-einline -fno-partial-inlining" } */
+/* { dg-options "-O2 -fdump-tree-einline-optimized -fopt-info-inline -fno-partial-inlining" } */
void t(void);
int a (int b)
{
@@ -18,7 +18,7 @@ int a (int b)
void
m()
{
- a(1);
+ a(1); /* { dg-optimized "Inlining a/\[0-9\]* into m/\[0-9\]*" } */
a(0);
}
-/* { dg-final { scan-tree-dump-times "Inlining a into m" 1 "einline" } } */
+/* { dg-final { scan-tree-dump-times "Inlining a.* into m.*" 1 "einline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-4.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-4.c
index 656260a..ecb9a29 100644
--- a/gcc/testsuite/gcc.dg/ipa/inlinehint-4.c
+++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-4.c
@@ -35,5 +35,5 @@ test (int i)
lookup (9 * i);
}
/* { dg-final { scan-ipa-dump "Wrapper penalty" "inline" } } */
-/* { dg-final { scan-ipa-dump-not "Inlined lookup_slow into lookup" "inline" } } */
-/* { dg-final { scan-ipa-dump "Inlined lookup into test" "inline" } } */
+/* { dg-final { scan-ipa-dump-not "Inlined lookup_slow/\[0-9\]* into lookup/\[0-9\]*" "inline" } } */
+/* { dg-final { scan-ipa-dump "Inlined lookup/\[0-9\]* into test/\[0-9\]*" "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/plugin/dump-1.c b/gcc/testsuite/gcc.dg/plugin/dump-1.c
index 95bd7a4..1538bf6 100644
--- a/gcc/testsuite/gcc.dg/plugin/dump-1.c
+++ b/gcc/testsuite/gcc.dg/plugin/dump-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fopt-info-note" } */
+/* { dg-options "-fopt-info-loop-note" } */
extern void test_string_literal (void);
extern void test_tree (void);
diff --git a/gcc/testsuite/gcc.dg/plugin/dump-2.c b/gcc/testsuite/gcc.dg/plugin/dump-2.c
index 961a3d3..04b82e5 100644
--- a/gcc/testsuite/gcc.dg/plugin/dump-2.c
+++ b/gcc/testsuite/gcc.dg/plugin/dump-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fopt-info-note-internals" } */
+/* { dg-options "-fopt-info-loop-note-internals" } */
extern void test_string_literal (void);
extern void test_tree (void);
diff --git a/gcc/testsuite/gcc.dg/pr26570.c b/gcc/testsuite/gcc.dg/pr26570.c
index 87b644a..d29bc35 100644
--- a/gcc/testsuite/gcc.dg/pr26570.c
+++ b/gcc/testsuite/gcc.dg/pr26570.c
@@ -6,3 +6,4 @@ unsigned test (unsigned a, unsigned b)
{
return a / b;
} /* { dg-missed "\[^\n\]*execution counts estimated" } */
+/* { dg-prune-output "function body not available" } */
diff --git a/gcc/testsuite/gcc.dg/pr71969-2.c b/gcc/testsuite/gcc.dg/pr71969-2.c
index f434fd0..73839a6 100644
--- a/gcc/testsuite/gcc.dg/pr71969-2.c
+++ b/gcc/testsuite/gcc.dg/pr71969-2.c
@@ -20,4 +20,4 @@ main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "Inlining foo into main" 4 "einline" } } */
+/* { dg-final { scan-tree-dump-times "Inlining foo/\[0-9\]* into main/\[0-9\]*" 4 "einline" } } */
diff --git a/gcc/testsuite/gcc.dg/pr71969-3.c b/gcc/testsuite/gcc.dg/pr71969-3.c
index 583d89d..189adfd 100644
--- a/gcc/testsuite/gcc.dg/pr71969-3.c
+++ b/gcc/testsuite/gcc.dg/pr71969-3.c
@@ -35,4 +35,4 @@ main ()
}
/* { dg-final { scan-tree-dump-times "will not early inline" 8 "einline" } } */
-/* { dg-final { scan-tree-dump-times "Inlining foo into main" 4 "einline" } } */
+/* { dg-final { scan-tree-dump-times "Inlining foo/\[0-9\]* into main/\[0-9\]*" 4 "einline" } } */
diff --git a/gcc/testsuite/gcc.dg/pr87811-2.c b/gcc/testsuite/gcc.dg/pr87811-2.c
index aa30ddf..8b08187 100644
--- a/gcc/testsuite/gcc.dg/pr87811-2.c
+++ b/gcc/testsuite/gcc.dg/pr87811-2.c
@@ -6,7 +6,7 @@ void bar (void);
void
foo (int i)
{
- if (__builtin_expect_with_probability (i, 0, 2.0f)) /* { dg-error "probability argument .* must be a in the range 0\\\.0 to 1\\\.0" } */
+ if (__builtin_expect_with_probability (i, 0, 2.0f)) /* { dg-error "probability .* is outside the range \\\[0\\\.0, 1\\\.0\\\]" } */
bar ();
}
diff --git a/gcc/testsuite/gcc.dg/pr87811.c b/gcc/testsuite/gcc.dg/pr87811.c
index 9045c8e..110b383 100644
--- a/gcc/testsuite/gcc.dg/pr87811.c
+++ b/gcc/testsuite/gcc.dg/pr87811.c
@@ -6,7 +6,7 @@ void bar (void);
void
foo (int i, double d)
{
- if (__builtin_expect_with_probability (i, 0, d)) /* { dg-error "probability argument .d. must be a compile time constant" } */
+ if (__builtin_expect_with_probability (i, 0, d)) /* { dg-error "probability .d. must be constant floating-point expression" } */
bar ();
}
diff --git a/gcc/testsuite/gcc.dg/pr87874.c b/gcc/testsuite/gcc.dg/pr87874.c
index 1480a5e..80debe0 100644
--- a/gcc/testsuite/gcc.dg/pr87874.c
+++ b/gcc/testsuite/gcc.dg/pr87874.c
@@ -16,7 +16,7 @@ em (int u5, int fo, int s7)
if (es == 0)
if (nb == *vk)
{
- const unsigned long int uint64_max = 18446744073709551615ul;
+ const unsigned long long int uint64_max = 18446744073709551615ull;
__int128 ks = uint64_max / 2 + 1;
while (s7 < 1)
diff --git a/gcc/testsuite/gcc.dg/pr87929.c b/gcc/testsuite/gcc.dg/pr87929.c
new file mode 100644
index 0000000..f64f7ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr87929.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fexceptions -fnon-call-exceptions -fsignaling-nans" } */
+
+#define complex __complex__
+#define _Complex_I (1.0iF)
+
+extern void f2c_4d__( complex float *, complex float *);
+extern void abort (void);
+
+void f2c_4c__(void)
+{
+ complex float x,ret_val;
+ x = 1234 + 5678 * _Complex_I;
+ f2c_4d__(&ret_val,&x);
+ if ( x != ret_val ) abort();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-11.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-11.c
index 6f0ff68..5673c32 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/inline-11.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-11.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-weak "" } */
-/* { dg-options "-O2 -fdump-tree-einline" } */
+/* { dg-options "-O2 -fdump-tree-einline-all" } */
int w;
int bar (void) __attribute__ ((weak));
int bar (){
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c
index 2998989..cd441af 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=2" } */
+/* { dg-options "-O2 -fdump-tree-einline-optimized --param max-early-inliner-iterations=2" } */
/* { dg-add-options bind_pic_locally } */
extern void inlined ();
@@ -27,5 +27,5 @@ inline_me_too (void)
{
inlined();
}
-/* { dg-final { scan-tree-dump-times "Inlining inline_me " 1 "einline"} } */
-/* { dg-final { scan-tree-dump-times "Inlining inline_me_too " 1 "einline"} } */
+/* { dg-final { scan-tree-dump-times "Inlining inline_me/\[0-9\]* " 1 "einline"} } */
+/* { dg-final { scan-tree-dump-times "Inlining inline_me_too/\[0-9\]* " 1 "einline"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c
index c9f7978..93412fa 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-einline" } */
+/* { dg-options "-O2 -fdump-tree-einline-optimized -fopt-info-inline" } */
/* { dg-add-options bind_pic_locally } */
extern int rand(void);
@@ -13,7 +13,7 @@ int my_id;
int main()
{
- int res = get_data_for (my_id);
+ int res = get_data_for (my_id); /* { dg-optimized "Inlining get_data_for/\[0-9\]+ into main/\[0-9\]+." } */
switch (res)
{
case 0:
@@ -23,4 +23,4 @@ int main()
}
}
-/* { dg-final { scan-tree-dump "Inlining get_data_for into main" "einline" } } */
+/* { dg-final { scan-tree-dump "Inlining get_data_for/\[0-9\]* into main/\[0-9\]*" "einline" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-8.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-8.c
index 6da886e..f87e0b5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/inline-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-8.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -finline-small-functions --param early-inlining-insns=0 -fdump-tree-einline" } */
+/* { dg-options "-O -finline-small-functions --param early-inlining-insns=0 -fdump-tree-einline-optimized" } */
int foo0();
void bar0() { foo0(); }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-20.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-20.c
new file mode 100644
index 0000000..c310308
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-20.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-phiopt1" } */
+
+unsigned int f(unsigned int num)
+{
+ return num < 1 ? 1 : num;
+}
+
+unsigned int g(unsigned int num)
+{
+ return num > (unsigned)__INT_MAX__ * 2 ? (unsigned)__INT_MAX__ * 2 : num;
+}
+
+int h(int num)
+{
+ return num < -__INT_MAX__ ? -__INT_MAX__ : num;
+}
+
+int i(int num)
+{
+ return num > __INT_MAX__-1 ? __INT_MAX__-1 : num;
+}
+
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr78154.c b/gcc/testsuite/gcc.dg/tree-ssa/pr78154.c
index b561503..3ba8f64 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr78154.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr78154.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-evrp-slim -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" { keeps_null_pointer_checks } } */
void f(void *d, const void *s, __SIZE_TYPE__ n)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp111.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp111.c
index 6314423..cae2bc7 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp111.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp111.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-evrp -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" { keeps_null_pointer_checks } } */
void foo (void *p) __attribute__((nonnull(1)));
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index e70d416..002cc28 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -1054,10 +1054,19 @@ proc mips-dg-options { args } {
mips_option_dependency options "-mno-plt" "addressing=unknown"
mips_option_dependency options "-mabicalls" "-G0"
mips_option_dependency options "-mno-gpopt" "-mexplicit-relocs"
- mips_option_dependency options "-mips16" "-mno-loongson-mmi"
- mips_option_dependency options "-mmicromips" "-mno-loongson-mmi"
- mips_option_dependency options "-msoft-float" "-mno-loongson-mmi"
- mips_option_dependency options "-mmicromips" "-mno-loongson-ext"
+
+ if { [check_configured_with "with-arch=loongson3a"]
+ || [check_configured_with "with-arch=gs464"]
+ || [check_configured_with "with-arch=gs464e"]
+ || [check_configured_with "with-arch=gs264e"] } {
+ mips_option_dependency options "-msoft-float" "-mno-loongson-mmi"
+ mips_option_dependency options "-mips16" "-mno-loongson-mmi"
+ mips_option_dependency options "-mips16" "-mno-loongson-ext"
+ mips_option_dependency options "-mips16" "-mno-loongson-ext2"
+ mips_option_dependency options "-mmicromips" "-mno-loongson-mmi"
+ mips_option_dependency options "-mmicromips" "-mno-loongson-ext"
+ mips_option_dependency options "-mmicromips" "-mno-loongson-ext2"
+ }
# Work out information about the current ABI.
set abi_test_option_p [mips_test_option_p options abi]
diff --git a/gcc/testsuite/gcc.target/msp430/pr87691.c b/gcc/testsuite/gcc.target/msp430/pr87691.c
new file mode 100644
index 0000000..c00425d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/pr87691.c
@@ -0,0 +1,41 @@
+/* PR 87691 - Test that a union containing __int20 and a float is not treated as
+ 20-bits in size. */
+
+/* { dg-do compile } */
+/* { dg-skip-if "no __int20 for mcpu=msp430" { *-*-* } { "-mcpu=msp430" } { "" } } */
+/* { dg-final { scan-assembler-not "MOVX.A" } } */
+
+/* To move a 20-bit value from memory (using indexed or indirect register
+ mode), onto the stack (also addressed using indexed or indirect register
+ mode), MOVX.A must be used. MOVA does not support these addressing modes.
+ Therefore, to check that the union is not manipulated as a 20-bit type,
+ test that no MOVX.A instructions are present in the assembly.
+
+ MOVA is used to fill/spill u.i, but if the union is treated as 20 bits in
+ size, MOVX.A would be used. No other __int20 operations are present
+ in the source, so there will be no valid uses of MOVX.A in the resulting
+ assembly. */
+
+union U1
+{
+ float f;
+ __int20 i;
+};
+
+union U2
+{
+ __int20 i;
+ float f;
+};
+
+float foo1 (union U1 u)
+{
+ u.i += 42;
+ return u.f;
+}
+
+float foo2 (union U2 u)
+{
+ u.i += 42;
+ return u.f;
+}
diff --git a/gcc/testsuite/gfortran.dg/pr79966.f90 b/gcc/testsuite/gfortran.dg/pr79966.f90
index eee43fb..2170afd 100644
--- a/gcc/testsuite/gfortran.dg/pr79966.f90
+++ b/gcc/testsuite/gfortran.dg/pr79966.f90
@@ -109,4 +109,4 @@ contains
call RunTPTests()
end program
-! { dg-final { scan-ipa-dump "Inlined tp_sum into runtptests" "inline" } }
+! { dg-final { scan-ipa-dump "Inlined tp_sum/\[0-9\]+ into runtptests/\[0-9\]+" "inline" } }
diff --git a/gcc/testsuite/gnat.dg/null_pointer_deref1.adb b/gcc/testsuite/gnat.dg/null_pointer_deref1.adb
index ec7f946..0f030b0 100644
--- a/gcc/testsuite/gnat.dg/null_pointer_deref1.adb
+++ b/gcc/testsuite/gnat.dg/null_pointer_deref1.adb
@@ -1,11 +1,13 @@
-- { dg-do run }
--- { dg-options "-gnatp" }
-- This test requires architecture- and OS-specific support code for unwinding
-- through signal frames (typically located in *-unwind.h) to pass. Feel free
-- to disable it if this code hasn't been implemented yet.
procedure Null_Pointer_Deref1 is
+
+ pragma Suppress (All_Checks);
+
type Int_Ptr is access all Integer;
function Ident return Int_Ptr is
diff --git a/gcc/testsuite/gnat.dg/null_pointer_deref2.adb b/gcc/testsuite/gnat.dg/null_pointer_deref2.adb
index 2847622..2a4ed09 100644
--- a/gcc/testsuite/gnat.dg/null_pointer_deref2.adb
+++ b/gcc/testsuite/gnat.dg/null_pointer_deref2.adb
@@ -1,5 +1,4 @@
-- { dg-do run }
--- { dg-options "-gnatp" }
-- This test requires architecture- and OS-specific support code for unwinding
-- through signal frames (typically located in *-unwind.h) to pass. Feel free
@@ -7,6 +6,8 @@
procedure Null_Pointer_Deref2 is
+ pragma Suppress (All_Checks);
+
task T;
task body T is
diff --git a/gcc/testsuite/gnat.dg/null_pointer_deref3.adb b/gcc/testsuite/gnat.dg/null_pointer_deref3.adb
index f92242e..c8e66a6 100644
--- a/gcc/testsuite/gnat.dg/null_pointer_deref3.adb
+++ b/gcc/testsuite/gnat.dg/null_pointer_deref3.adb
@@ -1,5 +1,4 @@
-- { dg-do run }
--- { dg-options "-O -gnatp" }
-- This test requires architecture- and OS-specific support code for unwinding
-- through signal frames (typically located in *-unwind.h) to pass. Feel free
@@ -7,6 +6,8 @@
procedure Null_Pointer_Deref3 is
+ pragma Suppress (All_Checks);
+
procedure Leaf is
type Int_Ptr is access all Integer;
function n return Int_Ptr is
diff --git a/gcc/testsuite/gnat.dg/opt74.adb b/gcc/testsuite/gnat.dg/opt74.adb
new file mode 100644
index 0000000..8eacaa5
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt74.adb
@@ -0,0 +1,13 @@
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with Opt74_Pkg; use Opt74_Pkg;
+
+procedure Opt74 is
+ Index, Found : Integer;
+begin
+ Proc (Found, Index);
+ if Found = 1 then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/opt74_pkg.adb b/gcc/testsuite/gnat.dg/opt74_pkg.adb
new file mode 100644
index 0000000..4d5ce4f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt74_pkg.adb
@@ -0,0 +1,16 @@
+package body Opt74_Pkg is
+
+ procedure Proc (Found : out Integer; Index : out Integer) is
+ begin
+ Index := 1;
+ Found := 0;
+ while (Index <= A'Last) and (Found = 0) loop
+ if A (Index) = 2 then
+ Found := 1;
+ else
+ Index := Index + 1;
+ end if;
+ end loop;
+ end;
+
+end Opt74_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt74_pkg.ads b/gcc/testsuite/gnat.dg/opt74_pkg.ads
new file mode 100644
index 0000000..7c8e85e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt74_pkg.ads
@@ -0,0 +1,7 @@
+package Opt74_Pkg is
+
+ A : array (1 .. 10) of Integer := (others => 0);
+
+ procedure Proc (Found : out Integer; Index : out Integer);
+
+end Opt74_Pkg;
diff --git a/gcc/testsuite/gnat.dg/warn12.adb b/gcc/testsuite/gnat.dg/warn12.adb
deleted file mode 100644
index 8ffd0c7..0000000
--- a/gcc/testsuite/gnat.dg/warn12.adb
+++ /dev/null
@@ -1,48 +0,0 @@
--- { dg-do compile }
--- { dg-options "-O2" }
-
-with Text_IO; use Text_IO;
-with System.Storage_Elements; use System.Storage_Elements;
-with Warn12_Pkg; use Warn12_Pkg;
-
-procedure Warn12 (N : Natural) is
-
- Buffer_Size : constant Storage_Offset
- := Token_Groups'Size/System.Storage_Unit + 4096;
-
- Buffer : Storage_Array (1 .. Buffer_Size);
- for Buffer'Alignment use 8;
-
- Tg1 : Token_Groups;
- for Tg1'Address use Buffer'Address;
-
- Tg2 : Token_Groups;
- pragma Warnings (Off, Tg2);
-
- sid : Sid_And_Attributes;
-
- pragma Suppress (Index_Check, Sid_And_Attributes_Array);
-
-begin
-
- for I in 0 .. 7 loop
- sid := Tg1.Groups(I); -- { dg-bogus "out-of-bounds access" }
- Put_Line("Iteration");
- end loop;
-
- for I in 0 .. N loop
- sid := Tg1.Groups(I); -- { dg-bogus "out-of-bounds access" }
- Put_Line("Iteration");
- end loop;
-
- for I in 0 .. 7 loop
- sid := Tg2.Groups(I); -- { dg-warning "out-of-bounds access" }
- Put_Line("Iteration");
- end loop;
-
- for I in 0 .. N loop
- sid := Tg2.Groups(I); -- { dg-warning "out-of-bounds access" }
- Put_Line("Iteration");
- end loop;
-
-end;
diff --git a/gcc/testsuite/gnat.dg/warn12_pkg.ads b/gcc/testsuite/gnat.dg/warn12_pkg.ads
deleted file mode 100644
index b3191cc..0000000
--- a/gcc/testsuite/gnat.dg/warn12_pkg.ads
+++ /dev/null
@@ -1,21 +0,0 @@
-with Interfaces.C; use Interfaces.C;
-with System;
-
-package Warn12_Pkg is
-
- Anysize_Array: constant := 0;
-
- type Sid_And_Attributes is record
- Sid : System.Address;
- Attributes : Interfaces.C.Unsigned_Long;
- end record;
-
- type Sid_And_Attributes_Array
- is array (Integer range 0..Anysize_Array) of aliased Sid_And_Attributes;
-
- type Token_Groups is record
- GroupCount : Interfaces.C.Unsigned_Long;
- Groups : Sid_And_Attributes_Array;
- end record;
-
-end Warn12_Pkg;
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index c33a50c..305dd3c 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -394,6 +394,14 @@ proc gcc-dg-prune { system text } {
return "::unsupported::memory full"
}
+ if [regexp "(^|\n)\[^\n\]* section.*will not fit in region" $text] {
+ return "::unsupported::memory full"
+ }
+
+ if [regexp "(^|\n)\[^\n\]* region.*overflowed by" $text] {
+ return "::unsupported::memory full"
+ }
+
# Likewise, if we see ".text exceeds local store range" or
# similar.
if {[string match "spu-*" $system] && \
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 4908808..4bf644f 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1558,6 +1558,8 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
}
update_stmt (stmt);
+ if (maybe_clean_eh_stmt (stmt))
+ gimple_purge_dead_eh_edges (gimple_bb (stmt));
}
/* Expand inline asm that sets some complex SSA_NAMEs. */
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 66e780d..6019c61 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -393,7 +393,7 @@ print_lambda_vector (FILE * outfile, lambda_vector vector, int n)
int i;
for (i = 0; i < n; i++)
- fprintf (outfile, "%3d ", vector[i]);
+ fprintf (outfile, "%3d ", (int)vector[i]);
fprintf (outfile, "\n");
}
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index 525d27f..439a8b9 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -138,7 +138,8 @@ struct dr_alias
space. A vector space is a set that is closed under vector addition
and scalar multiplication. In this vector space, an element is a list of
integers. */
-typedef int *lambda_vector;
+typedef HOST_WIDE_INT lambda_int;
+typedef lambda_int *lambda_vector;
/* An integer matrix. A matrix consists of m vectors of length n (IE
all vectors are the same length). */
@@ -611,11 +612,11 @@ void split_constant_offset (tree , tree *, tree *);
/* Compute the greatest common divisor of a VECTOR of SIZE numbers. */
-static inline int
+static inline lambda_int
lambda_vector_gcd (lambda_vector vector, int size)
{
int i;
- int gcd1 = 0;
+ lambda_int gcd1 = 0;
if (size > 0)
{
@@ -632,7 +633,7 @@ static inline lambda_vector
lambda_vector_new (int size)
{
/* ??? We shouldn't abuse the GC allocator here. */
- return ggc_cleared_vec_alloc<int> (size);
+ return ggc_cleared_vec_alloc<lambda_int> (size);
}
/* Clear out vector VEC1 of length SIZE. */
@@ -686,7 +687,7 @@ lambda_matrix_new (int m, int n, struct obstack *lambda_obstack)
mat = XOBNEWVEC (lambda_obstack, lambda_vector, m);
for (i = 0; i < m; i++)
- mat[i] = XOBNEWVEC (lambda_obstack, int, n);
+ mat[i] = XOBNEWVEC (lambda_obstack, lambda_int, n);
return mat;
}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 8a36379..5aa782b 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4674,14 +4674,20 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
/* Add local vars in this inlined callee to caller. */
add_local_variables (id->src_cfun, cfun, id);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (dump_enabled_p ())
{
- fprintf (dump_file, "Inlining %s to %s with frequency %4.2f\n",
- id->src_node->dump_name (),
- id->dst_node->dump_name (),
- cg_edge->sreal_frequency ().to_double ());
- id->src_node->dump (dump_file);
- id->dst_node->dump (dump_file);
+ char buf[128];
+ snprintf (buf, sizeof(buf), "%4.2f",
+ cg_edge->sreal_frequency ().to_double ());
+ dump_printf_loc (MSG_NOTE | MSG_PRIORITY_INTERNALS,
+ call_stmt,
+ "Inlining %C to %C with frequency %s\n",
+ id->src_node, id->dst_node, buf);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ id->src_node->dump (dump_file);
+ id->dst_node->dump (dump_file);
+ }
}
/* This is it. Duplicate the callee body. Assume callee is
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 0784510..64039e2 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -1204,7 +1204,7 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
edge e0, edge e1, gimple *phi,
tree arg0, tree arg1)
{
- tree result, type;
+ tree result, type, rhs;
gcond *cond;
gassign *new_stmt;
edge true_edge, false_edge;
@@ -1220,6 +1220,25 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
cond = as_a <gcond *> (last_stmt (cond_bb));
cmp = gimple_cond_code (cond);
+ rhs = gimple_cond_rhs (cond);
+
+ /* Turn EQ/NE of extreme values to order comparisons. */
+ if ((cmp == NE_EXPR || cmp == EQ_EXPR)
+ && TREE_CODE (rhs) == INTEGER_CST)
+ {
+ if (wi::eq_p (wi::to_wide (rhs), wi::min_value (TREE_TYPE (rhs))))
+ {
+ cmp = (cmp == EQ_EXPR) ? LT_EXPR : GE_EXPR;
+ rhs = wide_int_to_tree (TREE_TYPE (rhs),
+ wi::min_value (TREE_TYPE (rhs)) + 1);
+ }
+ else if (wi::eq_p (wi::to_wide (rhs), wi::max_value (TREE_TYPE (rhs))))
+ {
+ cmp = (cmp == EQ_EXPR) ? GT_EXPR : LE_EXPR;
+ rhs = wide_int_to_tree (TREE_TYPE (rhs),
+ wi::max_value (TREE_TYPE (rhs)) - 1);
+ }
+ }
/* This transformation is only valid for order comparisons. Record which
operand is smaller/larger if the result of the comparison is true. */
@@ -1228,7 +1247,7 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
if (cmp == LT_EXPR || cmp == LE_EXPR)
{
smaller = gimple_cond_lhs (cond);
- larger = gimple_cond_rhs (cond);
+ larger = rhs;
/* If we have smaller < CST it is equivalent to smaller <= CST-1.
Likewise smaller <= CST is equivalent to smaller < CST+1. */
if (TREE_CODE (larger) == INTEGER_CST)
@@ -1255,7 +1274,7 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
}
else if (cmp == GT_EXPR || cmp == GE_EXPR)
{
- smaller = gimple_cond_rhs (cond);
+ smaller = rhs;
larger = gimple_cond_lhs (cond);
/* If we have larger > CST it is equivalent to larger >= CST+1.
Likewise larger >= CST is equivalent to larger > CST-1. */