[Bug fortran/46705] Spurious "Missing '&' in continued character constant" warning occurs twice

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 29 21:02:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46705

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |jvdelisle at gcc dot
                   |                            |gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-29 20:39:24 UTC ---
The crucial part is that a '' or a "" is immediately followed by the ampersand.

The warning is printed by scanner.c's gfc_next_char_literal when called with a
non-zero argument ("in_string"). In io.c, that matches a next_char with
non-zero argument.

The logic fails in io.c with:

static format_token
    ...
    case '\'':
    case '"':
      delim = c;
      ...
      for (;;)
        {
          c = next_char (1); // Reads next second tick: '
          ...
          if (c == delim)
            {
              c = next_char (1); // encounters ampersand and goes into next
line

One might need to do something like (untested!):

              c = next_char (gfc_peek_ascii_char () != '&'));

Or something fancier.



More information about the Gcc-bugs mailing list