bugKawa - Bugs: bug #35524, Unreachable code is not an error

 
 

bug #35524: Unreachable code is not an error

Submitter:  Helmut Eller <ellerh>
Submitted:  Mon 13 Feb 2012 02:35:53 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 07 Oct 2012 06:24:11 AM UTC, comment #3: 

I'm fairly happy with the unreachable-code analysis, so I closed this bug.

Per Bothner <bothner>
Group administrator
Fri 04 May 2012 06:10:18 AM UTC, comment #2: 

I checked in a fix to make unreachable code a warning, not an error.  This is somewhat risky, since I'm not sure if the code generator may get confused or produce unverifiable code.

I'm moving to detecting unreachable code at data-flow time, and then dropping unreachable expressions.  There is partial support for this; what is missing is detecting infinite loops/recursion.   Of course this has to be approximate: I have a vague plan for doing this, but it needs to be implemented and tested.

Per Bothner <bothner>
Group administrator
Mon 13 Feb 2012 09:07:16 PM UTC, comment #1: 

At the very least I think Unreachable code should be a switchable warning that defaults to being on.

However, it's not just a matter of disabling the error.  The compiler and later the verifier might get confused  by unreachable code.  Just reporting an error is simpler for the compiler.

I'll think about it.

Per Bothner <bothner>
Group administrator
Mon 13 Feb 2012 02:35:53 PM UTC, original submission:  

Kawa refuses to compile code like this:

(define (foo)
  (call-with-current-continuation
   (lambda (return)
     (let l ()
       (return #f)
       (l)))))


that's more annoying than helpful especially for macros:

(define-syntax (loop form)
  (syntax-case form ()
    ((id stuff ...)
     (with-syntax ((r (datum->syntax-object (syntax id) 'return)))
       (syntax
        (call-with-current-continuation
         (lambda (r)
           (let l ()
             (begin stuff ...)
             (l)))))))))

(loop (return #t))


Helmut Eller <ellerh>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 ellerh (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
    2012-10-07 bothner Open/ClosedOpen Closed
    2012-05-04 bothner StatusPostponed Fixed
    2012-02-13 bothner StatusNone Postponed
        Assigned toNone bothner

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code