public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: Donald Sheriff <don327@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: converting from microsoft fortran
Date: Sun, 30 Jun 2013 06:23:00 -0000	[thread overview]
Message-ID: <51CEF2B8.2000106@net-b.de> (raw)
In-Reply-To: <CABmsHY5+pb-0SkFC7k5hRXY8TyxOhysAnnXTthA1R=GdGCYT2w@mail.gmail.com>

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',

      reply	other threads:[~2013-06-29 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-30  2:24 Donald Sheriff
2013-06-30  6:23 ` Tobias Burnus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51CEF2B8.2000106@net-b.de \
    --to=burnus@net-b.de \
    --cc=don327@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).