Opened 3 years ago

Closed 3 years ago

#1626 closed defect (fixed)

+inf.0 inserted literally into C code in some situations with -O3 and above

Reported by: Diego Owned by:
Priority: major Milestone: 5.2
Component: compiler Version: 5.1.0
Keywords: Cc:
Estimated difficulty: medium


For example, the following code doesn't compile due to this:

(import chicken.flonum)

(define x 5.0)
(cond [(fp= x +inf.0)
       (fpabs x)]
      [else (print "Nothing")])

With the first few errors being:

test.c:110:74: error: ‘inf’ undeclared (first use in this function); did you mean ‘ynf’?
  110 | if(C_truep(C_ub_i_flonum_equalp(C_flonum_magnitude(*((C_word*)lf[0]+1)),+inf.0))){
      |                                                                          ^~~
/usr/include/chicken/chicken.h:1035:38: note: in definition of macro ‘C_truep’
 1035 | #define C_truep(x)                 ((x) != C_SCHEME_FALSE)
      |                                      ^

Weirdly enough, if I replace fpabs with print, the compilation goes fine.

Attachments (1)

gcc-errors.txt (3.9 KB) - added by Diego 3 years ago.
gcc errors

Download all attachments as: .zip

Change History (4)

Changed 3 years ago by Diego

Attachment: gcc-errors.txt added

gcc errors

comment:1 Changed 3 years ago by Diego

If I bind +inf.0 to a variable beforehand -- (define y +inf.0) -- and bind that instead, it seems to work as expected.

comment:2 Changed 3 years ago by sjamaan

Estimated difficulty: medium
Milestone: someday5.2

Evan thinks this is due to flonum unboxing handling literals wrong

comment:3 Changed 3 years ago by sjamaan

Resolution: fixed
Status: newclosed

Fixed with 0ef1522

Note: See TracTickets for help on using tickets.