This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix openmp failures caused by PR19260 fix
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jerry DeLisle <jvdelisle at verizon dot net>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 5 Oct 2006 11:14:22 -0400
- Subject: [PATCH] Fix openmp failures caused by PR19260 fix
- References: <4510AAD6.40201@verizon.net> <4510CB7C.3030900@verizon.net> <451352E8.1030304@verizon.net> <20061005142446.GD20982@devserv.devel.redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Oct 05, 2006 at 10:24:46AM -0400, Jakub Jelinek wrote:
> On Thu, Sep 21, 2006 at 08:05:12PM -0700, Jerry DeLisle wrote:
> > 2006-09-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
> >
> > PR fortran/19260
> > * scanner.c (gfc_next_char_literal): Add check for missing '&'
> > and set locus to old_locus when not scanning a character literal.
>
> This breaks several tests in libgomp.
Here is a fix that seems to fix all the libgomp testcases, ok to commit?
2006-10-05 Jakub Jelinek <jakub@redhat.com>
* scanner.c (skip_free_comments): Return bool instead of void.
(gfc_next_char_literal): Don't return ' ' if & is missing after
!$omp or !$. Use skip_{free,fixed}_comments directly instead
of gfc_skip_comments.
--- gcc/fortran/scanner.c.jj 2006-10-05 00:27:43.000000000 +0200
+++ gcc/fortran/scanner.c 2006-10-05 16:50:10.000000000 +0200
@@ -327,9 +327,11 @@ skip_comment_line (void)
/* Comment lines are null lines, lines containing only blanks or lines
- on which the first nonblank line is a '!'. */
+ on which the first nonblank line is a '!'.
+ Return true if !$ openmp conditional compilation sentinel was
+ seen. */
-static void
+static bool
skip_free_comments (void)
{
locus start;
@@ -379,7 +381,7 @@ skip_free_comments (void)
openmp_flag = 1;
openmp_locus = old_loc;
gfc_current_locus = start;
- return;
+ return false;
}
}
gfc_current_locus = old_loc;
@@ -390,7 +392,7 @@ skip_free_comments (void)
{
gfc_current_locus = old_loc;
next_char ();
- return;
+ return true;
}
}
gfc_current_locus = old_loc;
@@ -405,6 +407,7 @@ skip_free_comments (void)
if (openmp_flag && at_bol)
openmp_flag = 0;
gfc_current_locus = start;
+ return false;
}
@@ -597,6 +600,8 @@ restart:
if (gfc_current_form == FORM_FREE)
{
+ bool openmp_cond_flag;
+
if (!in_string && c == '!')
{
if (openmp_flag
@@ -668,7 +673,7 @@ restart:
continue_line = gfc_current_locus.lb->linenum;
/* Now find where it continues. First eat any comment lines. */
- gfc_skip_comments ();
+ openmp_cond_flag = skip_free_comments ();
if (prev_openmp_flag != openmp_flag)
{
@@ -709,6 +714,10 @@ restart:
gfc_warning_now ("Missing '&' in continued character constant at %C");
gfc_current_locus.nextc--;
}
+ /* Both !$omp and !$ -fopenmp continuation lines have & on the
+ continuation line only optionally. */
+ else if (openmp_flag || openmp_cond_flag)
+ gfc_current_locus.nextc--;
else
{
c = ' ';
@@ -741,7 +750,7 @@ restart:
old_loc = gfc_current_locus;
gfc_advance_line ();
- gfc_skip_comments ();
+ skip_fixed_comments ();
/* See if this line is a continuation line. */
if (openmp_flag != prev_openmp_flag)
Jakub