This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for various warnings in gcc
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: dave dot anglin at nrc dot ca, matz at suse dot de
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 8 Aug 2002 11:43:07 -0400 (EDT)
- Subject: Re: Patch for various warnings in gcc
- References: <Pine.LNX.4.33.0208081658390.6693-100000@wotan.suse.de>
> From: Michael Matz <matz@suse.de>
>
> > > Wasn't there a gcc extension ala "int a = a;" to silence it?
> >
> > I've never heard about that extension. What does it do and mean?
>
> IIRC this "self-initialization" is implementation-defined, and gcc
> defines it such, that no code for this is emitted, but the variable
> is taken as initialized, even if gcc can't proove this in other
> ways. I.e. basically it silences the warning, in case the
> programmer knows that it's wrong, but without any overhead in terms
> of produced code.
Hmm, I have two concerns with this. First if we're forcibly silencing
the warning this way without initializing the variable, we'll get
non-deterministic behavior if an actual uninitialized reference is
later introduced. At least with a zero init, any such reference will
always get a SEGV.
Second, I'm not sure what happens with vendor compilers used in
stage1. I don't care about their warnings, but are we confident that
this mechanism doesn't break any of them? What about traditional C?
Dave - can you please test this snippet on hpux traditional C and
verify it doesn't break?
int main()
{
int a = a;
return a;
}
Thanks,
--Kaveh
--
Kaveh R. Ghazi Director of Systems Architecture
ghazi@caip.rutgers.edu Qwest Solutions