Skip to content

Commit

Permalink
Windows crash in case of incorrect end statement
Browse files Browse the repository at this point in the history
Some Fortran compilers accept the END statement instead of the mandatory END TYPE. The code crashes on Windows as no correct END statement is found.
  • Loading branch information
albert-github committed Apr 15, 2019
1 parent cd63af1 commit 80e57e7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/fortranscanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,14 @@ private {
typeMode = false;
yy_pop_state();
}
^{BS}"end"{BS}/(\n|!|;) { /* incorrect end type definition */
warn(yyFileName,yyLineNr, "Found 'END' instead of 'END TYPE'");
last_entry->parent()->endBodyLine = yyLineNr;
if (!endScope(current_root))
yyterminate();
typeMode = false;
yy_pop_state();
}
}

/*------- module/global/typedef variable ---------------------------------------------------*/
Expand Down Expand Up @@ -2819,7 +2827,7 @@ static void scanner_abort()

// dummy call to avoid compiler warning
(void)yy_top_state();

return;
//exit(-1);
}
Expand Down

0 comments on commit 80e57e7

Please sign in to comment.