samth / test-bugs

2 stars 0 forks source link

read (compiled): ill-formed code (optimization error?) #141

Closed racket-bug-submit closed 12 years ago

racket-bug-submit commented 12 years ago
Originally submitted by Neil Toronto neil.toronto@gmail.com on: Wed Oct 05 13:20:01 -0400 2011

Apparently, some flonum code that uses Newton's method to invert a function exposes an optimization error when used in a different module.

I'll try to find a smaller test case the causes the same problem.
Steps to Reproduce:
Here's a standalone program that exposes the problem:

#lang racket
(require plot)

(parameterize ([plot-x-transform  (hand-drawn-transform 200)]
               [plot-y-transform  (hand-drawn-transform 200)])
  (plot (function sqr -1 1)))

=> read (compiled): ill-formed code [../../../racket/gc2/../src/validate.c:806]

A more fine-grained way to discover it: open collects/plot/common/sample.rkt, run it, and enter

(nonlinear-seq -1 1 500 (hand-drawn-transform 200))

=> read (compiled): ill-formed code [../../../racket/gc2/../src/validate.c:806]

Also try the should-be equivalent

(map (invertible-function-finv ((hand-drawn-transform 200) -1 1))
     (linear-seq -1 1 500))

=> internal error: flonum position not found

Now open collects/plot/common/axis-transform.rkt, and try the previous:

(map (invertible-function-finv ((hand-drawn-transform 200) -1 1))
     (linear-seq -1 1 500))

It returns a list of reals between -1 and 1, as it should.

All the code to reproduce the problem should be in axis-transform.rkt: flnewton-invert, sine-diag, sine-diag-diff, sine-diag-inv, make-axis-transform, and the invertible-function struct. (But of course it doesn't reproduce the problem.)

Release:
5.1.3.11--2011-10-05(560dfd5/g)
Environment:
unix "Linux schroder 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:17:25 UTC 2011 x86_64
 x86_64 x86_64 GNU/Linux" (x86_64-linux/3m) (get-display-depth) = 32
Human Language: english
(current-memory-use) 848518608
Links: (links) = (); (links #:user? #f) = (); (links #:root? #t) = (); (links #:user? #f
 #:root? #t) = ()

Collections:
("/home/neil/.racket/5.1.3.11/collects"
 (non-existent-path))
("/home/neil/plt/collects"
 ("wxme" "texpict" "compiler" "typed" "games" "algol60" "browser" "file" "readline"
 "dynext" "scribblings" "mzcom" "trace" "profile" "data" "sirmail" "parser-tools"
 "tex2page" "scriblib" "swindle" "schemeunit" "r6rs" "xrepl" "mzlib" "handin-client"
 "repo-time-stamp" "mysterx" "mrlib" "scheme" "combinator-parser" "html" "test-engine"
 "version" ".gitignore" "make" "ffi" "mzscheme" "picturing-programs" "hierlist"
 "teachpack" "at-exp" "lazy" "scribble" "openssl" "defaults" "racket" "handin-server"
 "2htdp" "drscheme" "help" "eopl" "racklog" "drracket" "icons" "db" "errortrace"
 "preprocessor" "rackunit" "rnrs" "string-constants" "meta" "slatex" "graphics" "redex"
 "reader" "plai" "honu" "config" "stepper" "frtime" "unstable" "r5rs" "planet" "tests"
 "s-exp" "embedded-gui" "info-domain" "guibuilder" "syntax" "launcher" "typed-scheme"
 "syntax-color" "srfi" "test-box-recovery" "xml" "plot" "datalog" "sgl" "htdp" "setup"
 "lang" "raco" "gui-debugger" "framework" "web-server" "deinprogram!
 m" "slideshow" "macro-debugger" "typed-racket" "net" "mred"))

Computer Language: (("Determine language from source") (#(#t print mixed-fraction-e #f #t
 debug) (default) #("-n" "--keep-titlebar") "#lang racket\n" #t #t))
This bug was converted from Gnats bug 12259.

[anon-submit neil.toronto AT gmail.com]

racket-bug-submit commented 12 years ago
On Wed, 05 Oct 2011 21:26:06 -0400, mflatt@racket-lang.org assigned this bug to mflatt

A commit by mflatt@racket-lang.org has resolved this report http://git.racket-lang.org/plt/commit/7680adf486

racket-bug-submit commented 12 years ago
On Wed, 05 Oct 2011 21:26:06 -0400, mflatt@racket-lang.org wrote:

A commit by mflatt@racket-lang.org has resolved this report http://git.racket-lang.org/plt/commit/7680adf486