public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/17708] New: gfortran problem with goto inside loop
@ 2004-09-28  8:28 mimo2 at free dot fr
  2004-09-28 11:35 ` [Bug fortran/17708] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mimo2 at free dot fr @ 2004-09-28  8:28 UTC (permalink / raw)
  To: gcc-bugs

Here is a simple example 
      program test
      do 10 i=1,3
      if(i == 2) goto 10
      write(*,*) ' loop with i =',i
 10   enddo
      end
  where the loop stops at the second pass (i=2). Replacing the
  "goto" by "cycle" cures the problem  (but this breaks compatibility
  with old g77 codes)
      program test
      do 10 i=1,3
      if(i == 2) cycle
      write(*,*) ' loop with i =',i
 10   enddo
      end
  I've used the gfortran version as of today (28 sep), on gcc 3.2.2

-- 
           Summary: gfortran problem with goto inside loop
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mimo2 at free dot fr
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug fortran/17708] gfortran problem with goto inside loop
  2004-09-28  8:28 [Bug fortran/17708] New: gfortran problem with goto inside loop mimo2 at free dot fr
@ 2004-09-28 11:35 ` pinskia at gcc dot gnu dot org
  2004-09-28 13:53 ` tobi at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-28 11:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-28 11:35 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-28 11:35:10
               date|                            |


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


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

* [Bug fortran/17708] gfortran problem with goto inside loop
  2004-09-28  8:28 [Bug fortran/17708] New: gfortran problem with goto inside loop mimo2 at free dot fr
  2004-09-28 11:35 ` [Bug fortran/17708] " pinskia at gcc dot gnu dot org
@ 2004-09-28 13:53 ` tobi at gcc dot gnu dot org
  2004-09-28 16:07 ` tobi at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-09-28 13:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-28 13:43 -------
t02.original looks like this:
MAIN__ ()
{
  int4 i;

  {
    int4 count.0;

    count.0 = 3;
    i = 1;
    while (1)
      {
        if (count.0 <= 0)
          {
            goto L.2;
          }
        else
          {
            (void) 0;
          }
        _gfortran_filename = "pr17708.f90";
        _gfortran_line = 4;
        _gfortran_ioparm.unit = 6;
        _gfortran_ioparm.list_format = 1;
        _gfortran_st_write ();
        _gfortran_transfer_character (" loop with i =", 14);
        _gfortran_transfer_integer (&i, 4);
        _gfortran_st_write_done ();
        i = i + 1;
        count.0 = count.0 - 1;
      }
    L.2:;
  }
  __label_000010:; <<<<<<<<<<<<<<<<<<<< this is the wrong place
}

-- 


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


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

* [Bug fortran/17708] gfortran problem with goto inside loop
  2004-09-28  8:28 [Bug fortran/17708] New: gfortran problem with goto inside loop mimo2 at free dot fr
  2004-09-28 11:35 ` [Bug fortran/17708] " pinskia at gcc dot gnu dot org
  2004-09-28 13:53 ` tobi at gcc dot gnu dot org
@ 2004-09-28 16:07 ` tobi at gcc dot gnu dot org
  2004-09-28 16:46 ` tobi at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-09-28 16:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-28 16:07 -------
The bug is actually in the frontend. From the -fdump-parse-tree output:
      DO i=1 3 1
        IF (= i 2)
          GOTO 10
        ENDIF
        WRITE UNIT=6 FMT=-1
        TRANSFER ' loop with i ='
        TRANSFER i
        DT_END
      END DO
10    NOP
The last two lines should clearly be interchanged.

-- 


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


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

* [Bug fortran/17708] gfortran problem with goto inside loop
  2004-09-28  8:28 [Bug fortran/17708] New: gfortran problem with goto inside loop mimo2 at free dot fr
                   ` (2 preceding siblings ...)
  2004-09-28 16:07 ` tobi at gcc dot gnu dot org
@ 2004-09-28 16:46 ` tobi at gcc dot gnu dot org
  2004-10-04 21:05 ` tobi at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-09-28 16:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-28 16:45 -------
Patch here: http://gcc.gnu.org/ml/fortran/2004-09/msg00277.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug fortran/17708] gfortran problem with goto inside loop
  2004-09-28  8:28 [Bug fortran/17708] New: gfortran problem with goto inside loop mimo2 at free dot fr
                   ` (4 preceding siblings ...)
  2004-10-04 21:05 ` tobi at gcc dot gnu dot org
@ 2004-10-04 21:05 ` cvs-commit at gcc dot gnu dot org
  2004-10-04 21:19 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-04 21:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-04 21:05 -------
Subject: Bug 17708

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tobi@gcc.gnu.org	2004-10-04 21:05:08

Modified files:
	gcc/fortran    : ChangeLog parse.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: pr17708.f90 

Log message:
	fortran/
	PR fortran/17708
	* parse.c (accept_statement): Don't treat END DO like END IF and
	END SELECT.
	(parse_do_block): Generate possible END DO label inside END DO
	block.
	
	also, added ChangeLog entry for previous commit.
	
	testsuite/
	PR fortran/17708
	* gfortran.dg/pr17708.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.224&r2=1.225
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/parse.c.diff?cvsroot=gcc&r1=1.19&r2=1.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4384&r2=1.4385
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/pr17708.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug fortran/17708] gfortran problem with goto inside loop
  2004-09-28  8:28 [Bug fortran/17708] New: gfortran problem with goto inside loop mimo2 at free dot fr
                   ` (3 preceding siblings ...)
  2004-09-28 16:46 ` tobi at gcc dot gnu dot org
@ 2004-10-04 21:05 ` tobi at gcc dot gnu dot org
  2004-10-04 21:05 ` cvs-commit at gcc dot gnu dot org
  2004-10-04 21:19 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-10-04 21:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-10-04 21:05 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tobi at gcc dot gnu dot org
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug fortran/17708] gfortran problem with goto inside loop
  2004-09-28  8:28 [Bug fortran/17708] New: gfortran problem with goto inside loop mimo2 at free dot fr
                   ` (5 preceding siblings ...)
  2004-10-04 21:05 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-04 21:19 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-04 21:19 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2004-10-04 21:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-28  8:28 [Bug fortran/17708] New: gfortran problem with goto inside loop mimo2 at free dot fr
2004-09-28 11:35 ` [Bug fortran/17708] " pinskia at gcc dot gnu dot org
2004-09-28 13:53 ` tobi at gcc dot gnu dot org
2004-09-28 16:07 ` tobi at gcc dot gnu dot org
2004-09-28 16:46 ` tobi at gcc dot gnu dot org
2004-10-04 21:05 ` tobi at gcc dot gnu dot org
2004-10-04 21:05 ` cvs-commit at gcc dot gnu dot org
2004-10-04 21:19 ` pinskia 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).