Subject: Re: bug#72913: Guile 3.0.10 fails to build for powerpc-darwin (3.0.9 built earlier)

From: Ludovic Courtès <[email-masked]>
Date: Fri, 27 Sep 2024 22:40:01 +0200

Hi,

Rob Browning <[email-masked]> skribis:

>   In language/cps/switch.scm:
>       99:36  6 (fold-branch-chains #<intmap 0-8003> _ _ #<procedure optimize-branch-chain (var exit tests cps)> _)
>       343:8  5 (optimize-branch-chain 3346 7427 (6771 6772 6773 6901 7029 7157 7285) _)
>   In ice-9/boot-9.scm:
>      260:13  4 (for-each #<procedure 429618 at language/cps/switch.scm:343:18 (expr)> _)
>   In language/cps/switch.scm:
>      340:32  3 (_ (u64-imm-< . 7428))
>   In language/cps/guile-vm.scm:
>       89:31  2 (target-symbol-hash _)
>       41:18  1 (jenkins-lookup3-hashword2 "u64-imm-<")
>   In ice-9/boot-9.scm:
>     1676:22  0 (raise-exception _ #:continuable? _)
>
>   ice-9/boot-9.scm:1676:22: In procedure raise-exception:
>   Value out of range 0 to< 18446744073709551615: -505802029
>   make[4]: *** [Makefile:2515: language/cps/guile-vm/reify-primitives.go] Error 1
>
> Investigation on an i386 host, and then a git bisect suggested that this
> might be relevant (i.e. the "bad" commit bisect landed on):
>
>   commit d579848cb5d65440af5afd9c8968628665554c22
>
>     Fix bug lowering logand/immediate to ulogand/immediate
>     
>     * module/language/cps/specialize-numbers.scm (logand/immediate): Define
>     a sigbits handler.
>     (specialize-operations): Require logand/immediate operand to be u64 to
>     lower to ulogand/immediate.  Shouldn't be necessary but even if only u64
>     bits are used, negative fixnums will have the sign bit set, which trips
>     up further unboxed uses which error if the operand to `scm->u64` is
>     negative.
>     * module/language/cps/type-fold.scm (rem): Emit logand/immediate.

I believe this was fixed by
<https://git.savannah.gnu.org/cgit/guile.git/commit/?id=aff9ac968840e9c86719fb613bd2ed3c39b9905c>
(see the neat explanation at
<https://wingolog.org/archives/2024/09/26/needed-bits-optimizations-in-guile>).

Confirmed by CI: <https://ci.guix.gnu.org/eval/1667191>.

Thanks,
Ludo’.