public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
@ 2015-01-15 11:23 Jakub Jelinek
  2015-01-15 11:27 ` Richard Biener
  0 siblings, 1 reply; 14+ messages in thread
From: Jakub Jelinek @ 2015-01-15 11:23 UTC (permalink / raw)
  To: gcc-patches

Hi!

I ran into -Werror=maybe-uninitialized errors during profiledbootstrap
(../configure --enable-languages=c,c++ --enable-checking=release;
make -j16 profiledboostrap) before I hit a miscompilation I'm going to file.

Is this ok for trunk, or do we want to work around them differently?

2015-01-14  Jakub Jelinek  <jakub@redhat.com>

	* gengtype.c (create_user_defined_type): Workaround
	-Wmaybe-uninitialized false positives.
	* cse.c (fold_rtx): Likewise.
	* loop-invariant.c (gain_for_invariant): Likewise.

--- gcc/gengtype.c.jj	2015-01-14 17:46:50.000000000 +0100
+++ gcc/gengtype.c	2015-01-14 18:15:19.285494736 +0100
@@ -611,7 +611,7 @@ create_user_defined_type (const char *ty
 	 comma-separated list of strings, implicitly assumed to
 	 be type names, potentially with "*" characters.  */
       char *arg = open_bracket + 1;
-      char *next;
+      char *next = NULL;
       char *type_id = strtoken (arg, ",>", &next);
       pair_p fields = 0;
       while (type_id)
--- gcc/cse.c.jj	2015-01-14 17:49:01.000000000 +0100
+++ gcc/cse.c	2015-01-14 19:02:40.638325329 +0100
@@ -3093,8 +3093,8 @@ fold_rtx (rtx x, rtx_insn *insn)
   int changed = 0;
 
   /* Operands of X.  */
-  rtx folded_arg0;
-  rtx folded_arg1;
+  rtx folded_arg0 = NULL_RTX;
+  rtx folded_arg1 = NULL_RTX;
 
   /* Constant equivalents of first three operands of X;
      0 when no such equivalent is known.  */
--- gcc/loop-invariant.c.jj	2015-01-14 17:50:10.000000000 +0100
+++ gcc/loop-invariant.c	2015-01-14 21:13:23.780857707 +0100
@@ -1268,7 +1268,7 @@ gain_for_invariant (struct invariant *in
 		    bool speed, bool call_p)
 {
   int comp_cost, size_cost;
-  enum reg_class cl;
+  enum reg_class cl = NO_REGS;
   int ret;
 
   actual_stamp++;

	Jakub

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-15 11:23 [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap Jakub Jelinek
@ 2015-01-15 11:27 ` Richard Biener
  2015-01-15 11:41   ` Jakub Jelinek
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Biener @ 2015-01-15 11:27 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches

On Thu, Jan 15, 2015 at 12:10 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> I ran into -Werror=maybe-uninitialized errors during profiledbootstrap
> (../configure --enable-languages=c,c++ --enable-checking=release;
> make -j16 profiledboostrap) before I hit a miscompilation I'm going to file.
>
> Is this ok for trunk, or do we want to work around them differently?

I wonder if we can arrange profiledbootstrap to use --disable-werror
unless --enable-werror is specified explicitely...  Similarly useful
if we could do a similar thing from non-standard build-configs...

I also wonder if we shouldn't simply fix the uninit pass ...

Richard.

> 2015-01-14  Jakub Jelinek  <jakub@redhat.com>
>
>         * gengtype.c (create_user_defined_type): Workaround
>         -Wmaybe-uninitialized false positives.
>         * cse.c (fold_rtx): Likewise.
>         * loop-invariant.c (gain_for_invariant): Likewise.
>
> --- gcc/gengtype.c.jj   2015-01-14 17:46:50.000000000 +0100
> +++ gcc/gengtype.c      2015-01-14 18:15:19.285494736 +0100
> @@ -611,7 +611,7 @@ create_user_defined_type (const char *ty
>          comma-separated list of strings, implicitly assumed to
>          be type names, potentially with "*" characters.  */
>        char *arg = open_bracket + 1;
> -      char *next;
> +      char *next = NULL;
>        char *type_id = strtoken (arg, ",>", &next);
>        pair_p fields = 0;
>        while (type_id)
> --- gcc/cse.c.jj        2015-01-14 17:49:01.000000000 +0100
> +++ gcc/cse.c   2015-01-14 19:02:40.638325329 +0100
> @@ -3093,8 +3093,8 @@ fold_rtx (rtx x, rtx_insn *insn)
>    int changed = 0;
>
>    /* Operands of X.  */
> -  rtx folded_arg0;
> -  rtx folded_arg1;
> +  rtx folded_arg0 = NULL_RTX;
> +  rtx folded_arg1 = NULL_RTX;
>
>    /* Constant equivalents of first three operands of X;
>       0 when no such equivalent is known.  */
> --- gcc/loop-invariant.c.jj     2015-01-14 17:50:10.000000000 +0100
> +++ gcc/loop-invariant.c        2015-01-14 21:13:23.780857707 +0100
> @@ -1268,7 +1268,7 @@ gain_for_invariant (struct invariant *in
>                     bool speed, bool call_p)
>  {
>    int comp_cost, size_cost;
> -  enum reg_class cl;
> +  enum reg_class cl = NO_REGS;
>    int ret;
>
>    actual_stamp++;
>
>         Jakub

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-15 11:27 ` Richard Biener
@ 2015-01-15 11:41   ` Jakub Jelinek
  2015-01-15 11:47     ` Richard Biener
  0 siblings, 1 reply; 14+ messages in thread
From: Jakub Jelinek @ 2015-01-15 11:41 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On Thu, Jan 15, 2015 at 12:17:44PM +0100, Richard Biener wrote:
> On Thu, Jan 15, 2015 at 12:10 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> > Hi!
> >
> > I ran into -Werror=maybe-uninitialized errors during profiledbootstrap
> > (../configure --enable-languages=c,c++ --enable-checking=release;
> > make -j16 profiledboostrap) before I hit a miscompilation I'm going to file.
> >
> > Is this ok for trunk, or do we want to work around them differently?
> 
> I wonder if we can arrange profiledbootstrap to use --disable-werror
> unless --enable-werror is specified explicitely...  Similarly useful
> if we could do a similar thing from non-standard build-configs...

For non-standard ones I'm ok, but I've always hoped that profiledbootstrap
is considered standard.  It certainly worked fine with -Werror at least
for us in gcc 4.[4-9].

> I also wonder if we shouldn't simply fix the uninit pass ...

If it is possible, sure, but it isn't always the case.

We could also just use type var = var; if that is the way to avoid
the warnings and not generate extra code.

	Jakub

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-15 11:41   ` Jakub Jelinek
@ 2015-01-15 11:47     ` Richard Biener
  2015-01-19 14:56       ` Martin Liška
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Biener @ 2015-01-15 11:47 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches

On Thu, Jan 15, 2015 at 12:29 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Jan 15, 2015 at 12:17:44PM +0100, Richard Biener wrote:
>> On Thu, Jan 15, 2015 at 12:10 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > Hi!
>> >
>> > I ran into -Werror=maybe-uninitialized errors during profiledbootstrap
>> > (../configure --enable-languages=c,c++ --enable-checking=release;
>> > make -j16 profiledboostrap) before I hit a miscompilation I'm going to file.
>> >
>> > Is this ok for trunk, or do we want to work around them differently?
>>
>> I wonder if we can arrange profiledbootstrap to use --disable-werror
>> unless --enable-werror is specified explicitely...  Similarly useful
>> if we could do a similar thing from non-standard build-configs...
>
> For non-standard ones I'm ok, but I've always hoped that profiledbootstrap
> is considered standard.  It certainly worked fine with -Werror at least
> for us in gcc 4.[4-9].

Indeed it did (with release checking at least).

>> I also wonder if we shouldn't simply fix the uninit pass ...
>
> If it is possible, sure, but it isn't always the case.
>
> We could also just use type var = var; if that is the way to avoid
> the warnings and not generate extra code.

Is that portable though?  (legal C, not subject to other compilers
that it might be "hineous"...)

Anyway, I guess the patch is ok if you add a comment after the inits
/* initialize to avoid warnings with profiledbootstrap */
or similar.  Otherwise people might be tempted to remove the
init again (or wonder why it is there) as it works in regular bootstrap.

Thanks,
Richard.


>         Jakub

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-15 11:47     ` Richard Biener
@ 2015-01-19 14:56       ` Martin Liška
  2015-01-19 15:44         ` Jakub Jelinek
  0 siblings, 1 reply; 14+ messages in thread
From: Martin Liška @ 2015-01-19 14:56 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]

On 01/15/2015 12:35 PM, Richard Biener wrote:
> On Thu, Jan 15, 2015 at 12:29 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Thu, Jan 15, 2015 at 12:17:44PM +0100, Richard Biener wrote:
>>> On Thu, Jan 15, 2015 at 12:10 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>>>> Hi!
>>>>
>>>> I ran into -Werror=maybe-uninitialized errors during profiledbootstrap
>>>> (../configure --enable-languages=c,c++ --enable-checking=release;
>>>> make -j16 profiledboostrap) before I hit a miscompilation I'm going to file.
>>>>
>>>> Is this ok for trunk, or do we want to work around them differently?
>>>
>>> I wonder if we can arrange profiledbootstrap to use --disable-werror
>>> unless --enable-werror is specified explicitely...  Similarly useful
>>> if we could do a similar thing from non-standard build-configs...
>>
>> For non-standard ones I'm ok, but I've always hoped that profiledbootstrap
>> is considered standard.  It certainly worked fine with -Werror at least
>> for us in gcc 4.[4-9].
>
> Indeed it did (with release checking at least).
>
>>> I also wonder if we shouldn't simply fix the uninit pass ...
>>
>> If it is possible, sure, but it isn't always the case.
>>
>> We could also just use type var = var; if that is the way to avoid
>> the warnings and not generate extra code.
>
> Is that portable though?  (legal C, not subject to other compilers
> that it might be "hineous"...)
>
> Anyway, I guess the patch is ok if you add a comment after the inits
> /* initialize to avoid warnings with profiledbootstrap */
> or similar.  Otherwise people might be tempted to remove the
> init again (or wonder why it is there) as it works in regular bootstrap.
>
> Thanks,
> Richard.
>
>
>>          Jakub

Hello.

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.

Ready for trunk?

Thanks,
Martin

[-- Attachment #2: 0001-Remove-false-positives-for-warnings-that-break-LTO-p.patch --]
[-- Type: text/x-patch, Size: 3345 bytes --]

From 53c21661d2371c513b5940ee534b89044c066d2a 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             | 7 +++++++
 4 files changed, 21 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..03a8303 100644
--- 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"
+
 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)
-- 
2.1.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-19 14:56       ` Martin Liška
@ 2015-01-19 15:44         ` Jakub Jelinek
  2015-01-19 18:53           ` Martin Liška
  0 siblings, 1 reply; 14+ messages in thread
From: Jakub Jelinek @ 2015-01-19 15:44 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

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.
> +
>  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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-19 15:44         ` Jakub Jelinek
@ 2015-01-19 18:53           ` Martin Liška
  2015-01-22 18:30             ` Jeff Law
  2015-01-27  5:38             ` DJ Delorie
  0 siblings, 2 replies; 14+ messages in thread
From: Martin Liška @ 2015-01-19 18:53 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1483 bytes --]

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
>


[-- Attachment #2: 0001-Remove-false-positives-for-warnings-that-break-LTO-p.patch --]
[-- Type: text/x-patch, Size: 3422 bytes --]

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-19 18:53           ` Martin Liška
@ 2015-01-22 18:30             ` Jeff Law
  2015-01-27  5:38             ` DJ Delorie
  1 sibling, 0 replies; 14+ messages in thread
From: Jeff Law @ 2015-01-22 18:30 UTC (permalink / raw)
  To: Martin Liška, gcc-patches

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-19 18:53           ` Martin Liška
  2015-01-22 18:30             ` Jeff Law
@ 2015-01-27  5:38             ` DJ Delorie
  2015-01-27 14:17               ` Martin Liška
  1 sibling, 1 reply; 14+ messages in thread
From: DJ Delorie @ 2015-01-27  5:38 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches


> +/* 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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-27  5:38             ` DJ Delorie
@ 2015-01-27 14:17               ` Martin Liška
  2015-01-30 12:52                 ` Martin Liška
  2015-03-04 13:18                 ` Martin Liška
  0 siblings, 2 replies; 14+ messages in thread
From: Martin Liška @ 2015-01-27 14:17 UTC (permalink / raw)
  To: gcc-patches

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.
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-27 14:17               ` Martin Liška
@ 2015-01-30 12:52                 ` Martin Liška
  2015-01-30 13:03                   ` Jakub Jelinek
  2015-03-04 13:18                 ` Martin Liška
  1 sibling, 1 reply; 14+ messages in thread
From: Martin Liška @ 2015-01-30 12:52 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]

On 01/27/2015 01:31 PM, Martin Liška wrote:
> 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.
>>
>

Hello.

There's a small patch that updates the version.

Ready for trunk?

Thanks,
Martin

[-- Attachment #2: 0001-Guard-GCC-version-for-a-pragma-ifdef.patch --]
[-- Type: text/x-patch, Size: 981 bytes --]

From 8d0b78b9106f3b9d1c0cdb6c191dc5ac5b93babe Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Fri, 30 Jan 2015 12:44:17 +0100
Subject: [PATCH] Guard GCC version for a pragma ifdef.

gcc/ChangeLog:

2015-01-30  Martin Liska  <mliska@suse.cz>

	* tree.h: Guard GCC version for a pragma ifdef.
---
 gcc/tree.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/tree.h b/gcc/tree.h
index 6c69fce..c3e9a63 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3052,7 +3052,7 @@ tree_int_cst_elt_check (tree __t, int __i,
 
 /* Workaround -Wstrict-overflow false positive during profiledbootstrap.  */
 
-# if GCC_VERSION >= 4004
+# if GCC_VERSION >= 4006
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wstrict-overflow"
 #endif
@@ -3068,7 +3068,7 @@ tree_vec_elt_check (tree __t, int __i,
   return &CONST_CAST_TREE (__t)->vec.a[__i];
 }
 
-# if GCC_VERSION >= 4004
+# if GCC_VERSION >= 4006
 #pragma GCC diagnostic pop
 #endif
 
-- 
2.1.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-30 12:52                 ` Martin Liška
@ 2015-01-30 13:03                   ` Jakub Jelinek
  0 siblings, 0 replies; 14+ messages in thread
From: Jakub Jelinek @ 2015-01-30 13:03 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

On Fri, Jan 30, 2015 at 12:46:43PM +0100, Martin Liška wrote:
> There's a small patch that updates the version.
> 
> Ready for trunk?

> 2015-01-30  Martin Liska  <mliska@suse.cz>
> 
> 	* tree.h: Guard GCC version for a pragma ifdef.

	* tree.h: Change GCC_VERSION >= 4004 to GCC_VERSION >= 4006
	in #pragma GCC diagnostic guards.
?

Ok with that change.

> --- a/gcc/tree.h
> +++ b/gcc/tree.h
> @@ -3052,7 +3052,7 @@ tree_int_cst_elt_check (tree __t, int __i,
>  
>  /* Workaround -Wstrict-overflow false positive during profiledbootstrap.  */
>  
> -# if GCC_VERSION >= 4004
> +# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic push
>  #pragma GCC diagnostic ignored "-Wstrict-overflow"
>  #endif
> @@ -3068,7 +3068,7 @@ tree_vec_elt_check (tree __t, int __i,
>    return &CONST_CAST_TREE (__t)->vec.a[__i];
>  }
>  
> -# if GCC_VERSION >= 4004
> +# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic pop
>  #endif
>  
> -- 
> 2.1.2
> 


	Jakub

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-01-27 14:17               ` Martin Liška
  2015-01-30 12:52                 ` Martin Liška
@ 2015-03-04 13:18                 ` Martin Liška
  2015-03-04 17:16                   ` Jeff Law
  1 sibling, 1 reply; 14+ messages in thread
From: Martin Liška @ 2015-03-04 13:18 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1788 bytes --]

On 01/27/2015 01:31 PM, Martin Liška wrote:
> 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.
>>
>

Hello.

There is a patch with 2 hunks that are related to the same problem on powerpc64le-unknown-linux-gnu.
Ready for trunk?

Thanks,
Martin

[-- Attachment #2: 0001-Fix-warnings-occured-during-profiledboostrap-on-powe.patch --]
[-- Type: text/x-patch, Size: 1744 bytes --]

From ea05ba5d0e4a5963e063564ffbec84f901111fac Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 3 Mar 2015 21:41:09 +0000
Subject: [PATCH] Fix warnings occured during profiledboostrap on
 powerpc64le-unknown-linux-gnu.

gcc/ChangeLog:

2015-03-04  Martin Liska  <mliska@suse.cz>

	* ipa-inline.c (inline_small_functions): Set default value to
	prevent warning during bootstrap.
	* tree.h: Add pragma guard that ignores false positives during
	bootstrap.
---
 gcc/ipa-inline.c | 2 +-
 gcc/tree.h       | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index db77d12..9ac9c02 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1710,7 +1710,7 @@ inline_small_functions (void)
   FOR_EACH_DEFINED_FUNCTION (node)
     {
       bool update = false;
-      struct cgraph_edge *next;
+      struct cgraph_edge *next = NULL;
       bool has_speculative = false;
 
       if (dump_file)
diff --git a/gcc/tree.h b/gcc/tree.h
index c3e9a63..8f93a51 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3278,6 +3278,11 @@ non_type_check (const_tree __t, const char *__f, int __l, const char *__g)
   return __t;
 }
 
+# if GCC_VERSION >= 4006
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+#endif
+
 inline const_tree *
 tree_vec_elt_check (const_tree __t, int __i,
                     const char *__f, int __l, const char *__g)
@@ -3290,6 +3295,10 @@ tree_vec_elt_check (const_tree __t, int __i,
   //return &__t->vec.a[__i];
 }
 
+# if GCC_VERSION >= 4006
+#pragma GCC diagnostic pop
+#endif
+
 inline const_tree *
 omp_clause_elt_check (const_tree __t, int __i,
                       const char *__f, int __l, const char *__g)
-- 
2.1.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap
  2015-03-04 13:18                 ` Martin Liška
@ 2015-03-04 17:16                   ` Jeff Law
  0 siblings, 0 replies; 14+ messages in thread
From: Jeff Law @ 2015-03-04 17:16 UTC (permalink / raw)
  To: Martin Liška, gcc-patches

On 03/04/15 06:18, Martin Liška wrote:

>
> Hello.
>
> There is a patch with 2 hunks that are related to the same problem on
> powerpc64le-unknown-linux-gnu.
> Ready for trunk?
>
> Thanks,
> Martin
>
> 0001-Fix-warnings-occured-during-profiledboostrap-on-powe.patch
>
>
>  From ea05ba5d0e4a5963e063564ffbec84f901111fac Mon Sep 17 00:00:00 2001
> From: marxin<mliska@suse.cz>
> Date: Tue, 3 Mar 2015 21:41:09 +0000
> Subject: [PATCH] Fix warnings occured during profiledboostrap on
>   powerpc64le-unknown-linux-gnu.
>
> gcc/ChangeLog:
>
> 2015-03-04  Martin Liska<mliska@suse.cz>
>
> 	* ipa-inline.c (inline_small_functions): Set default value to
> 	prevent warning during bootstrap.
> 	* tree.h: Add pragma guard that ignores false positives during
> 	bootstrap.
OK.
jeff

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-03-04 17:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-15 11:23 [PATCH] Workaround -Wmaybe-uninitialized false positives during profiledbootstrap Jakub Jelinek
2015-01-15 11:27 ` Richard Biener
2015-01-15 11:41   ` Jakub Jelinek
2015-01-15 11:47     ` Richard Biener
2015-01-19 14:56       ` Martin Liška
2015-01-19 15:44         ` Jakub Jelinek
2015-01-19 18:53           ` Martin Liška
2015-01-22 18:30             ` Jeff Law
2015-01-27  5:38             ` DJ Delorie
2015-01-27 14:17               ` Martin Liška
2015-01-30 12:52                 ` Martin Liška
2015-01-30 13:03                   ` Jakub Jelinek
2015-03-04 13:18                 ` Martin Liška
2015-03-04 17:16                   ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).