From: "Anthony.Appleyard" Organization: Materials Science Centre To: Eli Zaretskii , DJGPP AT delorie DOT com Date: Mon, 16 Mar 1998 11:50:55 GMT Subject: Re: Clobbered Reply-to: Anthony DOT Appleyard AT umist DOT ac DOT uk CC: DJGPP AT delorie DOT com Message-ID: <4AEC033B86@fs2.mt.umist.ac.uk> Precedence: bulk On Fri, 13 Mar 1998, Anthony.Appleyard wrote: > What the rules for deciding whether longjmp may `clobber' a particular local > variable or a `*this'? (I never use vfork().) Eli Zaretski replied:- > * A nonvolatile automatic variable might be changed by a call to `longjmp'. > These warnings as well are possible only in optimizing compilation. ... The > easiest solution is to declare the variable `volatile' (and have some > sub-optimal optimization). ... In the affected program, one of the many `clobbered' complaints comes from main():- main(int nargs,char**Arg){Subr*S; char*s,*t,*U,**arg; jmp_buf emacserror; int i,j,k,m,n,w,F; int ctrlc_old=__djgpp_set_ctrl_c(0); ... main.cc:49: warning: variable `volatile char * T' might be clobbered by `longjmp' or `vfork' so I changed these two lines to this:- main(int nargs,char**Arg){Subr*S; char*s,*U,**arg; jmp_buf emacserror; int i,j,k,m,n,w,F; int ctrlc_old=__djgpp_set_ctrl_c(0); volatile char*T; but this did not get rid of the warning but merely created two more warnings:- main.cc: In function `int main(int, char **)': main.cc:268: warning: passing `volatile char *' as argument 1 of `strlen(const char *)' discards volatile main.cc:273: warning: passing `volatile char *' as argument 2 of `strcpy(char *, const char *)' discards volatile main.cc:49: warning: variable `volatile char * T' might be clobbered by `longjmp' or `vfork'