This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch fortran]: Fix warnings in resolve.c
- From: Kai Tietz <Kai dot Tietz at onevision dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 8 Jun 2010 14:43:20 +0200
- Subject: Re: [patch fortran]: Fix warnings in resolve.c
Tobias Burnus <burnus@net-b.de> wrote on 08.06.2010 14:39:14:
> On 06/08/2010 11:10 AM, Kai Tietz wrote:
> > this patch fixes two warnings about "might be used uninitialized"
> > warnings.
>
>
> > +++ gcc/gcc/fortran/resolve.c 2010-06-08 11:06:40.458536300 +0200
> > @@ -6002,7 +6002,7 @@ resolve_deallocate_expr (gfc_expr *e)
> > - gfc_symbol *sym;
> > + gfc_symbol *sym = NULL;
>
> I do not understand this warning. The source is as follows:
>
> ------------- < cut > ----------------
> gfc_symbol *sym;
> gfc_component *c;
>
> /* Check INTENT(IN), unless the object is a sub-component of a
> pointer. */
> check_intent_in = 1;
>
> if (gfc_resolve_expr (e) == FAILURE)
> return FAILURE;
>
> if (e->expr_type != EXPR_VARIABLE)
> goto bad;
>
> sym = e->symtree->n.sym;
> [...]
> ------------- </cut > ----------------
>
> Thus, I do not see why the compiler warns. Any idea?
>
>
>
> > @@ -6196,7 +6196,7 @@ resolve_allocate_expr (gfc_expr *e, gfc_
> > - gfc_symbol *sym;
> > + gfc_symbol *sym = NULL;
>
> Here, I can understand the warning:
>
> if (e->symtree)
> sym = e->symtree->n.sym;
>
> if (e->expr_type != EXPR_VARIABLE)
> [...]
> else
> {
> if (sym->ts.type == BT_CLASS)
>
> as the compiler cannot know that the variable is indeed non-initialized.
> However, I thought that file is build with -Werror thus I am surprised
> that we do not get build failures. Namely, it is build here with:
>
> -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes
> -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long
> -Wno-variadic-macros -Wno-overlength-strings -Werror -Wold-
> style-definition -Wc++-compat
>
> and -Wall turns on -Wuninitialized. However, I do not see a warning in
> the logs.
Well, I saw this warnings by using gcc (GCC) 3.4.4 (cygming special, gdc
0.12, using dmd 0.125).
I assume that the goto bad is the reason, why this version can't see
through.
> Thus, can you dig a bit more (a) why you see the warning while I don't.
> (b) why -Werror does not stop the build? If (a) is solved, the next
> question is why it warns for sym in resolve_deallocate_expr.
>
> Tobias
I think the reason here is simple the used gcc version.
Regards,
Kai
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.