Jerry DeLisle - Re: [Patch, fortran] Fix bogus warning with continued lines (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.
:ADDPATCH fortran:
Fortran allows strings to continue by placing a & as last character in the line:
print *, "Hello& & World"
gfortran supports as extension:
print *, "Hello& World"
With either -Wall, -pedantic or -std=f95/f2003 the following error is shown:Warning: Missing '&' in continued character constant at (1)However, the same message is (wrongly) shown for
print *, "Hello"& , " World"& // "!"
The problem is that next_string_char read the " and needs to read the
next character to check it is not another ". It erroneously calls gfc_next_char_literal with the option in_string = 1, which causes it to
read up to the comma or slash.
The following patch corrects this and ensures also that the warning message is printed only once.
Thanks to Harald Anlauf for the report.
Bootstrapped and regression tested on x86-64/Linux. Ok for the trunk and 4.2? (As it is only a warning, I think we can omit 4.1.)