diff --git a/release_notes/release_notes.stex b/release_notes/release_notes.stex index 698c64b96..787e428ba 100644 --- a/release_notes/release_notes.stex +++ b/release_notes/release_notes.stex @@ -3012,6 +3012,9 @@ When \scheme{>} and \scheme{>=} are applied to two non-real arguments, the first is now reported as incorrect instead of the second. In general, when two or more arguments are invalid, there is no guarantee about which one is reported invalid. +A bug in the error produced by \scheme{bytevector-ieee-double-native-set!}---when the last +argument raises and error and the offset is out of bounds---has been fixed. + \subsection{Fix \scheme{remainder} and \scheme{modulo} for inexact/exact mixtures (10.4.0)} When \scheme{remainder} and \scheme{modulo} receive an inexact first diff --git a/s/cpprim.ss b/s/cpprim.ss index d1a77c730..ba6233068 100644 --- a/s/cpprim.ss +++ b/s/cpprim.ss @@ -368,7 +368,12 @@ (let-values ([(type e) (nanopass-case (L7 Expr) e [(raw ,e) (values 'uptr e)] - [else (values type e)])]) + [else (cond + [(eq? type 'try-fp) + (if (known-flonum-result? e) + (values 'fp e) + (values 'uptr e))] + [else (values type e)])])]) (let ([t (make-tmp 't type)]) (values t (lift-fp-unboxed (lambda (body) @@ -7211,11 +7216,11 @@ (define-inline 2 bytevector-ieee-double-native-set! [(e-bv e-offset e-val) (bind #t (e-bv e-offset) - (let ([info (make-info-call #f #f #f #f #f)]) - `(if (call ,info ,#f ,(lookup-primref 3 '$bytevector-set!-check?) (quote 64) ,e-bv ,e-offset) - ;; checks to make sure e-val produces a real number: - (call ,info ,#f ,(lookup-primref 3 'bytevector-ieee-double-native-set!) ,e-bv ,e-offset ,e-val) - ,(build-libcall #t src sexpr bytevector-ieee-double-native-set! e-bv e-offset))))])) + (bind #f try-fp (e-val) + (let ([info (make-info-call #f #f #f #f #f)]) + `(if (call ,info ,#f ,(lookup-primref 3 '$bytevector-set!-check?) (quote 64) ,e-bv ,e-offset) + (call ,info ,#f ,(lookup-primref 3 'bytevector-ieee-double-native-set!) ,e-bv ,e-offset ,e-val) + ,(build-libcall #t src sexpr bytevector-ieee-double-native-set! e-bv e-offset)))))])) (let () (define-syntax define-bv-int-ref-inline