public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* converting from microsoft fortran
@ 2013-06-30  2:24 Donald Sheriff
  2013-06-30  6:23 ` Tobias Burnus
  0 siblings, 1 reply; 2+ messages in thread
From: Donald Sheriff @ 2013-06-30  2:24 UTC (permalink / raw)
  To: gcc-help

Hi
I am trying to convert a program written in m$ fortran and am getting
this error:
gfortran wnsndt2.for
wnsndt2.for:197.13:

     9KARK*23(4)/'BS6399-BASIC CODE-SYM  ',
                    1
Error: Syntax error in data declaration at (1)

(The error is at the left bracket if the spacing doesn't show)
The full program is here:
https://dl.dropboxusercontent.com/u/52473465/wnsndt2.for

Can anyone help me with the gcc syntax?
Thanks

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

* Re: converting from microsoft fortran
  2013-06-30  2:24 converting from microsoft fortran Donald Sheriff
@ 2013-06-30  6:23 ` Tobias Burnus
  0 siblings, 0 replies; 2+ messages in thread
From: Tobias Burnus @ 2013-06-30  6:23 UTC (permalink / raw)
  To: Donald Sheriff; +Cc: gcc-help

Donald Sheriff wrote:
>       9KARK*23(4)/'BS6399-BASIC CODE-SYM  ',
>                      1
> Error: Syntax error in data declaration at (1)
>
> (The error is at the left bracket if the spacing doesn't show)
> The full program is here:
> https://dl.dropboxusercontent.com/u/52473465/wnsndt2.for
>
> Can anyone help me with the gcc syntax?

The code declares a character array as
   CHARACTER KARK*23(4)
which is not permitted. You could replace it by
   CHARACTER*23 KARK(4)

(The latter syntax is according to the Fortran standard (Fortran 77, 90, 
95, 2003, 2008) and should be accepted by all Fortran compilers.)

That modification seems to be sufficient to make the code compile with 
gfortran.

* * *

The code uses also other vendor extensions (which are supported by 
gfortran). To make the code conforming with the ISO/IEC Fortran 
standard, some more modificiations are required; e.g. the initialization 
with /.../ is only permitted with DATA and not in with the variable 
declaration, i.e.
       CHARACTER*1 CLASS(3) /'A','B','C'/
should be
       CHARACTER*1 CLASS(3)
       DATA CLASS/'A','B','C'/
or (since Fortran 90 and later)
       CHARACTER*1 :: CLASS(3) = (/ 'A', 'B', 'C' /)

But if you just want to compile it with gfortran, you don't need those 
as gfortran supports this initialization as vendor extension.

Tobias


--- wnsndt2.for.orig    2013-06-29 16:31:07.258765843 +0200
+++ wnsndt2.for 2013-06-29 16:33:30.034489250 +0200
@@ -101,3 +101,3 @@
       +S3FACT(8),TS3FACT(9),S2MULT(4)
-c      CHARACTER CLASS*1(3) /'A','B','C'/
+      CHARACTER*1 CLASS(3) /'A','B','C'/
        DATA
@@ -194,5 +194,5 @@
       +SBKM(4),RMUL(4),SBB(4),RMD(4),CHKS(4),RMU1(4),DALT(4)
-      CHARACTER
+      CHARACTER*23
  C     9LCA*4(2)/'    ','(CS)'/,
-     9KARK*23(4)/'BS6399-BASIC CODE-SYM  ',
+     9KARK(4)/'BS6399-BASIC CODE-SYM  ',
       9           'BS6399-BASIC CODE-ASYM',

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

end of thread, other threads:[~2013-06-29 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-30  2:24 converting from microsoft fortran Donald Sheriff
2013-06-30  6:23 ` Tobias Burnus

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).