Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#1273 closed defect (fixed)

bug with inlining/bignums/type declarations

Reported by: jared Owned by:
Priority: normal Milestone:
Component: Compiler Version: trunk
Keywords: inlining, type declarations, bignum Cc:

Description

Hi,

This looks like a bug -- can you reproduce?

I am using CCL version 1.11-dev-r16355M-trunk, built just now on Linux, X86-64.

(declaim (inline part-select-width-low
                 part-select-low-high))

(defun part-select-width-low (x width low)
    (logand (1- (ash 1 width))
            (ash x (- low))))

(defun part-select-low-high (x low high)
    (part-select-width-low x (+ 1 (- high low)) low))

(defun fpreg->rawexpt (x)
  (declare (type (unsigned-byte 80) x))
  (part-select-low-high x 64 78))

(list :wrapper (fpreg->rawexpt (1- (expt 2 80)))
      :direct  (part-select-low-high (1- (expt 2 80)) 64 78))

Expected result: (:WRAPPER 32767 :DIRECT 32767)

Actual result: varies, examples shown below:

;; ? (list :wrapper (fpreg->rawexpt (1- (expt 2 80)))
;;         :direct  (part-select-low-high (1- (expt 2 80)) 64 78))
;; (:WRAPPER 13483 :DIRECT 32767)
;;
;; ? (list :wrapper (fpreg->rawexpt (1- (expt 2 80)))
;;         :direct  (part-select-low-high (1- (expt 2 80)) 64 78))
;; (:WRAPPER 12543 :DIRECT 32767)
;;
;; ? (list :wrapper (fpreg->rawexpt (1- (expt 2 80)))
;;         :direct  (part-select-low-high (1- (expt 2 80)) 64 78))
;; (:WRAPPER 11675 :DIRECT 32767)
;;
;; ? (list :wrapper (fpreg->rawexpt (1- (expt 2 80)))
;;         :direct  (part-select-low-high (1- (expt 2 80)) 64 78))
;; (:WRAPPER 10807 :DIRECT 32767)
;;
;; ? (list :wrapper (fpreg->rawexpt (1- (expt 2 80)))
;;         :direct  (part-select-low-high (1- (expt 2 80)) 64 78))
;; (:WRAPPER 9939 :DIRECT 32767)
;;
;; ...

Thanks!

Jared

Change History (2)

comment:1 Changed 5 years ago by gb

  • Resolution set to fixed
  • Status changed from new to closed

(In [16356]) Don't be so eafer to lower ASH to FIXNUM-ASH.

Fixes ticket:1273 in the trunk.

comment:2 Changed 5 years ago by jared

Thanks very much for the quick fix!

Cheers, Jared

Note: See TracTickets for help on using tickets.