Re: clobbered by `longjmp' warning

2010-08-09 Thread Edwin Eyan Moragas
Hi Hiroyasu,

On Tue, Aug 10, 2010 at 1:37 PM, Kamo Hiroyasu  wrote:
> Hello,
>
> From: Edwin Eyan Moragas 
> Subject: clobbered by `longjmp' warning
> Date: Tue, 10 Aug 2010 08:20:49 +0800
>> i have this warning when i compile picolisp in obsd 4.7:
>>
>> flow.c: In function `doCatch':
>> flow.c:1351: warning: argument `x' might be clobbered by `longjmp' or
`vfork'
>
> The patch
>
> - any doCatch(any x) {
> + any doCatch(volatile any x) {
>any y;
>catchFrame f;
>
>
> may works.

thank you.

i guess it is for me to find out if it is indeed ok for  the variable
to be changed between setjmp()s. :)

>
> setjmp() saves some of the registers which longjmp() will recover.  If
> some variable assigned to a register changes its value after a call of
> setjump(), its value may be recovered by a call of longjmp().  To
> prevent such an unexpected recovery, you should tell the compiler that
> the value of the variable may be modified between the call of
> setjump() and the call of the jongjmp() by using the keyword
> `volatile'.
>
> Kamo Hiroyasu [Kamo is the family name and Hiroyasu the given name.]



Re: clobbered by `longjmp' warning

2010-08-09 Thread Kamo Hiroyasu
Hello,

From: Edwin Eyan Moragas 
Subject: clobbered by `longjmp' warning
Date: Tue, 10 Aug 2010 08:20:49 +0800
> i have this warning when i compile picolisp in obsd 4.7:
> 
> flow.c: In function `doCatch':
> flow.c:1351: warning: argument `x' might be clobbered by `longjmp' or `vfork'

The patch

- any doCatch(any x) {
+ any doCatch(volatile any x) {
any y;
catchFrame f;
 

may works.

setjmp() saves some of the registers which longjmp() will recover.  If
some variable assigned to a register changes its value after a call of
setjump(), its value may be recovered by a call of longjmp().  To
prevent such an unexpected recovery, you should tell the compiler that
the value of the variable may be modified between the call of
setjump() and the call of the jongjmp() by using the keyword
`volatile'.

Kamo Hiroyasu [Kamo is the family name and Hiroyasu the given name.]



clobbered by `longjmp' warning

2010-08-09 Thread Edwin Eyan Moragas
Hi misc,

i have this warning when i compile picolisp in obsd 4.7:

flow.c: In function `doCatch':
flow.c:1351: warning: argument `x' might be clobbered by `longjmp' or `vfork'

the offending code is:

any doCatch(any x) {
   any y;
   catchFrame f;

   x = cdr(x),  f.tag = EVAL(car(x)),  f.fin = Zero;
   f.link = CatchPtr,  CatchPtr = &f;
   f.env = Env;
   y = setjmp(f.rst)? Thrown : prog(cdr(x));
   CatchPtr = f.link;
   return y;
}

any hints on how to remove the warning would be greatly appreciated.

thank you.

/e