From cmucl-devel at common-lisp.net Thu Dec 13 02:38:37 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Thu, 13 Dec 2012 02:38:37 -0000 Subject: [cmucl-ticket] [cmucl] #64: Type derivation/compiler bug Message-ID: <052.5353183aae52e6689b0138054aadfce1@common-lisp.net> #64: Type derivation/compiler bug --------------------+------------------------------------------------------- Reporter: rtoy | Owner: somebody Type: defect | Status: new Priority: major | Milestone: Component: Core | Version: 2012-12 Keywords: | --------------------+------------------------------------------------------- Compiling the following function causes a compiler bug: {{{ (defun bug (n input output desired gain smooth) (declare (type (complex double-float) desired gain) (type double-float smooth) (type (simple-array single-float (*)) input) (type (simple-array (complex single-float) (*)) output) (fixnum n) (optimize (speed 3) (safety 0))) (dotimes (k n) (declare (fixnum k)) (setf gain (+ gain (* (- desired gain) smooth))) (let ((p (* gain (aref input k)))) (setf (aref output k) p))) (+ 0 gain)) }}} The message is caused by {{{(* gain (aref input k))}}}: {{{ ; (* GAIN (AREF INPUT K)) ; ==> ; (* C::X (COERCE C::Y 'DOUBLE-FLOAT)) ; Warning: Result is a (COMPLEX ; DOUBLE-FLOAT), not a (VALUES &OPTIONAL (COMPLEX SINGLE-FLOAT) &REST T). ; ; Note: Forced to do GENERIC-* (cost 30). ; Unable to do inline complex float arithmetic (cost 4) because: ; This shouldn't happen! Bug? ; Result types invalid. ; }}} -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Thu Dec 13 02:44:40 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Thu, 13 Dec 2012 02:44:40 -0000 Subject: [cmucl-ticket] [cmucl] #65: Different results for {{{expt}}} between compiled and interpreted code Message-ID: <052.d58047a7b87f93144a77ee5dcdc9f6af@common-lisp.net> #65: Different results for {{{expt}}} between compiled and interpreted code --------------------+------------------------------------------------------- Reporter: rtoy | Owner: somebody Type: defect | Status: new Priority: major | Milestone: Component: Core | Version: 2012-12 Keywords: | --------------------+------------------------------------------------------- Consider {{{ (defun sqr (x) (declare (type (complex double-float) x)) (expt x 2)) }}} Compare the results: {{{ * (sqr #c(0d0 1d0)) #C(-1d0 0d0) * (expt #c(0d0 1d0)) #C(-1.0d0 1.2246467991473532d-16) }}} The difference is caused by a deftransform for {{{expt}}} that converts {{{(expt x 2)}}} to {{{(* x x)}}}. Perhaps the {{{expt}}} should be modified to do the same transformation when the power is one of the special values in the deftransform? (The deftransform handles 2, 3, 4, and 1/2.) -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Wed Dec 19 13:52:24 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Wed, 19 Dec 2012 13:52:24 -0000 Subject: [cmucl-ticket] [cmucl] #66: replace on simple-strings Message-ID: <054.5837262d2c5015b11c4fe7e1db766873@common-lisp.net> #66: replace on simple-strings --------------------+------------------------------------------------------- Reporter: heller | Owner: somebody Type: defect | Status: new Priority: minor | Milestone: Component: Core | Version: 2012-12 Keywords: | --------------------+------------------------------------------------------- This code {{{ (deftype index () `(integer 0 #.array-total-size-limit)) (defun %move-string (from start end to index) (declare (type simple-string from to) (type index start end index)) (replace to from :start1 index :start2 start :end2 end)) (let ((x (make-string 35893164))) (%move-string x 4 4 x 35893164) nil) }}} when executed with `(load (compile-file "test.lisp"))` produces this error: {{{ Type-error in kernel::object-not-type-error-handler: -499451136 is not of type (mod 536870911) [Condition of type type-error] }}} I don't see the bug in my code, so it seems to be a bug in CMUCL. lisp-implementation-version returns "snapshot-2012-12 (20D Unicode)" -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Fri Dec 21 04:37:30 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Fri, 21 Dec 2012 04:37:30 -0000 Subject: [cmucl-ticket] [cmucl] #66: replace on simple-strings In-Reply-To: <054.5837262d2c5015b11c4fe7e1db766873@common-lisp.net> References: <054.5837262d2c5015b11c4fe7e1db766873@common-lisp.net> Message-ID: <063.3e8a2142a008e564a4c6bf62ef766443@common-lisp.net> #66: replace on simple-strings --------------------+------------------------------------------------------- Reporter: heller | Owner: somebody Type: defect | Status: new Priority: minor | Milestone: Component: Core | Version: 2012-12 Keywords: | --------------------+------------------------------------------------------- Comment(by rtoy): It's a bug in the {{{DEFTRANSFORM}}} for {{{REPLACE}}}. It uses {{{BIT- BASH-COPY}}} to copy things around and {{{BIT-BASH-COPY}}} uses bit indices. Characters are 16 bits (for unicode builds) so the size (35893164) times 16 overflows a fixnum. Thanks for the report. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Sat Dec 22 16:29:22 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Sat, 22 Dec 2012 16:29:22 -0000 Subject: [cmucl-ticket] [cmucl] #60: compile-file and export problem In-Reply-To: <052.ed121e8260d900212c229165360a5c7f@common-lisp.net> References: <052.ed121e8260d900212c229165360a5c7f@common-lisp.net> Message-ID: <061.1858ce54b7c4d8696b204d43755a6c52@common-lisp.net> #60: compile-file and export problem ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: somebody Type: defect | Status: closed Priority: major | Milestone: Component: Core | Version: 2012-05 Resolution: fixed | Keywords: ---------------------+------------------------------------------------------ Comment(by toy.raymond@?): commit cdf11377fbdb369d3a3810dd9bd01a8a73007255 Author: Raymond Toy Date: Sat Dec 22 08:29:09 2012 -0800 Fix ticket:60. This fixes the immediate issue, but there are still problems with very long strings. The bit-index for such strings won't fit in an (unsigned-byte 32). vm-fndb.lisp: o Correct the defknown to have the correct arg types (vm::offset instead of index). vm-tran.lisp: o Update deftransform to use vm::offset instead of index. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Sat Dec 22 16:33:42 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Sat, 22 Dec 2012 16:33:42 -0000 Subject: [cmucl-ticket] [cmucl] #66: replace on simple-strings In-Reply-To: <054.5837262d2c5015b11c4fe7e1db766873@common-lisp.net> References: <054.5837262d2c5015b11c4fe7e1db766873@common-lisp.net> Message-ID: <063.84494af38619329e0fd103d01ebfb84b@common-lisp.net> #66: replace on simple-strings ---------------------+------------------------------------------------------ Reporter: heller | Owner: somebody Type: defect | Status: closed Priority: minor | Milestone: Component: Core | Version: 2012-12 Resolution: fixed | Keywords: ---------------------+------------------------------------------------------ Changes (by rtoy): * status: new => closed * resolution: => fixed Comment: Oops. This was fixed in commit cdf11377fbdb369d3a3810dd9bd01a8a73007255 There are still issues with very long strings; this needs to be solved in a different way. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Sat Dec 22 16:39:29 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Sat, 22 Dec 2012 16:39:29 -0000 Subject: [cmucl-ticket] [cmucl] #67: deftransform for replace is unsafe Message-ID: <052.7a7a3a51b368698e3e1709eb869222dd@common-lisp.net> #67: deftransform for replace is unsafe --------------------+------------------------------------------------------- Reporter: rtoy | Owner: somebody Type: defect | Status: new Priority: major | Milestone: Component: Core | Version: 2012-12 Keywords: | --------------------+------------------------------------------------------- Consider this function {{{ (defun bad (s) (declare (simple-string s)) (replace s s :start2 100 :end2 105)) }}} After compiling this, {{{ (bad (copy-seq "1234567890")) }}} Produces a totally bogus result, filling in the first 4 characters of the resulting string with garbage. The problem is that the deftransform for replace just calls {{{BIT-BASH- COPY}}} without verifying that the start and end indices make sense for the given string. Note that it also doesn't check to see that end >= start, but this gets handled by {{{BIT-BASH-COPY}}} which gets a negative length and signals an error. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Sat Dec 22 16:43:18 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Sat, 22 Dec 2012 16:43:18 -0000 Subject: [cmucl-ticket] [cmucl] #68: bit-bash-copy can't handle very large objects Message-ID: <052.bdd951aadb9d5ac769617da058f046c5@common-lisp.net> #68: bit-bash-copy can't handle very large objects --------------------+------------------------------------------------------- Reporter: rtoy | Owner: somebody Type: defect | Status: new Priority: major | Milestone: Component: Core | Version: 2012-12 Keywords: | --------------------+------------------------------------------------------- {{{BIT-BASH-COPY}}} takes bit indices as offsets for copying random objects. This is very useful if we're copying bit-arrays or arrays with elements smaller than a byte. However, when copying strings or arrays with elements larger than a byte, the bit index exceeds 32 bits when the index is near {{{MOST-POSITIVE-FIXNUM}}}. {{{BIT-BASH-COPY}}} needs to be updated to handle this, or a {{{BYTE-BASH- COPY}}} should be added to handle the case where the element size is at least a byte in size. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Sat Dec 22 20:47:01 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Sat, 22 Dec 2012 20:47:01 -0000 Subject: [cmucl-ticket] [cmucl] #67: deftransform for replace is unsafe In-Reply-To: <052.7a7a3a51b368698e3e1709eb869222dd@common-lisp.net> References: <052.7a7a3a51b368698e3e1709eb869222dd@common-lisp.net> Message-ID: <061.6ba867001c42f1b80eefffd2fd48967b@common-lisp.net> #67: deftransform for replace is unsafe ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: somebody Type: defect | Status: closed Priority: major | Milestone: Component: Core | Version: 2012-12 Resolution: fixed | Keywords: ---------------------+------------------------------------------------------ Changes (by toy.raymond@?): * status: new => closed * resolution: => fixed Comment: commit 3be4fc215fa2a4d23dc145e6cfa9519492525bc1 Author: Raymond Toy Date: Sat Dec 22 12:46:45 2012 -0800 Fix ticket:67 Check that the start and end indices make sense for the given strings. This is important before we start bashing random parts of the string, potentially overwriting other objects. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Sun Dec 23 18:39:22 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Sun, 23 Dec 2012 18:39:22 -0000 Subject: [cmucl-ticket] [cmucl] #68: bit-bash-copy can't handle very large objects In-Reply-To: <052.bdd951aadb9d5ac769617da058f046c5@common-lisp.net> References: <052.bdd951aadb9d5ac769617da058f046c5@common-lisp.net> Message-ID: <061.764ccb32df876f989c690d37515af46c@common-lisp.net> #68: bit-bash-copy can't handle very large objects ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: somebody Type: defect | Status: closed Priority: major | Milestone: Component: Core | Version: 2012-12 Resolution: fixed | Keywords: ---------------------+------------------------------------------------------ Changes (by toy.raymond@?): * status: new => closed * resolution: => fixed Comment: commit abc43728326721c0862a483035ad328400eca845 Author: Raymond Toy Date: Sun Dec 23 10:38:36 2012 -0800 Fix ticket:68 by adding {{{BYTE-BASH-COPY}}} code/bit-bash.lisp:: Add {{{BYTE-BASH-COPY}}} for copying bytes code/exports.lisp:: Add {{{BYTE-BASH-COPY}}} compiler/generic/vm-fndb.lisp:: Add {{{BYTE-BASH-COPY}}} compiler/generic/vm-tran.lisp:: Call {{{BYTE-BASH-COPY}}} in the deftransform for {{{REPLACE}}}. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation.