Bug 20440 - END not as first statement on line breaks in fixed form
END not as first statement on line breaks in fixed form
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.0.0
: P2 normal
: ---
Assigned To: Not yet assigned to anyone
: rejects-valid
Depends on: 10259
Blocks: 19292
  Show dependency treegraph
 
Reported: 2005-03-12 15:14 UTC by Tobias Schlüter
Modified: 2006-07-08 10:03 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-30 19:11:57


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Schlüter 2005-03-12 15:14:56 UTC
the following valid fixed-form program is rejected by gfortran:
[tobi@marktplatz tests]$ cat fix.f
      STOP IT = NOW; END
[tobi@marktplatz tests]$ g77 fix.f
[tobi@marktplatz tests]$ gfortran fix.f
Error: Unexpected end of file in 'fix.f'
[tobi@marktplatz tests]$
Comment 1 Tobias Schlüter 2005-03-12 15:21:45 UTC
Forgot to say: putting then END statement on a new line lets this compile.
Comment 2 Andrew Pinski 2005-03-12 17:17:11 UTC
Confirmed.
Comment 3 Tobias Schlüter 2006-05-08 10:46:30 UTC
reduced testcase (not valid, but this is another bug):
      i = j; end
This bug has nothign to do with parsing of STOP, it needs:
* a statement preceding the end statement, and
* the end statement must follow a semicolon
Comment 4 Tobias Schlüter 2006-05-08 10:49:15 UTC
woops, of course I decided to make a valid testcase after I wrote that it wouldn't be valid
Comment 5 Tobias Schlüter 2006-05-08 12:59:52 UTC
Wow.  This is actually a bad bug, but after trying some stuff, I believe that it only does bad things when the code is non-standard anyway (lines beginning with ';').

E.g.
schluter@pcl247d:~/src/pr/20440> cat t.f
      program a
      ; i = j ; end
      end
schluter@pcl247d:~/src/pr/20440> ~/src/gcc/build/gcc/f951 t.f -fdump-parse-tree

        Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4)
        procedure name = MAIN__
        symtree: MAIN__  Ambig 0
        symbol MAIN__ (UNKNOWN 0)(PROCEDURE UNKNOWN-INTENT PUBLIC UNKNOWN-PROC SUBROUTINE)

        symtree: a  Ambig 0
        symbol a (UNKNOWN 0)(PROGRAM UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC)



 MAIN__
Execution times (seconds)
 final                 :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (50%) wall       0 kB ( 0%) ggc
 TOTAL                 :   0.01             0.00             0.02                654 kB
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --disable-checking to disable checks.
schluter@pcl247d:~/src/pr/20440> 

The complete line following the semicolon is skipped.

OTOH
schluter@pcl247d:~/src/pr/20440> cat t.f
      program a
      i = j ; end
      end
schluter@pcl247d:~/src/pr/20440> ~/src/gcc/build/gcc/f951 t.f                  
 MAIN__ In file t.f:1

      program a                                                         
                                                                       1
 In file t.f:3

                    
                   2
Error: Two main PROGRAMs at (1) and (2)

Execution times (seconds)
 parser                :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (50%) wall     105 kB (16%) ggc
 TOTAL                 :   0.01             0.00             0.02                655 kB
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --disable-checking to disable checks.
schluter@pcl247d:~/src/pr/20440> 

yields the correct error
Comment 6 Paul Thomas 2006-07-08 10:03:01 UTC
This is entirely fixed on trunk.

Paul