Is this something that will be fixed at some point, or do I need to come up with a workaround for my demo?<div><br></div><div>Neil<br><br><div class="gmail_quote">On Sun, Aug 29, 2010 at 12:37 PM, Gary Byers <span dir="ltr"><<a href="mailto:gb@clozure.com">gb@clozure.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I was just looking at it; the bug seems to be in the implemetation of ATAN<br>
(in some cases when both args are provided and float zeroes.)<br>
<br>
? (atan 0.0d0 0.0d0)<br>
0.0D0                   ; looks right, but:<br>
? *<br>
#<BOGUS object @ #xB029BE6D><br>
?<br>
<br>
The returned value is stack-allocated.  It's of course wrong to return stack-allocated things past the limit of their extent, but that's only<br>
easily detectable if the stack-allocated thing hasn't been overwritten.<br>
(In the case above, something - perhaps READ, reading the * - has overwritten<br>
the stack-allocated DOUBLE-FLOAT so that it doesn't look like a valid<br>
object at all; until that happens, it looks like a perfectly valid 0.0d0.)<br>
<br>
(ATAN 0.0s0 0.0s0) has the same bug (as well as this one) on 32-bit<br>
platforms.  I'm not sure what else does, and could easily believe that<br>
the test suite that we use tests these cases and just sees what looks<br>
like a valid result.<br>
<br>
I'm not sure what else may share this bug.<div><div></div><div class="h5"><br>
<br>
On Sun, 29 Aug 2010, Neil Baylis wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In the following function, I think I'm seeing some kind of stack/frame corruption.<br>
This happens with dx86cl64 when running my ca-multilayer demo (posted earlier today).<br>
<br>
(defun place-layer (layer center theta radius)<br>
  (format t "~A~%" (* radius (cos theta)))<br>
  (#/removeAllAnimations layer)     ;Causes corruption here<br>
  (let* ((cx (+ (ns:ns-point-x center) (* radius (cos theta))))<br>
         (cy (+ (ns:ns-point-y center) (* radius (sin theta))))<br>
         (gp (make-record :<CGP>oint x (cgfl cx) y (cgfl cy))))   <br>
;    (#/removeAllAnimations layer)    ;Does not cause corruption here<br>
    (#/setPosition: layer gp)<br>
    (set-layer-angle layer (cgfl (+ theta (radians 45) (radians (/ radius 1.25)))))<br>
    (free gp)))<br>
<br>
The failure scenario is when both theta and radius take the values 0.0D0. I get the following:<br>
<br>
CL-USER> 0.0D0<br>
> Error: value #<BOGUS object @ #x7FFF5FBFEA1D> is not of the expected type REAL.<br>
> While executing: (:INTERNAL |-[CADemoView mouseDown:]|), in process Initial(0).<br>
<br>
<br>
;;;<br>
;;; #<APPKIT-PROCESS Initial(0) [Active] #x3020000B528D> requires access to Shared Terminal Input<br>
;;; Type (:y 0) to yield control to this thread.<br>
;;;<br>
(:y 0)<br>
<br>
<br>
;;;<br>
;;; Shared Terminal Input is now owned by #<APPKIT-PROCESS Initial(0) [Active] #x3020000B528D><br>
;;;<br>
<br>
> Type :POP to abort, :R for a list of available restarts.<br>
> Type :? for other options.<br>
CL-USER> (b)<br>
 (44B9F8) : 0 (FUNCALL #'#<(:INTERNAL |-[CADemoView mouseDown:]|)> #<TYPE-ERROR #x30200213F99D>) 141<br>
 (44BA20) : 1 (SIGNAL #<TYPE-ERROR #x30200213F99D>) 973<br>
 (44BA78) : 2 (%ERROR #<TYPE-ERROR #x30200213F99D> NIL 563047) 117<br>
 (44BAA0) : 3 (FUNCALL #'#<CCL::DEFAULT-REQUIRE-TYPE-RESTARTS> 563047 #<BOGUS object @ #x7FFF5FBFEA1D> REAL) 1069<br>
 (44BB38) : 4 (%SHORT-FLOAT #<BOGUS object @ #x7FFF5FBFEA1D>) 237<br>
 (44BB60) : 5 (COS #<BOGUS object @ #x7FFF5FBFEA1D>) 413<br>
 (44BB78) : 6 (PLACE-LAYER #<CA-LAYER <CALayer: 0x1e1b80> (#x1E1B80)> #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D><br>
#<BOGUS object @ #x7FFF5FBFEA1D> 0.0D0) 549<br>
 (44BBC0) : 7 (LAYOUT-RADIAL (#<CA-LAYER <CALayer: 0x1e1b80> (#x1E1B80)>) #<NS-POINT 400,400 [gcable] (#x5A3C10)<br>
#x30200213FD0D> #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D>) 565<br>
 (44BC30) : 8 (FUNCALL #'#<|-[CADemoView mouseDown:]|> 17591849975144) 1461<br>
 (44BCC0) : 9 (%PASCAL-FUNCTIONS% 307 17591849975144) 365<br>
 (44BD78) : 10 (FUNCALL #'#<Anonymous Function #x302000C82F9F> #<A Foreign Pointer [stack-allocated] (:* #) #x7FFF5FBFF0F0><br>
#<A Foreign Pointer #x7FFF81A78B60> #<NS-EVENT NSEvent: type=LMouseDown loc=(497,195) time=176165.2 flags=0x100 win=0x0<br>
winNum=1633 ctxt=0x0 evNum=5627 click=1 buttonNumber=0 pressure=1 (#x5A3920)>) 373<br>
 (44BDA8) : 11 (%CALL-NEXT-OBJC-METHOD #<LISP-APPLICATION <LispApplication: 0x567ae0> (#x567AE0)> #<OBJC:OBJC-CLASS<br>
GUI::LISP-APPLICATION (#x55C2D0)> #<A Foreign Pointer #x7FFF81A78B60> (:VOID :ID) #<NS-EVENT NSEvent: type=LMouseDown<br>
loc=(497,195) time=176165.2 flags=0x100 win=0x0 winNum=1633 ctxt=0x0 evNum=5627 click=1 buttonNumber=0 pressure=1 (#x5A3920)>)<br>
773<br>
 (44BE08) : 12 (FUNCALL #'#<GUI::|-[LispApplication sendEvent:]|> 17591849975368) 965<br>
 (44BE78) : 13 (%PASCAL-FUNCTIONS% 15 17591849975368) 365<br>
 (44BF30) : 14 (FUNCALL #'#<Anonymous Function #x302000B9EAFF> #<LISP-APPLICATION <LispApplication: 0x567ae0> (#x567AE0)><br>
#S(CCL::OBJC-SELECTOR :NAME "run" :%SEL #<A Foreign Pointer #x7FFF81A78B3C>)) 173<br>
 (44BF50) : 15 (FUNCALL #'#<(:OBJC-DISPATCH NEXTSTEP-FUNCTIONS:|run|)> ???) 565<br>
 (44BF88) : 16 (EVENT-LOOP NIL) 421<br>
CL-USER> (:f 6)<br>
 (44BB78) : 6 (PLACE-LAYER #<CA-LAYER <CALayer: 0x1e1b80> (#x1E1B80)> #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D><br>
#<BOGUS object @ #x7FFF5FBFEA1D> 0.0D0) 549<br>
  (LAYER CENTER THETA RADIUS)<br>
   LAYER: #<CA-LAYER <CALayer: 0x1e1b80> (#x1E1B80)><br>
   CENTER: #<NS-POINT 400,400 [gcable] (#x5A3C10) #x30200213FD0D><br>
   THETA: #<BOGUS object @ #x7FFF5FBFEA1D><br>
   RADIUS: 0.0D0<br>
<br>
Note that it successfully prints the value of (* radius (cos theta)) before it errors out while computing cx in the let* form.<br>
<br>
If I move the call to #/removeAllAnimations to inside the let* form, I do not see the error. (See commented out statement).<br>
<br>
When it hits this error, it also corrupts some local variables in the frame of the calling function.<br>
<br>
Neil<br>
<br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.pixpopuli.com">http://www.pixpopuli.com</a><br>
</div>