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 for various warnings in gcc


 > 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


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