[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-02 Thread jvdelisle at gcc dot gnu dot org


--- Comment #12 from jvdelisle at gcc dot gnu dot org  2010-06-02 19:31 
---
Fixed and closing.


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread burnus at gcc dot gnu dot org


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

  Known to fail||4.6.0
  Known to work||4.5.0
   Target Milestone|--- |4.6.0


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread kargl at gcc dot gnu dot org


--- Comment #1 from kargl at gcc dot gnu dot org  2010-06-02 00:42 ---
The problem is caused by gfc_match_stopcode().


  if (gfc_match_eos () != MATCH_YES)
{
  m = gfc_match_init_expr (e);
  if (m == MATCH_ERROR)
goto cleanup;
  if (m == MATCH_NO)
goto syntax;
}
#if 0
  if (gfc_match_eos () != MATCH_YES)
goto syntax;
#endif

If the first gfc_match_eos () does not match an end-of-statement,
gfortran immediate calls gfc_match_eos () again.  With the #if 0
above the code in comment #1 compiles and executes.  So, why is
there a 2nd call to gfc_match_eos().


-- 

kargl at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||sgk at troutmask dot apl dot
   ||washington dot edu


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread sgk at troutmask dot apl dot washington dot edu


--- Comment #2 from sgk at troutmask dot apl dot washington dot edu  
2010-06-02 01:57 ---
Subject: Re:  [4.6 Regression] STOP parsing rejects valid code

On Wed, Jun 02, 2010 at 12:42:11AM -, kargl at gcc dot gnu dot org wrote:
 }
 #if 0
   if (gfc_match_eos () != MATCH_YES)
 goto syntax;
 #endif
 
 If the first gfc_match_eos () does not match an end-of-statement,
 gfortran immediate calls gfc_match_eos () again.  With the #if 0
 above the code in comment #1 compiles and executes.  So, why is
 there a 2nd call to gfc_match_eos().
 

Removing this chunk of code causes no testsuite regressions
on x86_64-*-freebsd.

Is leftover from the STOP/ALL_STOP churn?


-- 


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread kargl at gcc dot gnu dot org


--- Comment #3 from kargl at gcc dot gnu dot org  2010-06-02 02:03 ---
Here's a dejagnu testcase.

! { dg-do run }
  character(1) c, y
  y = 'y'
  read(y,*) c
  if (c=='y') stop; if (c=='Y') stop
  call abort()
  end

The 'dg-do run' could be changed to 'dg-do compile'


-- 


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread jvdelisle at gcc dot gnu dot org


--- Comment #4 from jvdelisle at gcc dot gnu dot org  2010-06-02 03:52 
---
Mine. The problem is the misplacement of the closing bracket.   I will fix
shortly.


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
   |dot org |org
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2010-06-02 03:52:50
   date||


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread jvdelisle at gcc dot gnu dot org


--- Comment #5 from jvdelisle at gcc dot gnu dot org  2010-06-02 04:17 
---
Some additional tests/results:

Because we are using gfc_match_init_expr: leaving the ; out.

pr44371.f90:5.18:

  if (c=='y') stop if (c=='Y') stop
  1
Error: Function 'if' in initialization expression at (1) must be an intrinsic
function

This makes no sense in the context, so I want to change the above error
message.

The following message is given after I fix the eos match issue:

  if (c=='y') stop 123 if (c=='Y') stop
  1
Error: Syntax error in STOP statement at (1)

Simply deleting the match_eos leaves the invalid undetected.

I plan to commit the following as simple and obvious. Sorry for the breakage.

Index: match.c
===
--- match.c (revision 160130)
+++ match.c (working copy)
@@ -2018,10 +2018,11 @@
goto cleanup;
   if (m == MATCH_NO)
goto syntax;
+
+  if (gfc_match_eos () != MATCH_YES)
+   goto syntax;
 }

-  if (gfc_match_eos () != MATCH_YES)
-goto syntax;

   if (gfc_pure (NULL))
 {


-- 


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread sgk at troutmask dot apl dot washington dot edu


--- Comment #6 from sgk at troutmask dot apl dot washington dot edu  
2010-06-02 04:36 ---
Subject: Re:  [4.6 Regression] STOP parsing rejects valid code

On Wed, Jun 02, 2010 at 04:17:56AM -, jvdelisle at gcc dot gnu dot org
wrote:
 
 I plan to commit the following as simple and obvious. Sorry for the breakage.
 
 Index: match.c
 ===
 --- match.c (revision 160130)
 +++ match.c (working copy)
 @@ -2018,10 +2018,11 @@
 goto cleanup;
if (m == MATCH_NO)
 goto syntax;
 +
 +  if (gfc_match_eos () != MATCH_YES)
 +   goto syntax;
  }
 
 -  if (gfc_match_eos () != MATCH_YES)
 -goto syntax;
 
if (gfc_pure (NULL))
  {
 

I assume that you will add appropriate testcases as well.


-- 


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread jvdelisle at gcc dot gnu dot org


--- Comment #7 from jvdelisle at gcc dot gnu dot org  2010-06-02 04:43 
---
Subject: Bug 44371

Author: jvdelisle
Date: Wed Jun  2 04:42:41 2010
New Revision: 160133

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=160133
Log:
2010-06-01  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR fortran/44371
* match.c (gfc_match_stopcode): Move gfc_match_eos call inside 
condition block.

Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/match.c


-- 


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread jvdelisle at gcc dot gnu dot org


--- Comment #8 from jvdelisle at gcc dot gnu dot org  2010-06-02 04:46 
---
Subject: Bug 44371

Author: jvdelisle
Date: Wed Jun  2 04:46:38 2010
New Revision: 160134

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=160134
Log:
2010-06-01  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR fortran/44371
* gfortran.dg/error_stop_1.f08: New test.
* gfortran.dg/error_stop_2.f08: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/error_stop_1.f08
trunk/gcc/testsuite/gfortran.dg/error_stop_2.f08
Modified:
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread sgk at troutmask dot apl dot washington dot edu


--- Comment #9 from sgk at troutmask dot apl dot washington dot edu  
2010-06-02 04:52 ---
Subject: Re:  [4.6 Regression] STOP parsing rejects valid code

On Wed, Jun 02, 2010 at 04:46:56AM -, jvdelisle at gcc dot gnu dot org
wrote:
 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=160134
 Log:
 2010-06-01  Jerry DeLisle  jvdeli...@gcc.gnu.org
 
 PR fortran/44371
 * gfortran.dg/error_stop_1.f08: New test.
 * gfortran.dg/error_stop_2.f08: New test.
 
 Added:
 trunk/gcc/testsuite/gfortran.dg/error_stop_1.f08
 trunk/gcc/testsuite/gfortran.dg/error_stop_2.f08

Neither testcase includes the original problem report.
In error_stop_2.f08, you have 

 if (c=='x') stop size(i); if (c=='X') stop

which contains and initialization expression.  Please 
the original test without the expression, ie.,

 if (c=='x') stop ; if (c=='X') stop



-- 


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread sgk at troutmask dot apl dot washington dot edu


--- Comment #10 from sgk at troutmask dot apl dot washington dot edu  
2010-06-02 04:53 ---
Subject: Re:  [4.6 Regression] STOP parsing rejects valid code

On Wed, Jun 02, 2010 at 04:52:03AM -, sgk at troutmask dot apl dot
washington dot edu wrote:
 
 Neither testcase includes the original problem report.
 In error_stop_2.f08, you have 
 
  if (c=='x') stop size(i); if (c=='X') stop
 
 which contains and initialization expression.  Please 
 the original test without the expression, ie.,

Grr.  s/Please/Please add/

 
  if (c=='x') stop ; if (c=='X') stop


-- 


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



[Bug fortran/44371] [4.6 Regression] STOP parsing rejects valid code

2010-06-01 Thread jvdelisle at gcc dot gnu dot org


--- Comment #11 from jvdelisle at gcc dot gnu dot org  2010-06-02 05:02 
---
Subject: Bug 44371

Author: jvdelisle
Date: Wed Jun  2 05:02:07 2010
New Revision: 160135

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=160135
Log:
2010-06-01  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR fortran/44371
* gfortran.dg/error_stop_2.f08: Minor update.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/error_stop_2.f08


-- 


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