Opened 6 years ago
Closed 6 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 | 
Description
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)
Change History (4)
Changed 6 years ago by
| Attachment: | gcc-errors.txt added | 
|---|
comment:1 Changed 6 years ago by
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 6 years ago by
| Estimated difficulty: | → medium | 
|---|---|
| Milestone: | someday → 5.2 | 
Evan thinks this is due to flonum unboxing handling literals wrong
Note: See
        TracTickets for help on using
        tickets.
    
gcc errors