Mail Archives: djgpp/1996/03/22/04:13:30
I have a big Gnu C++ program (an Emacs-type text editor) in several files,
which I compile with `gcc <filename> -c -g -Wall', getting no fault remarks or
cautions or warnings. But recently I compiled it with `gcc <filename> -c -g
-O3', and got a mass of warnings of this type:-
main.cc:33: warning: variable `class buffer * C' might be clobbered by
`longjmp' or `vfork'
main.cc:33: warning: variable `char * T' might be clobbered by
`longjmp' or `vfork'
A text search through the FAQ found no mention of `longjmp' or `clobber'. A
text search with norton\ts.exe through djgpp\docs\ and all its subdirs for the
string `clobber' found many uses of `clobber' re assembler programming to mean
when a register is unintendedly overwritten, but absolute zero about variables
being `clobbered'. When and how does longjmp clobber a variable?
(I realize that `vfork' above only applies on UNIX, not on PC's.)
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> replied to the above:-
> If you don't tell gcc to optimize ... it doesn't ... check for certain
> potential problems, [e.g.] ... unused variables ... I'd imagine that if you
> use longjmp in certain circumstances, some of the destructors for variables
> that are on the parts of the stack which longjmp unwinds aren't called.
But please, what exactly is the minimum requirement construction for a
variable to be clobbered by longjmp? (The `char * T' that caused a fault above
is neither a destructorable mode nor a pointer to one.) Does it mean that
djgpp thinks there is a risk of me longjmp'ing back and/or forwards past where
the variable in question is given a value? Or what?
> That's why the exceptions were introduced into C++, right?
What `exceptions' are these?
- Raw text -