public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30968]  New: Bogus warning with continued lines of concatenated strings
@ 2007-02-26 13:11 anlauf at gmx dot de
  2007-02-26 17:11 ` [Bug fortran/30968] " burnus at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: anlauf at gmx dot de @ 2007-02-26 13:11 UTC (permalink / raw)
  To: gcc-bugs

The following program gives a bogus warning when
compiled with -Wall or -std=f95 or -std=f2003:


program gfcbug59
  print *, "Hello"&
       // " World"      ! Bogus warning with -Wall or -std=f95 or -std=f2003
end program gfcbug59

% gfc -Wall gfcbug59.f90
gfcbug59.f90:3.8:

       // " World"      ! Bogus warning with -Wall or -std=f95 or -std=f2003
       1
Warning: Missing '&' in continued character constant at (1)
gfcbug59.f90:3.8:

       // " World"      ! Bogus warning with -Wall or -std=f95 or -std=f2003
       1
Warning: Missing '&' in continued character constant at (1)


-- 
           Summary: Bogus warning with continued lines of concatenated
                    strings
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/30968] Bogus warning with continued lines of concatenated strings
  2007-02-26 13:11 [Bug fortran/30968] New: Bogus warning with continued lines of concatenated strings anlauf at gmx dot de
@ 2007-02-26 17:11 ` burnus at gcc dot gnu dot org
  2007-02-26 17:39 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-26 17:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-02-26 17:11 -------
Confirmed.

One needs the second "&" for:
 "Hello&
   & World"

But one does not need it for:
 "Hello" &
 , "World"

The following seems to be a gfortran/ifort extension:
  "Hello&
   World"
For this case, the warning / std error is correct.

The bug in gfortran is that  "Hello" &   is correctly seen as non-character
context whereas   "Hello" &  is wrongly regarded as character context.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic, rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-26 17:11:29
               date|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/30968] Bogus warning with continued lines of concatenated strings
  2007-02-26 13:11 [Bug fortran/30968] New: Bogus warning with continued lines of concatenated strings anlauf at gmx dot de
  2007-02-26 17:11 ` [Bug fortran/30968] " burnus at gcc dot gnu dot org
@ 2007-02-26 17:39 ` burnus at gcc dot gnu dot org
  2007-02-26 20:18 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-26 17:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-02-26 17:39 -------
> The bug in gfortran is that  "Hello" &   is correctly seen as non-character
> context whereas   "Hello" &  is wrongly regarded as character context.
The last line should be:   "Hello"&   without space between " and &.

Note: Printing an error twice is also a bug.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/30968] Bogus warning with continued lines of concatenated strings
  2007-02-26 13:11 [Bug fortran/30968] New: Bogus warning with continued lines of concatenated strings anlauf at gmx dot de
  2007-02-26 17:11 ` [Bug fortran/30968] " burnus at gcc dot gnu dot org
  2007-02-26 17:39 ` burnus at gcc dot gnu dot org
@ 2007-02-26 20:18 ` burnus at gcc dot gnu dot org
  2007-02-27 15:36 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-26 20:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-02-26 20:17 -------
Patch.

Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c       (Revision 122328)
+++ gcc/fortran/primary.c       (Arbeitskopie)
@@ -773,7 +773,7 @@
     return c;

   old_locus = gfc_current_locus;
-  c = gfc_next_char_literal (1);
+  c = gfc_next_char_literal (0);

   if (c == delimiter)
     return c;
@@ -852,7 +852,7 @@
 match_string_constant (gfc_expr **result)
 {
   char *p, name[GFC_MAX_SYMBOL_LEN + 1];
-  int i, c, kind, length, delimiter;
+  int i, c, kind, length, delimiter, warn_ampersand;
   locus old_locus, start_locus;
   gfc_symbol *sym;
   gfc_expr *e;
@@ -979,10 +979,16 @@
   gfc_current_locus = start_locus;
   gfc_next_char ();            /* Skip delimiter */

+  /* We disable the warning for the following loop as the warning has already
+     been printed in the loop above.  */
+  warn_ampersand = gfc_option.warn_ampersand;
+  gfc_option.warn_ampersand = 0;
+
   for (i = 0; i < length; i++)
     *p++ = next_string_char (delimiter);

   *p = '\0';   /* TODO: C-style string is for development/debug purposes.  */
+  gfc_option.warn_ampersand = warn_ampersand;

   if (next_string_char (delimiter) != -1)
     gfc_internal_error ("match_string_constant(): Delimiter not found");
+
   if (next_string_char (delimiter) != -1)
     gfc_internal_error ("match_string_constant(): Delimiter not found");


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/30968] Bogus warning with continued lines of concatenated strings
  2007-02-26 13:11 [Bug fortran/30968] New: Bogus warning with continued lines of concatenated strings anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2007-02-26 20:18 ` burnus at gcc dot gnu dot org
@ 2007-02-27 15:36 ` burnus at gcc dot gnu dot org
  2007-02-28  8:04 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-27 15:36 UTC (permalink / raw)
  To: gcc-bugs



-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-02-26 17:11:29         |2007-02-27 15:36:01
               date|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/30968] Bogus warning with continued lines of concatenated strings
  2007-02-26 13:11 [Bug fortran/30968] New: Bogus warning with continued lines of concatenated strings anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2007-02-27 15:36 ` burnus at gcc dot gnu dot org
@ 2007-02-28  8:04 ` burnus at gcc dot gnu dot org
  2007-03-05 12:58 ` [Bug fortran/30968] [4.1, 4.2 only] " burnus at gcc dot gnu dot org
  2007-03-05 13:00 ` [Bug fortran/30968] [4.1 " burnus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-28  8:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-02-28 08:04 -------
Subject: Bug 30968

Author: burnus
Date: Wed Feb 28 08:03:47 2007
New Revision: 122401

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122401
Log:
2007-02-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/30968
        * primary.c (next_string_char): Correct reading a character
        after the delimiter.
        (match_string_constant): Print warning message only once.

2007-02-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/30968
        * gfortran.dg/continuation_7.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/continuation_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/primary.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/30968] [4.1, 4.2 only] Bogus warning with continued lines of concatenated strings
  2007-02-26 13:11 [Bug fortran/30968] New: Bogus warning with continued lines of concatenated strings anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2007-02-28  8:04 ` burnus at gcc dot gnu dot org
@ 2007-03-05 12:58 ` burnus at gcc dot gnu dot org
  2007-03-05 13:00 ` [Bug fortran/30968] [4.1 " burnus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-05 12:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2007-03-05 12:58 -------
Subject: Bug 30968

Author: burnus
Date: Mon Mar  5 12:58:14 2007
New Revision: 122547

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122547
Log:
2007-03-05  Tobias Burnus  <burnus@net-b.de>

        PR fortran/30968
        * primary.c (next_string_char): Correct reading a character
        after the delimiter.
        (match_string_constant): Print warning message only once.

2007-03-05  Tobias Burnus  <burnus@net-b.de>

        PR fortran/30968
        * gfortran.dg/continuation_7.f90: New test.


Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/continuation_7.f90
Modified:
    branches/gcc-4_2-branch/gcc/fortran/ChangeLog
    branches/gcc-4_2-branch/gcc/fortran/primary.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/30968] [4.1 only] Bogus warning with continued lines of concatenated strings
  2007-02-26 13:11 [Bug fortran/30968] New: Bogus warning with continued lines of concatenated strings anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2007-03-05 12:58 ` [Bug fortran/30968] [4.1, 4.2 only] " burnus at gcc dot gnu dot org
@ 2007-03-05 13:00 ` burnus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-05 13:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2007-03-05 12:59 -------
Fixed in 4.2 (and 4.3). I don't think it is worth to porting to 4.1.
-> close bug.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[4.1, 4.2 only] Bogus       |[4.1 only] Bogus warning
                   |warning with continued lines|with continued lines of
                   |of concatenated strings     |concatenated strings


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-03-05 13:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-26 13:11 [Bug fortran/30968] New: Bogus warning with continued lines of concatenated strings anlauf at gmx dot de
2007-02-26 17:11 ` [Bug fortran/30968] " burnus at gcc dot gnu dot org
2007-02-26 17:39 ` burnus at gcc dot gnu dot org
2007-02-26 20:18 ` burnus at gcc dot gnu dot org
2007-02-27 15:36 ` burnus at gcc dot gnu dot org
2007-02-28  8:04 ` burnus at gcc dot gnu dot org
2007-03-05 12:58 ` [Bug fortran/30968] [4.1, 4.2 only] " burnus at gcc dot gnu dot org
2007-03-05 13:00 ` [Bug fortran/30968] [4.1 " burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).