Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 357:82af71383b8a

Show
Ignore:
Timestamp:
07/14/08 06:11:30 (6 months ago)
Author:
ChristianK
branch:
trunk
Message:

[svn r378] Make some errors fatal to prevent segfaults. Error instead of assert on missing label.

Fixes: nocompile/
finally_02, 03, 07, 08
goto_16_A, 16_B, 12, 13, 14

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gen/llvmhelpers.cpp

    r356 r357  
    162162    if (iter == fd->labmap.end()) 
    163163    { 
    164         if (fd->returnLabel->ident->equals(ident)) 
     164        if (fd->returnLabel && fd->returnLabel->ident->equals(ident)) 
    165165        { 
    166166            assert(fd->returnLabel->statement); 
     
    181181 
    182182    LabelStatement* lblstmt = DtoLabelStatement(target); 
    183     assert(lblstmt != NULL); 
     183    if(!lblstmt) { 
     184        error(*loc, "the label %s does not exist", target->toChars()); 
     185        fatal(); 
     186    } 
    184187 
    185188    // if the target label is inside inline asm, error 
    186     if(lblstmt->asmLabel) 
    187         error(*loc, "cannot goto into inline asm block"); 
     189    if(lblstmt->asmLabel) { 
     190        error(*loc, "cannot goto to label %s inside an inline asm block", target->toChars()); 
     191        fatal(); 
     192    } 
    188193 
    189194    // find target basic block 
     
    205210    // goto into finally blocks is forbidden by the spec 
    206211    // though it should not be problematic to implement 
    207     if(lblstmt->tf != sourcetf) 
     212    if(lblstmt->tf != sourcetf) { 
    208213        error(*loc, "spec disallows goto into finally block"); 
     214        fatal(); 
     215    } 
    209216 
    210217    // emit code for finallys between goto and label 
Copyright © 2008, LDC Development Team.