-O3 and type inference

"bob eob" <[email protected]>
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <trinity-c5b7d6d3-7ad4-4de7-a18e-0c9421e46c20-1472397911297@3capp-mailcom-bs04>
Hello,

I wrote this program

(module test)

(define (new-vector s)

(if (number? s) (make-vector s) (print "new-vector expects an integer size, but got keyword " s)))

(new-vector 5)

(new-vector :BAD)

It compiles and works fine with -O2, but with -O3 I get this error when compiling (bigloo 4.2b):

File "test.scm", line 7, character 171:

#(new-vector :BAD)

# ^

*** ERROR:toplevel-init

Type error -- "int" expected, "keyword" provided

It seems to be enforcing the parameter type of make-vector on new-vector, as though (number? s) was always true.

I'd like to use -Obench. Is there a way to avoid this error and/or a different way of writing this code that still allows the particular optimization -O3 is performing here?

Thanks,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.