Message ID | 54CE1FAA.8040703@charter.net |
---|---|
State | New |
Headers | show |
After Stage 4 of course. On 02/01/2015 04:44 AM, Jerry DeLisle wrote: > The attached patch fixes this issue. > > Regression tested on x86-64. > > New test case attached. > > OK for trunk? > > Regards, > > Jerry > > 2015-02-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> > > PR fortran/64506 > * scanner.c (gfc_next_char_literal): Check for '!' and if found, > clear the comment and go back and get the next character.
Jerry DeLisle wrote: > The attached patch fixes this issue. > Regression tested on x86-64. > New test case attached. > > OK for trunk? Looks ok (together with a changelog for the test case). However, I tried a similar fixed-form program and it failed similarly. I think you need a similar fix (in the same function) for fixed-form source code. See attachment for an example. Tobias > 2015-02-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> > > PR fortran/64506 > * scanner.c (gfc_next_char_literal): Check for '!' and if found, > clear the comment and go back and get the next character.
On 02/01/2015 08:34 PM, Jerry DeLisle wrote: The test case should have the print *, astring changed to call abort. Jerry
Index: scanner.c =================================================================== --- scanner.c (revision 220307) +++ scanner.c (working copy) @@ -1268,13 +1268,25 @@ restart: c = next_char (); /* Character constants to be continued cannot have commentary - after the '&'. */ + after the '&'. However, there are cases where we may think we + are still in a string and we are looking for a possible + doubled quote and we end up here. See PR64506. */ - if (in_string && c != '\n') + if (in_string) { gfc_current_locus = old_loc; - c = '&'; - goto done; + + if (c == '!') + { + skip_comment_line (); + goto restart; + } + + if (c != '\n') + { + c = '&'; + goto done; + } } if (c != '!' && c != '\n')