bug-kawa
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-kawa] [bug #36334] Premature constant folding on statically typed v


From: Charles H. Turner
Subject: [Bug-kawa] [bug #36334] Premature constant folding on statically typed variables
Date: Sun, 29 Apr 2012 11:13:42 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0

URL:
  <http://savannah.gnu.org/bugs/?36334>

                 Summary: Premature constant folding on statically typed
variables
                 Project: Kawa
            Submitted by: charlest
            Submitted on: Sun 29 Apr 2012 11:13:41 AM GMT
                Category: Code generation
                Severity: 3 - Normal
              Item Group: Unexpected result
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Consider this interaction:

(define (test)
 (let ((x :: integer 10.5))
   (* x x)))
/dev/stdin:2:23: warning - type DFloNum is incompatible with required
type integer
/dev/stdin:3:5: warning - cannot convert literal (of type
gnu.math.DFloNum) to Type integer

So far, as expected. But when you type (test), you get:

Value '110.25' has wrong type (DFloNum) (expected: integer)

(* 10.5 10.5) is being folded too soon, Kawa should fail when it sees that the
cast can not be satisfied.

Some explanation from Per on the mailing lists

"This looks like a bug in constant folding.
We're multiplying 10.5 and 10.5 - and eliminating the cast/conversion
of 10.5 to integer.  In this case we know the cast always
fails, so we shouldn't do the constant-folding.  But even if the
cast succeeds, we need to used the converted value.

This issue seems related to the unreachable-code issue.  I.e. the
type x really should be "unreachable" or Type.neverReturnsType.
I am looking at improvements in the area of unreachable code"




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36334>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]