Re: new warnings in 4.5a: bint expected, bignum provided
[email protected] Thu, 3 Nov 2022 11:50:04 +0100
| Newsgroups | gmane.lisp.scheme.bigloo |
|---|---|
| Message-ID | <[email protected]> |
--=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Sven, > Hi. >=20 > I am seeing new (spurious?) warnings for the current unstable version (x8= 6_64 and x32-ABI): >=20 > "bint" expected, "bignum" provided >=20 > A minimal example: >=20 > bugz11.scm: > --- > (module bugz11 > (export > (list-ref-check::obj l pos::bint)) > (main main)) >=20 > (define (list-ref-check l pos) > (let iter () > (if (pair? l) > (cond ((=3D pos 0) > (car l)) > (else > (set! l (cdr l)) > (set! pos (- pos 1)) > (iter))) > #f))) >=20 > (define (main args) > (let ((val (list-ref-check args 1))) > (display val) > (newline) > 0)) > --- >=20 > > bigloo -O3 -ldopt "-static" -o bugz11 bugz11.scm >=20 > File "bugz11.scm", line 14, character 370: > # (set! pos (- pos 1)) > # ^ > *** WARNING: iter > Type error -- "bint" expected, "bignum" provided Actually, I think this new behavior is correct. The previous Bigloo versions were simply not able to detect that potential error. Let me explain. The "(- pos 1)" expression may overflow and then produce a bignum value. This is incompatible the "bint" type assigned to pos. I think that to get rid of the warning, you should use the "-fx" operator that will not produce a bignum value. Does this make sense to you? Do you agree that this new behavior is the one we should expect? =2D-=20 Manuel --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEELgdDMTtUx/Mxl41xMMxQ5DtOwukFAmNjnbMACgkQMMxQ5DtO wum2JAgAt+LnKn0SrT5govQSG1pgebZWD7y7VXPK2yJLVPnMYS4j6eKV9ATbZ13h th6Kr1t4lGHOV+/zNQiM9RxK6ALRHkkBndZ2F2CtFnZN//b2Gb/KDV32TEnBo6B7 J7gx31MGYVUGh22eIos27xwMIBnWdTrhWO/RDiIgO7k7gvZGcNNcEJ231ss5HSBq tZc8cu1dG8CiyZt4A2QdRUegq+LuYf8MdcBl8sH/ss2/i4H52hQmdd/xqESE7dco ks1Xkde0hl0unsxmNwHl0gG0hByA8VDdk+YFIqzIsTPCG/SsGRQ9N9kNVshnnA2g CzusM1Oln9+3D4AG5K0FK7+TrMbnOQ== =3w+r -----END PGP SIGNATURE----- --=-=-=--