bugKawa - Bugs: bug #47863, InternalError in compilation...

 
 

bug #47863: InternalError in compilation seemingly related to if (int)

Submitter:  Nathan S. <nathans>
Submitted:  Thu 05 May 2016 10:43:57 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Compile-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 06 May 2016 06:00:52 AM UTC, comment #1: 

I checked in a fix for this.

The reason that it only failed when ::int was specified was that in that case the compiler could deduce that (if x ...) is always true.  I.e. the if is redundant - which is the reason this compiled bug wasn't caught before.

The reason the (set! x ...) was needed to trigger the bug was that otherwise the compiler could and did constant-fold (if x A B) to A.

The two optimizations mentioned above are done at different phases in the compiler (though probably shouldn't be), hence different effect.

I also checked in your testcase. However, I tweaked so it also tests that 0 is true.

Per Bothner <bothner>
Group administrator
Thu 05 May 2016 10:43:57 PM UTC, original submission:  

The compiler throws an InternalError when trying to compile this procedure:


(define (main args)
  (let ((x ::int 1))
    (set! x 2)
    (try-finally
      (if x (display "x is true")
        (display "x is not true"))
      (display "finally-clause executed"))))


If I do not enclose the if-statement with a try-finally clause there is no exception.  If I remove the ::int typehint there is no exception.  If I remove the set! statement there is no exception.

Nathan S. <nathans>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #37086:  fail.scm added by nathans (187B - application/vnd.lotus-screencam - file that will not compile)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by nathans (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-06-01 bothner Open/ClosedOpen Closed
    2016-05-06 bothner StatusNone Fixed
        Assigned toNone bothner
    2016-05-05 nathans Attached File- Added fail.scm, #37086

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code