Compilation of 7 line function does not terminate

Bug #1734714 reported by Paul F. Dietz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

(compile nil '(lambda (a c x)
  (declare (type (integer -2845880 670871950) a))
  (declare (type (integer -8797424583931 -3696228396) c))
  (declare (type (integer 0 1) x))
  (flet ((%f16 (f16-1)
           (max f16-1 -982044058 a -1354524299132 f16-1 2
                5038700212014375 -4553 749369815788340702
                35184372088832 106498931517480 c
                4611686018427387903)
           ))
    (logior (%f16
             (expt
              (+ (- (deposit-field c (byte 26 19) -6987))
                 (%f16 x)
                 x)
              2))
            49))))

==> does not terminate before I ran out of patience

This is cut down from a larger function produced by the random tester. On that function, the lisp eventually (over the weekend when I was running the tester) ran out of heap and dropped into ldb.

I wonder if the compiler is producing very large type terms somewhere.

Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

Simplified example:

(compile nil
 '(lambda (c x)
   (declare (type fixnum c))
   (declare (type (integer 0 1) x))
   (flet ((%f16 (y) (max y y c)))
     (-
      (%f16
       (expt
        (+ (- (deposit-field c (byte 26 19) -1))
           (%f16 x))
        2))
      ))))

summary: - Compilation of 17 line function does not terminate
+ Compilation of 12 line function does not terminate
Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote : Re: Compilation of 12 line function does not terminate

Tracing SB-C::TWO-ARG-DERIVE-TYPE show some extremely large bignums are being computed. I suggest type propagation give up if the bignums get too big, and just widen to INTEGER.

Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

Even simpler:

(compile nil
 '(lambda (c)
   (declare (type fixnum c))
   (flet ((%f16 (y) (max y y c)))
     (- (%f16
         (expt
          (1+ (%f16 0))
          2))))))

summary: - Compilation of 12 line function does not terminate
+ Compilation of 8 line function does not terminate
summary: - Compilation of 8 line function does not terminate
+ Compilation of 7 line function does not terminate
Stas Boukarev (stassats)
Changed in sbcl:
status: New → Triaged
importance: Undecided → Medium
Stas Boukarev (stassats)
Changed in sbcl:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.