This is the mail archive of the gcc-bugs@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]

problems with "clobbered" warnings



  I am attempting to get some code to compile with -Wall -Werror. I have just
introduced a setjmp() to catch errors...

  I get warnings like:

paxas.c:211: warning: variable `infilename' might be clobbered by `longjmp' or `vfork'
paxas.c:212: warning: variable `outfilename' might be clobbered by `longjmp' or `vfork'
paxas.c:213: warning: variable `inFile' might be clobbered by `longjmp' or `vfork'
paxas.c:213: warning: variable `outFile' might be clobbered by `longjmp' or `vfork'
paxas.c:214: warning: variable `fc' might be clobbered by `longjmp' or `vfork'
paxas.c:217: warning: variable `verbose' might be clobbered by `longjmp' or `vfork'
paxas.c:218: warning: variable `op' might be clobbered by `longjmp' or `vfork'

  I know that I can "fix" this by making these variables "volatile",
but I then get things like:

paxas.c:277: warning: passing arg 1 of `fopen' discards qualifiers from pointer target type

  which I can only fix, as far I know, by casting everything to the type
without the volatile. (Or is there a "novolatile"? "auto" maybe?) 
  I have read http://gcc.gnu.org/onlinedocs/gcc_2.html#SEC9 on -Wuninitialized, 
and I don't wish to turn that off.   
 
  My setjmp() != 0 code prints some diagnostics, closes some files, and
exits. I have attempted to declare exit() as noreturn, but that didn't help.

  Is there someone who can offer a better description of when a variable may
be considered to be clobbered, or a workaround that permits me to shut up
just that test without giving up on the uninitialized warning?

  This is with gcc 2.91.66 on GNU/Linux/Redhat 6.2, but also occurs on
other targets that we build for (NetBSD, Solaris, MINGW32).

   :!mcr!:            |  Solidum Systems Corporation, http://www.solidum.com
   Michael Richardson |For a better connected world,where data flows faster<tm>
 Personal: http://www.sandelman.ottawa.on.ca/People/Michael_Richardson/Bio.html
	mailto:mcr@sandelman.ottawa.on.ca	mailto:mcr@solidum.com



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