As release managers are planning to release next version of GCC 6. I would like to do backport revisions attached.
The only complicated one is the one for PR69953 where I decided to backport also refactoring patches applied by Nathan (244529, 244156). I would appreciate another pair of eyes to look at backports. Thanks, Martin
>From 3d06a155b652468dae32382aae8abc9d6da10b77 Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed, 31 May 2017 11:40:13 +0000 Subject: [PATCH 15/15] Backport r248729 gcc/ChangeLog: 2017-05-31 Martin Liska <mli...@suse.cz> PR target/79155 * config/i386/cpuid.h: Fix typo in a comment in cpuid.h. --- gcc/config/i386/cpuid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h index d67eeae75ce..89e260c62eb 100644 --- a/gcc/config/i386/cpuid.h +++ b/gcc/config/i386/cpuid.h @@ -172,7 +172,7 @@ /* Return highest supported input value for cpuid instruction. ext can - be either 0x0 or 0x8000000 to return highest supported value for + be either 0x0 or 0x80000000 to return highest supported value for basic or extended cpuid information. Function returns 0 if cpuid is not supported or whatever cpuid returns in eax register. If sig pointer is non-null, then first four bytes of the signature -- 2.13.1
>From b921b54246135959a6fe9d4f6534299b3cc152fc Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue, 30 May 2017 08:02:03 +0000 Subject: [PATCH 14/15] Backport r248647 gcc/ChangeLog: 2017-05-30 Martin Liska <mli...@suse.cz> PR other/80909 * auto-profile.c (get_function_decl_from_block): Fix parenthesis. --- gcc/auto-profile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index 94afe6fd2d9..2bf5e07ab25 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -353,7 +353,7 @@ get_function_decl_from_block (tree block) { tree decl; - if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block) == UNKNOWN_LOCATION)) + if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block)) == UNKNOWN_LOCATION) return NULL_TREE; for (decl = BLOCK_ABSTRACT_ORIGIN (block); -- 2.13.1
>From eec428d554a565ae1d73e6c5824474a5751bc7ce Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri, 26 May 2017 11:05:52 +0000 Subject: [PATCH 13/15] Backport r248489 gcc/ChangeLog: 2017-05-26 Martin Liska <mli...@suse.cz> PR ipa/80663 * params.def: Bound partial-inlining-entry-probability param. gcc/testsuite/ChangeLog: 2017-05-26 Martin Liska <mli...@suse.cz> PR ipa/80663 * g++.dg/ipa/pr80212.C: Remove the test as it does not longer split at the problematic spot. * gcc.dg/ipa/pr48195.c: Change 101 to 100 as 101 is no longer a valid value of the param. --- gcc/params.def | 2 +- gcc/testsuite/g++.dg/ipa/pr80212.C | 18 ------------------ gcc/testsuite/gcc.dg/ipa/pr48195.c | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/ipa/pr80212.C diff --git a/gcc/params.def b/gcc/params.def index 76308cdfcdb..ce83aa71e6d 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -126,7 +126,7 @@ DEFPARAM (PARAM_COMDAT_SHARING_PROBABILITY, DEFPARAM (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY, "partial-inlining-entry-probability", "Maximum probability of the entry BB of split region (in percent relative to entry BB of the function) to make partial inlining happen.", - 70, 0, 0) + 70, 0, 100) /* Limit the number of expansions created by the variable expansion optimization to avoid register pressure. */ diff --git a/gcc/testsuite/g++.dg/ipa/pr80212.C b/gcc/testsuite/g++.dg/ipa/pr80212.C deleted file mode 100644 index 60d3b613035..00000000000 --- a/gcc/testsuite/g++.dg/ipa/pr80212.C +++ /dev/null @@ -1,18 +0,0 @@ -// PR ipa/80212 -// { dg-options "-O2 --param partial-inlining-entry-probability=403796683 -fno-early-inlining" } - -struct b -{ - virtual b *c () const; -}; -struct d : virtual b -{ -}; -struct e : d -{ - e * - c () const - { - } -}; -main () { e a; } diff --git a/gcc/testsuite/gcc.dg/ipa/pr48195.c b/gcc/testsuite/gcc.dg/ipa/pr48195.c index 2e38452d598..25e80bab8f8 100644 --- a/gcc/testsuite/gcc.dg/ipa/pr48195.c +++ b/gcc/testsuite/gcc.dg/ipa/pr48195.c @@ -1,5 +1,5 @@ /* { dg-do link } */ -/* { dg-options "-O2 -flto --param partial-inlining-entry-probability=101" } */ +/* { dg-options "-O2 -flto --param partial-inlining-entry-probability=100" } */ /* { dg-require-effective-target lto } */ extern void abort(void); -- 2.13.1
>From 59383db2594cfaf380ce6e91a14b4b11f977f497 Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue, 16 May 2017 08:57:05 +0000 Subject: [PATCH 12/15] Backport r248089 gcc/ChangeLog: 2017-05-16 Martin Liska <mli...@suse.cz> PR ipa/79849. PR ipa/79850. * ipa-devirt.c (warn_types_mismatch): Fix typo. (odr_types_equivalent_p): Likewise. --- gcc/ipa-devirt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 0332b3ec616..9853c4a499c 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -1225,7 +1225,7 @@ warn_types_mismatch (tree t1, tree t2, location_t loc1, location_t loc2) if (types_odr_comparable (t1, t2, true) && types_same_for_odr (t1, t2, true)) inform (loc_t1, - "type %qT itself violate the C++ One Definition Rule", t1); + "type %qT itself violates the C++ One Definition Rule", t1); /* Prevent pointless warnings like "struct aa" should match "struct aa". */ else if (TYPE_NAME (t1) == TYPE_NAME (t2) && TREE_CODE (t1) == TREE_CODE (t2) && !loc_t2_useful) @@ -1572,7 +1572,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, if (DECL_ARTIFICIAL (f1)) break; warn_odr (t1, t2, f1, f2, warn, warned, - G_("fields has different layout " + G_("fields have different layout " "in another translation unit")); return false; } -- 2.13.1
>From 2dc4257323515937f9d9cc25c1a7e8f58db5899c Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Mon, 15 May 2017 12:48:35 +0000 Subject: [PATCH 11/15] Backport r248060 gcc/ChangeLog: 2017-05-15 Martin Liska <mli...@suse.cz> PR driver/31468 * gcc.c (process_command): Do not allow empty argument of -o option. --- gcc/gcc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/gcc.c b/gcc/gcc.c index c6a6fe08448..3e2c0b1b597 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -4422,6 +4422,9 @@ process_command (unsigned int decoded_options_count, output_file); } + if (output_file != NULL && output_file[0] == '\0') + fatal_error (input_location, "output filename may not be empty"); + /* If -save-temps=obj and -o name, create the prefix to use for %b. Otherwise just make -save-temps=obj the same as -save-temps=cwd. */ if (save_temps_flag == SAVE_TEMPS_OBJ && save_temps_prefix != NULL) -- 2.13.1
>From ad5c855543843df18e0091fcf620731d74150bc4 Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue, 2 May 2017 15:37:41 +0000 Subject: [PATCH 10/15] Backport r247507 gcc/ChangeLog: 2017-05-02 Martin Liska <mli...@suse.cz> * doc/gcov.texi: Add missing preposition. * gcov.c (function_info::function_info): Properly fill up all member variables. --- gcc/doc/gcov.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index d38f63370c2..6d6a10bff11 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/gcov.texi @@ -324,7 +324,7 @@ containing no code. Unexecuted lines are marked @samp{#####} or @samp{====}, depending on whether they are reachable by non-exceptional paths or only exceptional paths such as C++ exception handlers, respectively. Given @samp{-a} option, unexecuted blocks are -marked @samp{$$$$$} or @samp{%%%%%}, depending whether a basic block +marked @samp{$$$$$} or @samp{%%%%%}, depending on whether a basic block is reachable via non-exceptional or exceptional paths. Some lines of information at the start have @var{line_number} of zero. -- 2.13.1
>From 0666bab34399acec12c83478c3aec2d2e44b49f5 Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue, 2 May 2017 09:38:55 +0000 Subject: [PATCH 09/15] Backport r247485 gcc/ChangeLog: 2017-05-02 Martin Liska <mli...@suse.cz> PR other/80589 * common.opt: Fix typo. * doc/invoke.texi: Likewise. --- gcc/common.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/common.opt b/gcc/common.opt index 67048db7c9b..a25557720b5 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2373,7 +2373,7 @@ flow and turn the statement with erroneous or undefined behavior into a trap. fisolate-erroneous-paths-attribute Common Report Var(flag_isolate_erroneous_paths_attribute) Optimization -Detect paths that trigger erroneous or undefined behavior due a null value +Detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or nonnull attribute. Isolate those paths from the main control flow and turn the statement with erroneous or undefined behavior into a trap. -- 2.13.1
>From 5ee76c1c179d15da72b09ce7a71617208cfd5f17 Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri, 28 Apr 2017 12:51:57 +0000 Subject: [PATCH 08/15] Backport r247377 gcc/ChangeLog: 2017-04-28 Martin Liska <mli...@suse.cz> * doc/gcov.texi: Enhance documentation of gcov. --- gcc/doc/gcov.texi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index 5b409e1f793..d38f63370c2 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/gcov.texi @@ -323,7 +323,9 @@ command line option. The @var{execution_count} is @samp{-} for lines containing no code. Unexecuted lines are marked @samp{#####} or @samp{====}, depending on whether they are reachable by non-exceptional paths or only exceptional paths such as C++ exception -handlers, respectively. +handlers, respectively. Given @samp{-a} option, unexecuted blocks are +marked @samp{$$$$$} or @samp{%%%%%}, depending whether a basic block +is reachable via non-exceptional or exceptional paths. Some lines of information at the start have @var{line_number} of zero. These preamble lines are of the form @@ -668,5 +670,5 @@ it. This can be overcome by, for example, setting the environment as setting will name the data file @file{/target/run/build/foo.gcda}. You must move the data files to the expected directory tree in order to -use them for profile directed optimizations (@option{--use-profile}), or to +use them for profile directed optimizations (@option{-fprofile-use}), or to use the @command{gcov} tool. -- 2.13.1
>From 6a0484ab7532ae3f44c163c0bfcb87bb9f808f88 Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri, 28 Apr 2017 12:51:40 +0000 Subject: [PATCH 07/15] Backport r247376 gcc/ChangeLog: 2017-04-28 Martin Liska <mli...@suse.cz> * doc/gcov.texi: Sort options in alphabetic order. * doc/gcov-dump.texi: Likewise. * doc/gcov-tool.texi: Likewise. * gcov.c (print_usage): Likewise. * gcov-dump.c (print_usage): Likewise. * gcov-tool.c (print_merge_usage_message): Likewise. (print_rewrite_usage_message): Likewise. (print_overlap_usage_message): Likewise. --- gcc/doc/gcov-dump.texi | 10 ++-- gcc/doc/gcov-tool.texi | 50 ++++++++--------- gcc/doc/gcov.texi | 147 +++++++++++++++++++++++++++---------------------- gcc/gcov-dump.c | 2 +- gcc/gcov-tool.c | 9 +-- gcc/gcov.c | 2 +- 6 files changed, 118 insertions(+), 102 deletions(-) diff --git a/gcc/doc/gcov-dump.texi b/gcc/doc/gcov-dump.texi index d7931fd3a19..26653d28def 100644 --- a/gcc/doc/gcov-dump.texi +++ b/gcc/doc/gcov-dump.texi @@ -72,11 +72,6 @@ gcov-dump [@option{-v}|@option{--version}] Display help about using @command{gcov-dump} (on the standard output), and exit without doing any further processing. -@item -v -@itemx --version -Display the @command{gcov-dump} version number (on the standard output), -and exit without doing any further processing. - @item -l @itemx --long Dump content of records. @@ -85,6 +80,11 @@ Dump content of records. @itemx --positions Dump positions of records. +@item -v +@itemx --version +Display the @command{gcov-dump} version number (on the standard output), +and exit without doing any further processing. + @item -w @itemx --working-sets Dump working set computed from summary. diff --git a/gcc/doc/gcov-tool.texi b/gcc/doc/gcov-tool.texi index 845f14b1041..395628e4d36 100644 --- a/gcc/doc/gcov-tool.texi +++ b/gcc/doc/gcov-tool.texi @@ -113,23 +113,23 @@ gcov-tool @r{[}@var{global-options}@r{]} SUB_COMMAND @r{[}@var{sub_command-optio gcov-tool [@option{-v}|@option{--version}] [@option{-h}|@option{--help}] gcov-tool merge [merge-options] @var{directory1} @var{directory2} + [@option{-o}|@option{--output} @var{directory}] [@option{-v}|@option{--verbose}] - [@option{-o}|@option{ --output} @var{directory}] [@option{-w}|@option{--weight} @var{w1,w2}] gcov-tool rewrite [rewrite-options] @var{directory} - [@option{-v}|@option{--verbose}] + [@option{-n}|@option{--normalize} @var{long_long_value}] [@option{-o}|@option{--output} @var{directory}] [@option{-s}|@option{--scale} @var{float_or_simple-frac_value}] - [@option{-n}|@option{--normalize} @var{long_long_value}] + [@option{-v}|@option{--verbose}] gcov-tool overlap [overlap-options] @var{directory1} @var{directory2} - [@option{-v}|@option{--verbose}] - [@option{-h}|@option{--hotonly}] [@option{-f}|@option{--function}] [@option{-F}|@option{--fullname}] + [@option{-h}|@option{--hotonly}] [@option{-o}|@option{--object}] [@option{-t}|@option{--hot_threshold}] @var{float} + [@option{-v}|@option{--verbose}] @c man end @c man begin SEEALSO @@ -152,17 +152,17 @@ and exit without doing any further processing. @item merge Merge two profile directories. - @table @gcctabopt -@item -v -@itemx --verbose -Set the verbose mode. @item -o @var{directory} @itemx --output @var{directory} Set the output profile directory. Default output directory name is @var{merged_profile}. +@item -v +@itemx --verbose +Set the verbose mode. + @item -w @var{w1},@var{w2} @itemx --weight @var{w1},@var{w2} Set the merge weights of the @var{directory1} and @var{directory2}, @@ -171,11 +171,12 @@ respectively. The default weights are 1 for both. @item rewrite Read the specified profile directory and rewrite to a new directory. - @table @gcctabopt -@item -v -@itemx --verbose -Set the verbose mode. + +@item -n @var{long_long_value} +@itemx --normalize <long_long_value> +Normalize the profile. The specified value is the max counter value +in the new profile. @item -o @var{directory} @itemx --output @var{directory} @@ -186,10 +187,9 @@ Set the output profile directory. Default output name is @var{rewrite_profile}. Scale the profile counters. The specified value can be in floating point value, or simple fraction value form, such 1, 2, 2/3, and 5/3. -@item -n @var{long_long_value} -@itemx --normalize <long_long_value> -Normalize the profile. The specified value is the max counter value -in the new profile. +@item -v +@itemx --verbose +Set the verbose mode. @end table @item overlap @@ -201,14 +201,6 @@ matched counters and p1_sum_all and p2_sum_all are the sum of counter values in profile 1 and profile 2, respectively. @table @gcctabopt -@item -v -@itemx --verbose -Set the verbose mode. - -@item -h -@itemx --hotonly -Only print info for hot objects/functions. - @item -f @itemx --function Print function level overlap score. @@ -217,6 +209,10 @@ Print function level overlap score. @itemx --fullname Print full gcda filename. +@item -h +@itemx --hotonly +Only print info for hot objects/functions. + @item -o @itemx --object Print object level overlap score. @@ -224,6 +220,10 @@ Print object level overlap score. @item -t @var{float} @itemx --hot_threshold <float> Set the threshold for hot counter value. + +@item -v +@itemx --verbose +Set the verbose mode. @end table @end table diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index 89d80499f0e..5b409e1f793 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/gcov.texi @@ -142,15 +142,6 @@ gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entry for @file{gcc}. @c man begin OPTIONS @table @gcctabopt -@item -h -@itemx --help -Display help about using @command{gcov} (on the standard output), and -exit without doing any further processing. - -@item -v -@itemx --version -Display the @command{gcov} version number (on the standard output), -and exit without doing any further processing. @item -a @itemx --all-blocks @@ -171,68 +162,18 @@ be shown, unless the @option{-u} option is given. Write branch frequencies as the number of branches taken, rather than the percentage of branches taken. -@item -n -@itemx --no-output -Do not create the @command{gcov} output file. - -@item -l -@itemx --long-file-names -Create long file names for included source files. For example, if the -header file @file{x.h} contains code, and was included in the file -@file{a.c}, then running @command{gcov} on the file @file{a.c} will -produce an output file called @file{a.c##x.h.gcov} instead of -@file{x.h.gcov}. This can be useful if @file{x.h} is included in -multiple source files and you want to see the individual -contributions. If you use the @samp{-p} option, both the including -and included file names will be complete path names. - -@item -p -@itemx --preserve-paths -Preserve complete path information in the names of generated -@file{.gcov} files. Without this option, just the filename component is -used. With this option, all directories are used, with @samp{/} characters -translated to @samp{#} characters, @file{.} directory components -removed and unremoveable @file{..} -components renamed to @samp{^}. This is useful if sourcefiles are in several -different directories. - -@item -r -@itemx --relative-only -Only output information about source files with a relative pathname -(after source prefix elision). Absolute paths are usually system -header files and coverage of any inline functions therein is normally -uninteresting. +@item -d +@itemx --display-progress +Display the progress on the standard output. @item -f @itemx --function-summaries Output summaries for each function in addition to the file level summary. -@item -o @var{directory|file} -@itemx --object-directory @var{directory} -@itemx --object-file @var{file} -Specify either the directory containing the gcov data files, or the -object path name. The @file{.gcno}, and -@file{.gcda} data files are searched for using this option. If a directory -is specified, the data files are in that directory and named after the -input file name, without its extension. If a file is specified here, -the data files are named after that file, without its extension. - -@item -s @var{directory} -@itemx --source-prefix @var{directory} -A prefix for source file names to remove when generating the output -coverage files. This option is useful when building in a separate -directory, and the pathname to the source directory is not wanted when -determining the output file names. Note that this prefix detection is -applied before determining whether the source file is absolute. - -@item -u -@itemx --unconditional-branches -When branch probabilities are given, include those of unconditional branches. -Unconditional branches are normally not interesting. - -@item -d -@itemx --display-progress -Display the progress on the standard output. +@item -h +@itemx --help +Display help about using @command{gcov} (on the standard output), and +exit without doing any further processing. @item -i @itemx --intermediate-format @@ -273,11 +214,85 @@ lcount:26,1 branch:28,nottaken @end smallexample +@item -l +@itemx --long-file-names +Create long file names for included source files. For example, if the +header file @file{x.h} contains code, and was included in the file +@file{a.c}, then running @command{gcov} on the file @file{a.c} will +produce an output file called @file{a.c##x.h.gcov} instead of +@file{x.h.gcov}. This can be useful if @file{x.h} is included in +multiple source files and you want to see the individual +contributions. If you use the @samp{-p} option, both the including +and included file names will be complete path names. + @item -m @itemx --demangled-names Display demangled function names in output. The default is to show mangled function names. +@item -n +@itemx --no-output +Do not create the @command{gcov} output file. + +@item -o @var{directory|file} +@itemx --object-directory @var{directory} +@itemx --object-file @var{file} +Specify either the directory containing the gcov data files, or the +object path name. The @file{.gcno}, and +@file{.gcda} data files are searched for using this option. If a directory +is specified, the data files are in that directory and named after the +input file name, without its extension. If a file is specified here, +the data files are named after that file, without its extension. + +@item -p +@itemx --preserve-paths +Preserve complete path information in the names of generated +@file{.gcov} files. Without this option, just the filename component is +used. With this option, all directories are used, with @samp{/} characters +translated to @samp{#} characters, @file{.} directory components +removed and unremoveable @file{..} +components renamed to @samp{^}. This is useful if sourcefiles are in several +different directories. + +@item -r +@itemx --relative-only +Only output information about source files with a relative pathname +(after source prefix elision). Absolute paths are usually system +header files and coverage of any inline functions therein is normally +uninteresting. + +@item -s @var{directory} +@itemx --source-prefix @var{directory} +A prefix for source file names to remove when generating the output +coverage files. This option is useful when building in a separate +directory, and the pathname to the source directory is not wanted when +determining the output file names. Note that this prefix detection is +applied before determining whether the source file is absolute. + +@item -u +@itemx --unconditional-branches +When branch probabilities are given, include those of unconditional branches. +Unconditional branches are normally not interesting. + +@item -v +@itemx --version +Display the @command{gcov} version number (on the standard output), +and exit without doing any further processing. + +@item -w +@itemx --verbose +Print verbose informations related to basic blocks and arcs. + +@item -x +@itemx --hash-filenames +By default, gcov uses the full pathname of the source files to to create +an output filename. This can lead to long filenames that can overflow +filesystem limits. This option creates names of the form +@file{@var{source-file}##@var{md5}.gcov}, +where the @var{source-file} component is the final filename part and +the @var{md5} component is calculated from the full mangled name that +would have been used otherwise. + @end table @command{gcov} should be run with the current directory the same as that diff --git a/gcc/gcov-dump.c b/gcc/gcov-dump.c index e16fd9d6a3a..7b04b6ae2ea 100644 --- a/gcc/gcov-dump.c +++ b/gcc/gcov-dump.c @@ -132,9 +132,9 @@ print_usage (void) printf ("Usage: gcov-dump [OPTION] ... gcovfiles\n"); printf ("Print coverage file contents\n"); printf (" -h, --help Print this help\n"); - printf (" -v, --version Print version number\n"); printf (" -l, --long Dump record contents too\n"); printf (" -p, --positions Dump record positions\n"); + printf (" -v, --version Print version number\n"); printf (" -w, --working-sets Dump working set computed from summary\n"); printf ("\nFor bug reporting instructions, please see:\n%s.\n", bug_report_url); diff --git a/gcc/gcov-tool.c b/gcc/gcov-tool.c index 911d9249321..043966a5d07 100644 --- a/gcc/gcov-tool.c +++ b/gcc/gcov-tool.c @@ -173,8 +173,8 @@ print_merge_usage_message (int error_p) FILE *file = error_p ? stderr : stdout; fnotice (file, " merge [options] <dir1> <dir2> Merge coverage file contents\n"); - fnotice (file, " -v, --verbose Verbose mode\n"); fnotice (file, " -o, --output <dir> Output directory\n"); + fnotice (file, " -v, --verbose Verbose mode\n"); fnotice (file, " -w, --weight <w1,w2> Set weights (float point values)\n"); } @@ -267,10 +267,11 @@ print_rewrite_usage_message (int error_p) FILE *file = error_p ? stderr : stdout; fnotice (file, " rewrite [options] <dir> Rewrite coverage file contents\n"); - fnotice (file, " -v, --verbose Verbose mode\n"); + fnotice (file, " -n, --normalize <int64_t> Normalize the profile\n"); fnotice (file, " -o, --output <dir> Output directory\n"); fnotice (file, " -s, --scale <float or simple-frac> Scale the profile counters\n"); fnotice (file, " -n, --normalize <long long> Normalize the profile\n"); + fnotice (file, " -v, --verbose Verbose mode\n"); } static const struct option rewrite_options[] = @@ -423,12 +424,12 @@ print_overlap_usage_message (int error_p) FILE *file = error_p ? stderr : stdout; fnotice (file, " overlap [options] <dir1> <dir2> Compute the overlap of two profiles\n"); - fnotice (file, " -v, --verbose Verbose mode\n"); - fnotice (file, " -h, --hotonly Only print info for hot objects/functions\n"); fnotice (file, " -f, --function Print function level info\n"); fnotice (file, " -F, --fullname Print full filename\n"); + fnotice (file, " -h, --hotonly Only print info for hot objects/functions\n"); fnotice (file, " -o, --object Print object level info\n"); fnotice (file, " -t <float>, --hot_threshold <float> Set the threshold for hotness\n"); + fnotice (file, " -v, --verbose Verbose mode\n"); } diff --git a/gcc/gcov.c b/gcc/gcov.c index 9c27149f84d..3a63e844225 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -471,13 +471,13 @@ print_usage (int error_p) fnotice (file, "Usage: gcov [OPTION...] SOURCE|OBJ...\n\n"); fnotice (file, "Print code coverage information.\n\n"); - fnotice (file, " -h, --help Print this help, then exit\n"); fnotice (file, " -a, --all-blocks Show information for every basic block\n"); fnotice (file, " -b, --branch-probabilities Include branch probabilities in output\n"); fnotice (file, " -c, --branch-counts Output counts of branches taken\n\ rather than percentages\n"); fnotice (file, " -d, --display-progress Display progress information\n"); fnotice (file, " -f, --function-summaries Output summaries for each function\n"); + fnotice (file, " -h, --help Print this help, then exit\n"); fnotice (file, " -i, --intermediate-format Output .gcov file in intermediate text format\n"); fnotice (file, " -l, --long-file-names Use long output file names for included\n\ source files\n"); -- 2.13.1
>From 121e6c3b5b9d4e7d917d0563b4b4a6081eb3986b Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri, 28 Apr 2017 12:51:22 +0000 Subject: [PATCH 06/15] Backport r247375 gcc/ChangeLog: 2017-04-28 Martin Liska <mli...@suse.cz> PR gcov-profile/53915 * gcov.c (format_gcov): Print 'NAN %' when top > bottom. --- gcc/gcov.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/gcov.c b/gcc/gcov.c index e60392210bf..9c27149f84d 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -1768,6 +1768,13 @@ format_gcov (gcov_type top, gcov_type bottom, int dp) { static char buffer[20]; + /* Handle invalid values that would result in a misleading value. */ + if (bottom != 0 && top > bottom && dp >= 0) + { + sprintf (buffer, "NAN %%"); + return buffer; + } + if (dp >= 0) { float ratio = bottom ? (float)top / bottom : 0; -- 2.13.1
>From 153d8781eaea461aa0988ae20a5305cf6ae3589c Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri, 28 Apr 2017 12:50:08 +0000 Subject: [PATCH 05/15] Backport r247371 gcc/ChangeLog: 2017-04-28 Martin Liska <mli...@suse.cz> PR driver/56469 * coverage.c (coverage_remove_note_file): New function. * coverage.h: Declare the function. * toplev.c (finalize): Clean if an error has been seen. --- gcc/coverage.c | 12 ++++++++++++ gcc/coverage.h | 1 + gcc/toplev.c | 3 +++ 3 files changed, 16 insertions(+) diff --git a/gcc/coverage.c b/gcc/coverage.c index b1fce7d0e7a..7ee37aa2955 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -725,6 +725,18 @@ coverage_end_function (unsigned lineno_checksum, unsigned cfg_checksum) } } +/* Remove coverage file if opened. */ + +void +coverage_remove_note_file (void) +{ + if (bbg_file_name) + { + gcov_close (); + unlink (bbg_file_name); + } +} + /* Build a coverage variable of TYPE for function FN_DECL. If COUNTER >= 0 it is a counter array, otherwise it is the function structure. */ diff --git a/gcc/coverage.h b/gcc/coverage.h index 39e48ce38f5..e0ff0fb08c3 100644 --- a/gcc/coverage.h +++ b/gcc/coverage.h @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see extern void coverage_init (const char *); extern void coverage_finish (void); +extern void coverage_remove_note_file (void); /* Start outputting coverage information for the current function. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 59604e56195..3d4137b7c7b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1926,6 +1926,9 @@ finalize (bool no_backend) if (stack_usage_file) fclose (stack_usage_file); + if (seen_error ()) + coverage_remove_note_file (); + if (!no_backend) { statistics_fini (); -- 2.13.1
>From 2715e072869a0bdc566a62819e2129eabc33091b Mon Sep 17 00:00:00 2001 From: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Thu, 13 Apr 2017 08:04:52 +0000 Subject: [PATCH 04/15] Backport r246899 gcc/ChangeLog: 2017-04-12 Jan Hubicka <hubi...@ucw.cz> PR lto/69953 * ipa-visibility.c (non_local_p): Fix typos. (localize_node): When localizing symbol in same comdat group, dissolve the group only when we know external symbols are going to be privatized. (function_and_variable_visibility): Do not localize DECL_EXTERNAL. --- gcc/ipa-visibility.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c index 25ef2623a0e..adc4426e6be 100644 --- a/gcc/ipa-visibility.c +++ b/gcc/ipa-visibility.c @@ -90,7 +90,7 @@ static bool non_local_p (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) { return !(node->only_called_directly_or_aliased_p () - /* i386 would need update to output thunk with locak calling + /* i386 would need update to output thunk with local calling ocnvetions. */ && !node->thunk.thunk_p && node->definition @@ -153,7 +153,7 @@ comdat_can_be_unshared_p_1 (symtab_node *node) /* COMDAT functions must be shared only if they have address taken, otherwise we can produce our own private implementation with -fwhole-program. - Return true when turning COMDAT functoin static can not lead to wrong + Return true when turning COMDAT function static can not lead to wrong code when the resulting object links with a library defining same COMDAT. Virtual functions do have their addresses taken from the vtables, @@ -538,6 +538,35 @@ localize_node (bool whole_program, symtab_node *node) { gcc_assert (whole_program || in_lto_p || !TREE_PUBLIC (node->decl)); + /* It is possible that one comdat group contains both hidden and non-hidden + symbols. In this case we can privatize all hidden symbol but we need + to keep non-hidden exported. */ + if (node->same_comdat_group + && node->resolution == LDPR_PREVAILING_DEF_IRONLY) + { + symtab_node *next; + for (next = node->same_comdat_group; + next != node; next = next->same_comdat_group) + if (next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP + || next->resolution == LDPR_PREVAILING_DEF) + break; + if (node != next) + { + if (!node->transparent_alias) + { + node->resolution = LDPR_PREVAILING_DEF_IRONLY; + node->make_decl_local (); + if (!flag_incremental_link) + node->unique_name |= true; + return; + } + } + } + /* For similar reason do not privatize whole comdat when seeing comdat + local. Wait for non-comdat symbol to be privatized first. */ + if (node->comdat_local_p ()) + return; + if (node->same_comdat_group && TREE_PUBLIC (node->decl)) { for (symtab_node *next = node->same_comdat_group; @@ -766,7 +795,8 @@ function_and_variable_visibility (bool whole_program) vnode->no_reorder = 1; if (!vnode->externally_visible - && !vnode->transparent_alias) + && !vnode->transparent_alias + && !DECL_EXTERNAL (vnode->decl)) localize_node (whole_program, vnode); update_visibility_by_resolution_info (vnode); -- 2.13.1
>From 720cf7739622449878ed844f0de00e68945ac6b4 Mon Sep 17 00:00:00 2001 From: nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue, 17 Jan 2017 15:04:50 +0000 Subject: [PATCH 03/15] Backport r244529 gcc/ChangeLog: 2017-01-17 Nathan Sidwell <nat...@acm.org> * ipa-visibility.c (localize_node): New function, broken out of ... (function_and_variable_visibility): ... here. Call it. --- gcc/ipa-visibility.c | 132 +++++++++++++++++++-------------------------------- 1 file changed, 50 insertions(+), 82 deletions(-) diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c index cd10ad01055..25ef2623a0e 100644 --- a/gcc/ipa-visibility.c +++ b/gcc/ipa-visibility.c @@ -530,6 +530,53 @@ optimize_weakref (symtab_node *node) gcc_assert (node->alias); } +/* NODE is an externally visible definition, which we've discovered is + not needed externally. Make it local to this compilation. */ + +static void +localize_node (bool whole_program, symtab_node *node) +{ + gcc_assert (whole_program || in_lto_p || !TREE_PUBLIC (node->decl)); + + if (node->same_comdat_group && TREE_PUBLIC (node->decl)) + { + for (symtab_node *next = node->same_comdat_group; + next != node; next = next->same_comdat_group) + { + next->set_comdat_group (NULL); + if (!next->alias) + next->set_section (NULL); + if (!next->transparent_alias) + next->make_decl_local (); + next->unique_name + |= ((next->resolution == LDPR_PREVAILING_DEF_IRONLY + || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) + && TREE_PUBLIC (next->decl) + && !flag_incremental_link); + } + + /* Now everything's localized, the grouping has no meaning, and + will cause crashes if we keep it around. */ + node->dissolve_same_comdat_group_list (); + } + + node->unique_name + |= ((node->resolution == LDPR_PREVAILING_DEF_IRONLY + || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) + && TREE_PUBLIC (node->decl) + && !flag_incremental_link); + + if (TREE_PUBLIC (node->decl)) + node->set_comdat_group (NULL); + if (DECL_COMDAT (node->decl) && !node->alias) + node->set_section (NULL); + if (!node->transparent_alias) + { + node->resolution = LDPR_PREVAILING_DEF_IRONLY; + node->make_decl_local (); + } +} + /* Decide on visibility of all symbols. */ static unsigned int @@ -607,48 +654,7 @@ function_and_variable_visibility (bool whole_program) if (!node->externally_visible && node->definition && !node->weakref && !DECL_EXTERNAL (node->decl)) - { - gcc_assert (whole_program || in_lto_p - || !TREE_PUBLIC (node->decl)); - node->unique_name - |= ((node->resolution == LDPR_PREVAILING_DEF_IRONLY - || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) - && TREE_PUBLIC (node->decl) - && !flag_incremental_link); - node->resolution = LDPR_PREVAILING_DEF_IRONLY; - if (node->same_comdat_group && TREE_PUBLIC (node->decl)) - { - symtab_node *next = node; - - /* Set all members of comdat group local. */ - for (next = node->same_comdat_group; - next != node; - next = next->same_comdat_group) - { - next->set_comdat_group (NULL); - if (!next->alias) - next->set_section (NULL); - if (!next->transparent_alias) - next->make_decl_local (); - next->unique_name - |= ((next->resolution == LDPR_PREVAILING_DEF_IRONLY - || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) - && TREE_PUBLIC (next->decl) - && !flag_incremental_link); - } - /* cgraph_externally_visible_p has already checked all - other nodes in the group and they will all be made - local. We need to dissolve the group at once so that - the predicate does not segfault though. */ - node->dissolve_same_comdat_group_list (); - } - if (TREE_PUBLIC (node->decl)) - node->set_comdat_group (NULL); - if (DECL_COMDAT (node->decl) && !node->alias) - node->set_section (NULL); - if (!node->transparent_alias) - node->make_decl_local (); - } + localize_node (whole_program, node); if (node->thunk.thunk_p && !node->thunk.add_pointer_bounds_args @@ -758,49 +764,11 @@ function_and_variable_visibility (bool whole_program) if (lookup_attribute ("no_reorder", DECL_ATTRIBUTES (vnode->decl))) vnode->no_reorder = 1; + if (!vnode->externally_visible && !vnode->transparent_alias) - { - gcc_assert (in_lto_p || whole_program || !TREE_PUBLIC (vnode->decl)); - vnode->unique_name |= ((vnode->resolution == LDPR_PREVAILING_DEF_IRONLY - || vnode->resolution - == LDPR_PREVAILING_DEF_IRONLY_EXP) - && TREE_PUBLIC (vnode->decl) - && !flag_incremental_link); - if (vnode->same_comdat_group && TREE_PUBLIC (vnode->decl)) - { - symtab_node *next = vnode; + localize_node (whole_program, vnode); - /* Set all members of comdat group local. */ - if (vnode->same_comdat_group) - for (next = vnode->same_comdat_group; - next != vnode; - next = next->same_comdat_group) - { - next->set_comdat_group (NULL); - if (!next->alias) - next->set_section (NULL); - if (!next->transparent_alias) - { - next->make_decl_local (); - next->unique_name |= ((next->resolution == LDPR_PREVAILING_DEF_IRONLY - || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) - && TREE_PUBLIC (next->decl) - && !flag_incremental_link); - } - } - vnode->dissolve_same_comdat_group_list (); - } - if (TREE_PUBLIC (vnode->decl)) - vnode->set_comdat_group (NULL); - if (DECL_COMDAT (vnode->decl) && !vnode->alias) - vnode->set_section (NULL); - if (!vnode->transparent_alias) - { - vnode->make_decl_local (); - vnode->resolution = LDPR_PREVAILING_DEF_IRONLY; - } - } update_visibility_by_resolution_info (vnode); /* Update virtual tables to point to local aliases where possible. */ -- 2.13.1
>From 35ca724ea43463bc44abb6025cd4a79bccad582a Mon Sep 17 00:00:00 2001 From: nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri, 6 Jan 2017 14:04:05 +0000 Subject: [PATCH 02/15] Backport r244156 gcc/ChangeLog: 2017-01-06 Nathan Sidwell <nat...@acm.org> * ipa-visibility.c (function_and_variable_visibility): Reformat comments and long lines. Remove extrneous if. * symtab.c (symtab_node::make_decl_local): Fix code format. (symtab_node::set_section_for_node): Fix comment typo. gcc/lto/ChangeLog: 2017-01-06 Nathan Sidwell <nat...@acm.org> * lto-partition.c (lto_balanced_map): Reformat/respell comment. (may_need_named_section_p): Likewise. (rename_statics): Likewise. (lto_promote_cross_file_statics): Likewise. --- gcc/ipa-visibility.c | 39 ++++++++++++++++++++------------------- gcc/lto/lto-partition.c | 23 +++++++++++++---------- gcc/symtab.c | 5 +++-- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c index e4c3f7c5110..cd10ad01055 100644 --- a/gcc/ipa-visibility.c +++ b/gcc/ipa-visibility.c @@ -554,9 +554,9 @@ function_and_variable_visibility (bool whole_program) DECL_STATIC_DESTRUCTOR (node->decl) = 0; } - /* Frontends and alias code marks nodes as needed before parsing is finished. - We may end up marking as node external nodes where this flag is meaningless - strip it. */ + /* Frontends and alias code marks nodes as needed before parsing + is finished. We may end up marking as node external nodes + where this flag is meaningless strip it. */ if (DECL_EXTERNAL (node->decl) || !node->definition) { node->force_output = 0; @@ -610,35 +610,36 @@ function_and_variable_visibility (bool whole_program) { gcc_assert (whole_program || in_lto_p || !TREE_PUBLIC (node->decl)); - node->unique_name |= ((node->resolution == LDPR_PREVAILING_DEF_IRONLY - || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) - && TREE_PUBLIC (node->decl) - && !flag_incremental_link); + node->unique_name + |= ((node->resolution == LDPR_PREVAILING_DEF_IRONLY + || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) + && TREE_PUBLIC (node->decl) + && !flag_incremental_link); node->resolution = LDPR_PREVAILING_DEF_IRONLY; if (node->same_comdat_group && TREE_PUBLIC (node->decl)) { symtab_node *next = node; /* Set all members of comdat group local. */ - if (node->same_comdat_group) - for (next = node->same_comdat_group; - next != node; - next = next->same_comdat_group) + for (next = node->same_comdat_group; + next != node; + next = next->same_comdat_group) { next->set_comdat_group (NULL); if (!next->alias) next->set_section (NULL); if (!next->transparent_alias) next->make_decl_local (); - next->unique_name |= ((next->resolution == LDPR_PREVAILING_DEF_IRONLY - || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) - && TREE_PUBLIC (next->decl) - && !flag_incremental_link); + next->unique_name + |= ((next->resolution == LDPR_PREVAILING_DEF_IRONLY + || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) + && TREE_PUBLIC (next->decl) + && !flag_incremental_link); } - /* cgraph_externally_visible_p has already checked all other nodes - in the group and they will all be made local. We need to - dissolve the group at once so that the predicate does not - segfault though. */ + /* cgraph_externally_visible_p has already checked all + other nodes in the group and they will all be made + local. We need to dissolve the group at once so that + the predicate does not segfault though. */ node->dissolve_same_comdat_group_list (); } if (TREE_PUBLIC (node->decl)) diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 9eb63c27f33..051b98771fc 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -664,8 +664,9 @@ lto_balanced_map (int n_lto_partitions) vnode = dyn_cast <varpool_node *> (ref->referring); gcc_assert (vnode->definition); - /* It is better to couple variables with their users, because it allows them - to be removed. Coupling with objects they refer to only helps to reduce + /* It is better to couple variables with their users, + because it allows them to be removed. Coupling + with objects they refer to only helps to reduce number of symbols promoted to hidden. */ if (!symbol_partitioned_p (vnode) && flag_toplevel_reorder && !vnode->no_reorder @@ -1003,10 +1004,11 @@ promote_symbol (symtab_node *node) "Promoting as hidden: %s\n", node->name ()); } -/* Return true if NODE needs named section even if it won't land in the partition - symbol table. - FIXME: we should really not use named sections for inline clones and master - clones. */ +/* Return true if NODE needs named section even if it won't land in + the partition symbol table. + + FIXME: we should really not use named sections for inline clones + and master clones. */ static bool may_need_named_section_p (lto_symtab_encoder_t encoder, symtab_node *node) @@ -1084,7 +1086,8 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node *node) || lto_symtab_encoder_lookup (encoder, s) != LCC_NOT_FOUND)) { if (privatize_symbol_name (s)) - /* Re-start from beginning since we do not know how many symbols changed a name. */ + /* Re-start from beginning since we do not know how many + symbols changed a name. */ s = symtab_node::get_for_asmname (name); else s = s->next_sharing_asm_name; } @@ -1125,8 +1128,8 @@ lto_promote_cross_file_statics (void) { symtab_node *node = lsei_node (lsei); - /* If symbol is static, rename it if its assembler name clash with - anything else in this unit. */ + /* If symbol is static, rename it if its assembler name + clashes with anything else in this unit. */ rename_statics (encoder, node); /* No need to promote if symbol already is externally visible ... */ @@ -1134,7 +1137,7 @@ lto_promote_cross_file_statics (void) /* ... or if it is part of current partition ... */ || lto_symtab_encoder_in_partition_p (encoder, node) /* ... or if we do not partition it. This mean that it will - appear in every partition refernecing it. */ + appear in every partition referencing it. */ || node->get_partitioning_class () != SYMBOL_PARTITION) { validize_symbol_for_target (node); diff --git a/gcc/symtab.c b/gcc/symtab.c index 3d3cc4f738c..ef2524ba642 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1261,7 +1261,8 @@ symtab_node::make_decl_local (void) TREE_ADDRESSABLE (decl) = 1; TREE_STATIC (decl) = 1; } - else gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); + else + gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); DECL_COMDAT (decl) = 0; DECL_WEAK (decl) = 0; @@ -1440,7 +1441,7 @@ symtab_node::fixup_same_cpp_alias_visibility (symtab_node *target) } /* Set section, do not recurse into aliases. - When one wants to change section of symbol and its aliases, + When one wants to change section of a symbol and its aliases, use set_section. */ void -- 2.13.1
>From cefd664dd178f0f04eeb4242d9d2c941846c2f96 Mon Sep 17 00:00:00 2001 From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Thu, 20 Oct 2016 15:30:17 +0000 Subject: [PATCH 01/15] Backport r241380 gcc/ChangeLog: 2016-10-20 Martin Liska <mli...@suse.cz> PR lto/78049 * lto-streamer-in.c (fixup_call_stmt_edges_1): Replace value comparison with STMT_UID_NOT_IN_RANGE. (fixup_call_stmt_edges): Do not fixup edges of a thunk in LTRANS. --- gcc/lto-streamer-in.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index dd48777effa..9d110dd330e 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -898,13 +898,16 @@ static void fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts, struct function *fn) { +#define STMT_UID_NOT_IN_RANGE(uid) \ + (gimple_stmt_max_uid (fn) < uid || uid == 0) + struct cgraph_edge *cedge; struct ipa_ref *ref = NULL; unsigned int i; for (cedge = node->callees; cedge; cedge = cedge->next_callee) { - if (gimple_stmt_max_uid (fn) < cedge->lto_stmt_uid) + if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid)) fatal_error (input_location, "Cgraph edge statement index out of range"); cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]); @@ -914,7 +917,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts, } for (cedge = node->indirect_calls; cedge; cedge = cedge->next_callee) { - if (gimple_stmt_max_uid (fn) < cedge->lto_stmt_uid) + if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid)) fatal_error (input_location, "Cgraph edge statement index out of range"); cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]); @@ -924,7 +927,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts, for (i = 0; node->iterate_reference (i, ref); i++) if (ref->lto_stmt_uid) { - if (gimple_stmt_max_uid (fn) < ref->lto_stmt_uid) + if (STMT_UID_NOT_IN_RANGE (ref->lto_stmt_uid)) fatal_error (input_location, "Reference statement index out of range"); ref->stmt = stmts[ref->lto_stmt_uid - 1]; @@ -946,7 +949,8 @@ fixup_call_stmt_edges (struct cgraph_node *orig, gimple **stmts) orig = orig->clone_of; fn = DECL_STRUCT_FUNCTION (orig->decl); - fixup_call_stmt_edges_1 (orig, stmts, fn); + if (!orig->thunk.thunk_p) + fixup_call_stmt_edges_1 (orig, stmts, fn); if (orig->clones) for (node = orig->clones; node != orig;) { -- 2.13.1