Bug 50513 - cross configurations fail to build ipa-inline-analysis.o with -Werror
Summary: cross configurations fail to build ipa-inline-analysis.o with -Werror
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.7.0
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks: enable-werror-always
  Show dependency treegraph
 
Reported: 2011-09-25 18:10 UTC by Jorn Wolfgang Rennecke
Modified: 2012-03-05 22:20 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: any cross
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2011-09-25 18:10:14 UTC
183 of 198 configurations in contrib/config-list.mk fail to build build with
this error:

../../../gcc/gcc/ipa-inline-analysis.c: In function ‘predicate_probability’:
../../../gcc/gcc/ipa-inline-analysis.c:485:8: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
../../../gcc/gcc/ipa-inline-analysis.c: In function ‘remap_edge_change_prob’:
../../../gcc/gcc/ipa-inline-analysis.c:2356:5: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
cc1: all warnings being treated as errors

(the other configurations fail for other reasons)

I have used a native compiler previously bootstrapped from the same sources.
I see that for the boostrap, ipa-inline-analysis.o was built once with
the bootstrap compiler, and twice with the previous stage g++.  For the
cross-compilation, on the other hand, gcc is used (even though g++ is
also available), with the additional options:
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wc++-compat
Comment 1 Mikael Pettersson 2011-09-25 19:22:14 UTC
Native builds of current trunk (mine is gcc-4.7-20110924 == r179148) also fail in the same way, when configured with --disable-build-poststage1-with-cxx.  The reason is that PR50012 (a C++ FE diagnostics bug) causes some warnings in new code to go undetected, until someone does a build in proper C mode.

Anyway, for this PR the fix should be:

--- gcc-4.7-20110924/gcc/ipa-inline-analysis.c.~1~      2011-09-23 19:30:34.000000000 +0200
+++ gcc-4.7-20110924/gcc/ipa-inline-analysis.c  2011-09-25 20:39:45.000000000 +0200
@@ -482,8 +482,8 @@ predicate_probability (conditions conds,
                                     i2 - predicate_first_dynamic_condition);
                    if (c->code == CHANGED
                        && (c->operand_num
-                           < VEC_length (inline_param_summary_t,
-                                         inline_param_summary)))
+                           < (int) VEC_length (inline_param_summary_t,
+                                               inline_param_summary)))
                      {
                        int iprob = VEC_index (inline_param_summary_t,
                                               inline_param_summary,
@@ -2353,8 +2353,8 @@ remap_edge_change_prob (struct cgraph_ed
          struct ipa_jump_func *jfunc = ipa_get_ith_jump_func (args, i);
          if (jfunc->type == IPA_JF_PASS_THROUGH
              && (jfunc->value.pass_through.formal_id
-                 < VEC_length (inline_param_summary_t,
-                               inlined_es->param)))
+                 < (int) VEC_length (inline_param_summary_t,
+                                     inlined_es->param)))
            {
              int prob1 = VEC_index (inline_param_summary_t,
                                     es->param, i)->change_prob;
Comment 2 Mikael Pettersson 2011-09-27 13:34:56 UTC
Probably fixed by Richard Sandiford in r179268.
Comment 3 Jorn Wolfgang Rennecke 2012-03-05 22:20:40 UTC
(In reply to comment #2)
> Probably fixed by Richard Sandiford in r179268.

I can confirm that the file builds fine in r184927