Message ID | 54BD4D41.1050506@suse.cz |
---|---|
State | New |
Headers | show |
On 01/19/15 11:30, Martin Liška wrote: > On 01/19/2015 03:48 PM, Jakub Jelinek wrote: >> On Mon, Jan 19, 2015 at 03:44:20PM +0100, Martin Liška wrote: >>> There's a bunch of another places that emit false positives. With >>> following patch, >>> I am able to run profiledbootstrap on x86_64-linux-pc and >>> ppc64-linux-pc. >> >> I don't know what we consider standard and where we allow warnings and >> thus >> require --disable-werror, so will defer to Richard. >> >>> --- a/gcc/tree.h >>> +++ b/gcc/tree.h >>> @@ -3050,6 +3050,11 @@ tree_int_cst_elt_check (tree __t, int __i, >>> return &CONST_CAST_TREE (__t)->int_cst.val[__i]; >>> } >>> >>> +/* Workaround -Wstrict-overflow false positive during >>> profiledbootstrap. */ >>> + >>> +#pragma GCC diagnostic push >>> +#pragma GCC diagnostic ignored "-Wstrict-overflow" >> >> Just I wonder if this shouldn't be guarded by GCC_VERSION >= something >> that actually supports those. > > Thank you Jakub, you are right that this feature was added in 4.4 ([1]). > I send a new version of the patch. > > Thanks, > Martin > > [1] https://gcc.gnu.org/gcc-4.4/changes.html > >>> + >>> inline tree * >>> tree_vec_elt_check (tree __t, int __i, >>> const char *__f, int __l, const char *__g) >>> @@ -3061,6 +3066,8 @@ tree_vec_elt_check (tree __t, int __i, >>> return &CONST_CAST_TREE (__t)->vec.a[__i]; >>> } >>> >>> +#pragma GCC diagnostic pop >>> + >>> inline tree * >>> omp_clause_elt_check (tree __t, int __i, >>> const char *__f, int __l, const char *__g) >> >> Jakub >> > > > 0001-Remove-false-positives-for-warnings-that-break-LTO-p.patch > > > From d3fb9b15c2ac00e2e265925b2e822e1e20dc39af Mon Sep 17 00:00:00 2001 > From: mliska<mliska@suse.cz> > Date: Mon, 19 Jan 2015 13:30:53 +0100 > Subject: [PATCH] Remove false positives for warnings that break LTO profiled > bootstrap. > > gcc/ChangeLog: > > 2015-01-19 Martin Liska<mliska@suse.cz> > > * tree.h (tree_vec_elt_check): Workaround -Wstrict-overflow > false positive during profiledbootstrap. > > gcc/fortran/ChangeLog: > > 2015-01-19 Martin Liska<mliska@suse.cz> > > * decl.c (attr_decl1): Workaround -Wmaybe-uninitialized > false positive during profiledbootstrap by initializing them. > * matchexp.c (match_mult_operand): Likewise. > * module.c (write_atom): Likewise. > (read_module): Likewise. OK for the trunk. Thanks for marking these as working around -Wmaybe-uninitialized false positives. I'm going to assume that the initializer value you selected was a good one. Jeff
> +/* Workaround -Wstrict-overflow false positive during profiledbootstrap. */ > + > +# if GCC_VERSION >= 4004 > +#pragma GCC diagnostic push > +#pragma GCC diagnostic ignored "-Wstrict-overflow" > +#endif > + #pragma diagnostic ignored was added in 4.4 but #pragma diagnostic push/pop wasn't added until a later release (4.6 I think). Attempts to build with 4.4 (i.e. on RHEL 6) causes warnings on most files. 2010-06-21 DJ Delorie <dj@redhat.com> * diagnostic.h (diagnostic_classification_change_t): New. (diagnostic_context): Add history and push/pop list. (diagnostic_push_diagnostics): Declare. (diagnostic_pop_diagnostics): Declare. * diagnostic.c (diagnostic_classify_diagnostic): Store changes from pragmas in a history chain instead of the global table. (diagnostic_push_diagnostics): New. (diagnostic_pop_diagnostics): New. (diagnostic_report_diagnostic): Scan history chain to find state of diagnostics as of the diagnostic location. * opts.c (set_option): Pass UNKNOWN_LOCATION to diagnostic_classify_diagnostic. (enable_warning_as_error): Likewise. * diagnostic-core.h (DK_POP): Add after "real" diagnostics, for use in the history chain. * doc/extend.texi: Document pragma GCC diagnostic changes.
On 01/27/2015 05:23 AM, DJ Delorie wrote: >> +/* Workaround -Wstrict-overflow false positive during profiledbootstrap. */ >> + >> +# if GCC_VERSION >= 4004 >> +#pragma GCC diagnostic push >> +#pragma GCC diagnostic ignored "-Wstrict-overflow" >> +#endif >> + > > #pragma diagnostic ignored was added in 4.4 but #pragma diagnostic > push/pop wasn't added until a later release (4.6 I think). Attempts > to build with 4.4 (i.e. on RHEL 6) causes warnings on most files. Hello. Thank you for pointing out, thus changing to 4006 would be the right fix? Thanks, Martin > 2010-06-21 DJ Delorie <dj@redhat.com> > > * diagnostic.h (diagnostic_classification_change_t): New. > (diagnostic_context): Add history and push/pop list. > (diagnostic_push_diagnostics): Declare. > (diagnostic_pop_diagnostics): Declare. > * diagnostic.c (diagnostic_classify_diagnostic): Store changes > from pragmas in a history chain instead of the global table. > (diagnostic_push_diagnostics): New. > (diagnostic_pop_diagnostics): New. > (diagnostic_report_diagnostic): Scan history chain to find state > of diagnostics as of the diagnostic location. > * opts.c (set_option): Pass UNKNOWN_LOCATION to > diagnostic_classify_diagnostic. > (enable_warning_as_error): Likewise. > * diagnostic-core.h (DK_POP): Add after "real" diagnostics, for > use in the history chain. > * doc/extend.texi: Document pragma GCC diagnostic changes. >
From d3fb9b15c2ac00e2e265925b2e822e1e20dc39af Mon Sep 17 00:00:00 2001 From: mliska <mliska@suse.cz> Date: Mon, 19 Jan 2015 13:30:53 +0100 Subject: [PATCH] Remove false positives for warnings that break LTO profiled bootstrap. gcc/ChangeLog: 2015-01-19 Martin Liska <mliska@suse.cz> * tree.h (tree_vec_elt_check): Workaround -Wstrict-overflow false positive during profiledbootstrap. gcc/fortran/ChangeLog: 2015-01-19 Martin Liska <mliska@suse.cz> * decl.c (attr_decl1): Workaround -Wmaybe-uninitialized false positive during profiledbootstrap by initializing them. * matchexp.c (match_mult_operand): Likewise. * module.c (write_atom): Likewise. (read_module): Likewise. --- gcc/fortran/decl.c | 5 ++++- gcc/fortran/matchexp.c | 4 +++- gcc/fortran/module.c | 9 +++++++-- gcc/tree.h | 11 +++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 2a200fc..cc35c65 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -6391,7 +6391,10 @@ attr_decl1 (void) { char name[GFC_MAX_SYMBOL_LEN + 1]; gfc_array_spec *as; - gfc_symbol *sym; + + /* Workaround -Wmaybe-uninitialized false positive during + profiledbootstrap by initializing them. */ + gfc_symbol *sym = NULL; locus var_locus; match m; diff --git a/gcc/fortran/matchexp.c b/gcc/fortran/matchexp.c index ec07dfc..fc35c8c 100644 --- a/gcc/fortran/matchexp.c +++ b/gcc/fortran/matchexp.c @@ -258,7 +258,9 @@ match_add_op (void) static match match_mult_operand (gfc_expr **result) { - gfc_expr *e, *exp, *r; + /* Workaround -Wmaybe-uninitialized false positive during + profiledbootstrap by initializing them. */ + gfc_expr *e = NULL, *exp, *r; locus where; match m; diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index c47489a..4cfc0e2 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -1536,7 +1536,10 @@ static void write_atom (atom_type atom, const void *v) { char buffer[20]; - int i, len; + + /* Workaround -Wmaybe-uninitialized false positive during + profiledbootstrap by initializing them. */ + int i = 0, len; const char *p; switch (atom) @@ -4908,7 +4911,9 @@ read_module (void) const char *p; char name[GFC_MAX_SYMBOL_LEN + 1]; int i; - int ambiguous, j, nuse, symbol; + /* Workaround -Wmaybe-uninitialized false positive during + profiledbootstrap by initializing them. */ + int ambiguous = 0, j, nuse, symbol = 0; pointer_info *info, *q; gfc_use_rename *u = NULL; gfc_symtree *st; diff --git a/gcc/tree.h b/gcc/tree.h index 4f83b38..a912e5e 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3050,6 +3050,13 @@ tree_int_cst_elt_check (tree __t, int __i, return &CONST_CAST_TREE (__t)->int_cst.val[__i]; } +/* Workaround -Wstrict-overflow false positive during profiledbootstrap. */ + +# if GCC_VERSION >= 4004 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#endif + inline tree * tree_vec_elt_check (tree __t, int __i, const char *__f, int __l, const char *__g) @@ -3061,6 +3068,10 @@ tree_vec_elt_check (tree __t, int __i, return &CONST_CAST_TREE (__t)->vec.a[__i]; } +# if GCC_VERSION >= 4004 +#pragma GCC diagnostic pop +#endif + inline tree * omp_clause_elt_check (tree __t, int __i, const char *__f, int __l, const char *__g) -- 2.1.2