Hi Bob,

> 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?
Using the 4.3a, you get the following:

File "foo.scm", line 6, character 166:
#(new-vector :BAD)
#            ^
*** WARNING:bigloo:toplevel-init
Type error --  "int" expected, "keyword" provided

and when running the program:

new-vector expects an integer size, but got keyword :BAD

This looks like the expected behavior.

-- 
Manuel

Reply via email to