This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] Fix bogus warning with continued lines


Tobias Burnus wrote:
: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.)

This is OK,


Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]