In the following function, I think I'm seeing some kind of stack/frame corruption.
<div><br></div><div>This happens with dx86cl64 when running my ca-multilayer demo (posted earlier today).</div><div><br></div><div><div>(defun place-layer (layer center theta radius)</div><div>  (format t "~A~%" (* radius (cos theta)))</div>
<div>  (#/removeAllAnimations layer)     ;Causes corruption here</div><div>  (let* ((cx (+ (ns:ns-point-x center) (* radius (cos theta))))</div><div>         (cy (+ (ns:ns-point-y center) (* radius (sin theta))))</div><div>
         (gp (make-record :<CGP>oint x (cgfl cx) y (cgfl cy))))   </div><div>;    (#/removeAllAnimations layer)    ;Does not cause corruption here</div><div>    (#/setPosition: layer gp)</div><div>    (set-layer-angle layer (cgfl (+ theta (radians 45) (radians (/ radius 1.25)))))</div>
<div>    (free gp)))</div></div><div><br></div><div>The failure scenario is when both theta and radius take the values 0.0D0. I get the following:</div><div><br></div><div><div>CL-USER> 0.0D0</div><div>> Error: value #<BOGUS object @ #x7FFF5FBFEA1D> is not of the expected type REAL.</div>
<div>> While executing: (:INTERNAL |-[CADemoView mouseDown:]|), in process Initial(0).</div><div><br></div><div><br></div><div>;;;</div><div>;;; #<APPKIT-PROCESS Initial(0) [Active] #x3020000B528D> requires access to Shared Terminal Input</div>
<div>;;; Type (:y 0) to yield control to this thread.</div><div>;;;</div><div>(:y 0)</div><div><br></div><div><br></div><div>;;;</div><div>;;; Shared Terminal Input is now owned by #<APPKIT-PROCESS Initial(0) [Active] #x3020000B528D></div>
<div>;;;</div><div><br></div><div>> Type :POP to abort, :R for a list of available restarts.</div><div>> Type :? for other options.</div><div>CL-USER> (b)</div><div> (44B9F8) : 0 (FUNCALL #'#<(:INTERNAL |-[CADemoView mouseDown:]|)> #<TYPE-ERROR #x30200213F99D>) 141</div>
<div> (44BA20) : 1 (SIGNAL #<TYPE-ERROR #x30200213F99D>) 973</div><div> (44BA78) : 2 (%ERROR #<TYPE-ERROR #x30200213F99D> NIL 563047) 117</div><div> (44BAA0) : 3 (FUNCALL #'#<CCL::DEFAULT-REQUIRE-TYPE-RESTARTS> 563047 #<BOGUS object @ #x7FFF5FBFEA1D> REAL) 1069</div>
<div> (44BB38) : 4 (%SHORT-FLOAT #<BOGUS object @ #x7FFF5FBFEA1D>) 237</div><div> (44BB60) : 5 (COS #<BOGUS object @ #x7FFF5FBFEA1D>) 413</div><div> (44BB78) : 6 (PLACE-LAYER #<CA-LAYER <CALayer: 0x1e1b80> (#x1E1B80)> #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D> #<BOGUS object @ #x7FFF5FBFEA1D> 0.0D0) 549</div>
<div> (44BBC0) : 7 (LAYOUT-RADIAL (#<CA-LAYER <CALayer: 0x1e1b80> (#x1E1B80)>) #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D> #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D>) 565</div>
<div> (44BC30) : 8 (FUNCALL #'#<|-[CADemoView mouseDown:]|> 17591849975144) 1461</div><div> (44BCC0) : 9 (%PASCAL-FUNCTIONS% 307 17591849975144) 365</div><div> (44BD78) : 10 (FUNCALL #'#<Anonymous Function #x302000C82F9F> #<A Foreign Pointer [stack-allocated] (:* #) #x7FFF5FBFF0F0> #<A Foreign Pointer #x7FFF81A78B60> #<NS-EVENT NSEvent: type=LMouseDown loc=(497,195) time=176165.2 flags=0x100 win=0x0 winNum=1633 ctxt=0x0 evNum=5627 click=1 buttonNumber=0 pressure=1 (#x5A3920)>) 373</div>
<div> (44BDA8) : 11 (%CALL-NEXT-OBJC-METHOD #<LISP-APPLICATION <LispApplication: 0x567ae0> (#x567AE0)> #<OBJC:OBJC-CLASS GUI::LISP-APPLICATION (#x55C2D0)> #<A Foreign Pointer #x7FFF81A78B60> (:VOID :ID) #<NS-EVENT NSEvent: type=LMouseDown loc=(497,195) time=176165.2 flags=0x100 win=0x0 winNum=1633 ctxt=0x0 evNum=5627 click=1 buttonNumber=0 pressure=1 (#x5A3920)>) 773</div>
<div> (44BE08) : 12 (FUNCALL #'#<GUI::|-[LispApplication sendEvent:]|> 17591849975368) 965</div><div> (44BE78) : 13 (%PASCAL-FUNCTIONS% 15 17591849975368) 365</div><div> (44BF30) : 14 (FUNCALL #'#<Anonymous Function #x302000B9EAFF> #<LISP-APPLICATION <LispApplication: 0x567ae0> (#x567AE0)> #S(CCL::OBJC-SELECTOR :NAME "run" :%SEL #<A Foreign Pointer #x7FFF81A78B3C>)) 173</div>
<div> (44BF50) : 15 (FUNCALL #'#<(:OBJC-DISPATCH NEXTSTEP-FUNCTIONS:|run|)> ???) 565</div><div> (44BF88) : 16 (EVENT-LOOP NIL) 421</div><div>CL-USER> (:f 6)</div><div> (44BB78) : 6 (PLACE-LAYER #<CA-LAYER <CALayer: 0x1e1b80> (#x1E1B80)> #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D> #<BOGUS object @ #x7FFF5FBFEA1D> 0.0D0) 549</div>
<div>  (LAYER CENTER THETA RADIUS)</div><div>   LAYER: #<CA-LAYER <CALayer: 0x1e1b80> (#x1E1B80)></div><div>   CENTER: #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D></div><div>   THETA: #<BOGUS object @ #x7FFF5FBFEA1D></div>
<div>   RADIUS: 0.0D0</div><div><br></div><div>Note that it successfully prints the value of (* radius (cos theta)) before it errors out while computing cx in the let* form.</div></div><div><br></div><div>If I move the call to #/removeAllAnimations to inside the let* form, I do not see the error. (See commented out statement).</div>
<div><br></div><div>When it hits this error, it also corrupts some local variables in the frame of the calling function.</div><div><br></div><div>Neil</div>