It looks like it's the scope narrowing stage, if I compile with -O3 -narrow to stop after that stage I get an error, but -O3 -initflow compiles OK.
Sent: Sunday, August 28, 2016 at 4:25 PM
From: "bob eob" <[email protected]>
To: [email protected]
Subject: [bigloo] -O3 and type inference
From: "bob eob" <[email protected]>
To: [email protected]
Subject: [bigloo] -O3 and type inference
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)))
(if (number? s) (make-vector s) (print "new-vector expects an integer size, but got keyword " s)))
(new-vector 5)
(new-vector :BAD)
(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
#(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,
