Changeset 357:82af71383b8a
- 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
| r356 |
r357 |
|
| 162 | 162 | if (iter == fd->labmap.end()) |
|---|
| 163 | 163 | { |
|---|
| 164 | | if (fd->returnLabel->ident->equals(ident)) |
|---|
| | 164 | if (fd->returnLabel && fd->returnLabel->ident->equals(ident)) |
|---|
| 165 | 165 | { |
|---|
| 166 | 166 | assert(fd->returnLabel->statement); |
|---|
| … | … | |
| 181 | 181 | |
|---|
| 182 | 182 | 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 | } |
|---|
| 184 | 187 | |
|---|
| 185 | 188 | // 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 | } |
|---|
| 188 | 193 | |
|---|
| 189 | 194 | // find target basic block |
|---|
| … | … | |
| 205 | 210 | // goto into finally blocks is forbidden by the spec |
|---|
| 206 | 211 | // though it should not be problematic to implement |
|---|
| 207 | | if(lblstmt->tf != sourcetf) |
|---|
| | 212 | if(lblstmt->tf != sourcetf) { |
|---|
| 208 | 213 | error(*loc, "spec disallows goto into finally block"); |
|---|
| | 214 | fatal(); |
|---|
| | 215 | } |
|---|
| 209 | 216 | |
|---|
| 210 | 217 | // emit code for finallys between goto and label |
|---|