This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR35609, spurious "is" used uninitialized warning


On Wed, Mar 26, 2008 at 7:43 PM, Kaveh R. GHAZI <ghazi@caip.rutgers.edu> wrote:
> On Tue, 18 Mar 2008, Richard Guenther wrote:
>
>  > Index: testsuite/gcc.dg/uninit-16.c
>  > ===================================================================
>  > *** testsuite/gcc.dg/uninit-16.c      (revision 0)
>  > --- testsuite/gcc.dg/uninit-16.c      (revision 0)
>  > ***************
>  > *** 0 ****
>  > --- 1,22 ----
>  > + /* { dg-do compile } */
>  > + /* { dg-options "-O2 -Wuninitialized" } */
>  > +
>  > + int foo, bar;
>  > +
>  > + void decode_reloc(int reloc, int *is_alt)
>  > + {
>  > +   if (reloc >= 20)
>  > +       *is_alt = 1;
>  > +   else if (reloc >= 10)
>  > +       *is_alt = 0;
>  > + }
>  > +
>  > + void testfunc()
>  > + {
>  > +   int alt_reloc;
>  > +
>  > +   decode_reloc(foo, &alt_reloc);
>  > +
>  > +   if (alt_reloc) /* { dg-warning "maybe used uninitialized" } */
>  > +     bar = 42;
>  > + }
>
>  Hi Richard,
>
>  This testcase fails with -fpic or -fPIC on mainline and 4.3.x:
>  http://gcc.gnu.org/ml/gcc-testresults/2008-03/msg02042.html
>
>  It is fixed by either making decode_reloc static, or compiling with -fpie,
>  so that the function binds locally.  Which do you prefer?

Make it static.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]