public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Ancient Fortran, help please
@ 2004-12-18  4:51 Benjamin Joseph
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Joseph @ 2004-12-18  4:51 UTC (permalink / raw)
  To: gcc-help

Guys,

I have this horrible fortran problem.  I've got this ancient fortran code 
that refuses to compile any compiler except Intel Fortran Compiler--which 
is a problem because the computer we're running on is an Opteron, which is 
an AMD chipset.

If I try to compile it with g77 I get the following error:
------------
DATA TYPE      /'VHF     ','MINITRCK','C-BAND  ','S-BAND  ',
                          ^
Type disagreement between expressions at (?) and (^)
------------

I've searched the archives and have gotten some useful information, but it 
doesn't seem to solve the problem.  Here's the relevant post:

http://gcc.gnu.org/ml/gcc/1999-11n/msg00535.html

If anyone can point me in the right direction I would be eternally 
grateful.

-Ben

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

* Re: Ancient Fortran, help please
  2004-12-19  0:35   ` Bud Davis
@ 2004-12-19  3:48     ` Benjamin Joseph
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Joseph @ 2004-12-19  3:48 UTC (permalink / raw)
  To: Bud Davis; +Cc: gcc-help

That worked!

Thank you,

-Ben


On Sat, 18 Dec 2004, Bud Davis wrote:

> On Sat, 2004-12-18 at 13:22, Benjamin Joseph wrote:
>
>>
>> It looks like it's just defining a variable TYPE with a character array.
>> Anyway, as far as compilability is concerned, this works for Intel Fortran
>> Compiler 8.1.
>>
>
> TYPE is declared by default to be of type REAL*8 by the IMPLICIT REAL
> statement on line 2.
>
> the Intel compiler is quite forgiving. to work with g77 you will have to
> declare TYPE to be of an INTEGER or CHARACTER type.
>
> It should be a very surgical and safe change, as it makes no sense
> to either use or set TYPE(1) with a double precision real :)
>
>       BLOCK DATA BNCSRC
>       IMPLICIT REAL*8 (A-H,O-Z)
>       INTEGER*8 TYPE
>
>
> there is good information in the g77 info page concerning
> running code from other fortran compilers. -finit-local-zero
> and -fno-automatic are two options that are defaults for other
> compilers.  you might want to think about these a bit before
> digging deep into the code if the runtime results are not as
> expected.  nothing to do with the current issue, just something to keep
> in mind.
>
> don't let this little incompatibility dissuade you from using
> g77. IMHO g77 is the most robust and flexible F77 compiler
> available.
>
>
> HTH,
> bud davis
>
>
>
>
>
>
>

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

* Re: Ancient Fortran, help please
  2004-12-18 19:22 ` Benjamin Joseph
@ 2004-12-19  0:35   ` Bud Davis
  2004-12-19  3:48     ` Benjamin Joseph
  0 siblings, 1 reply; 5+ messages in thread
From: Bud Davis @ 2004-12-19  0:35 UTC (permalink / raw)
  To: Benjamin Joseph; +Cc: gcc-help

On Sat, 2004-12-18 at 13:22, Benjamin Joseph wrote:
 
> 
> It looks like it's just defining a variable TYPE with a character array. 
> Anyway, as far as compilability is concerned, this works for Intel Fortran 
> Compiler 8.1.
> 

TYPE is declared by default to be of type REAL*8 by the IMPLICIT REAL
statement on line 2.

the Intel compiler is quite forgiving. to work with g77 you will have to
declare TYPE to be of an INTEGER or CHARACTER type.

It should be a very surgical and safe change, as it makes no sense
to either use or set TYPE(1) with a double precision real :)

       BLOCK DATA BNCSRC
       IMPLICIT REAL*8 (A-H,O-Z)
       INTEGER*8 TYPE


there is good information in the g77 info page concerning
running code from other fortran compilers. -finit-local-zero
and -fno-automatic are two options that are defaults for other
compilers.  you might want to think about these a bit before 
digging deep into the code if the runtime results are not as
expected.  nothing to do with the current issue, just something to keep
in mind.

don't let this little incompatibility dissuade you from using
g77. IMHO g77 is the most robust and flexible F77 compiler
available.  


HTH,
bud davis






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

* Re: Ancient Fortran, help please
  2004-12-18  9:54 Bud Davis
@ 2004-12-18 19:22 ` Benjamin Joseph
  2004-12-19  0:35   ` Bud Davis
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Joseph @ 2004-12-18 19:22 UTC (permalink / raw)
  To: Bud Davis; +Cc: gcc-help

Ooops.  Yeah that might help.

Here's a complete picture of this section of code:

-----------beginning of file-----------------
       BLOCK DATA BNCSRC
       IMPLICIT REAL*8 (A-H,O-Z)
       INTEGER*2 ITABL, ITABL1, ITABL2
       LOGICAL*1 OTABL
       COMMON /BIAS/ TYPE(25), ITABL(5,25), OTABL(5,20)
       DIMENSION ITABL1(5,14), ITABL2(5,11)
       EQUIVALENCE  ( ITABL(1,1), ITABL1(1,1)) ,
      *             ( ITABL(1,15), ITABL2(1,1))
       DATA TYPE      /'VHF     ','MINITRCK','C-BAND  ','S-BAND  ',
      1                'USB30   ','USB85   ','VLFS    ','ATS     ',
      2                'ATS GRDD','NDS     ','SRE     ','LASER   ',
      3                'OPTICAL ','X-Y MMMM','        ','        ',
      4                '        ','        ','        ','        ',
      5                'PCE     ','LANDMARK','OABIAS  ','LANDMRK2',
      6                'HAP     ' /

 	some more stuff involving ITABL,ITABL1,ITABLE2...
-------------EOF---------------------------------
Here is the output of g77 --version

GNU Fortran (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
Copyright (C) 2004 Free Software Foundation, Inc.

---------------------------------------------

It looks like it's just defining a variable TYPE with a character array. 
Anyway, as far as compilability is concerned, this works for Intel Fortran 
Compiler 8.1.

Thanks for your patience.

-Ben

On Sat, 18 Dec 2004, Bud Davis wrote:

> H Ben,
>
> On first glance you have a mismatch between the type of a variable and
> the data you are trying to initialize.
>
> But, in most cases, we here at gcc-help give erroneous advice when all
> we see is a code fragment.  If you could make us a small, "should be
> compilable" fragment showing both the declaration and the
> data statement, maybe we can help out.
>
> Here is an example that I think shows your problem, but it works !!
>
> $ cat data.f
>
>       INTEGER T
>       DATA T      /'VHF     '/
>       PRINT*,T
>       END
> $ g77 data.f
> $ ./a.out
> 541476950
>
> also the output of "g77 --version" can be useful.
>
>
> --bud
>
>
>
>
>
>
>
>

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

* Re: Ancient Fortran, help please
@ 2004-12-18  9:54 Bud Davis
  2004-12-18 19:22 ` Benjamin Joseph
  0 siblings, 1 reply; 5+ messages in thread
From: Bud Davis @ 2004-12-18  9:54 UTC (permalink / raw)
  To: gcc-help; +Cc: benjo

H Ben,

On first glance you have a mismatch between the type of a variable and
the data you are trying to initialize.  

But, in most cases, we here at gcc-help give erroneous advice when all
we see is a code fragment.  If you could make us a small, "should be
compilable" fragment showing both the declaration and the
data statement, maybe we can help out.

Here is an example that I think shows your problem, but it works !!

$ cat data.f
 
       INTEGER T
       DATA T      /'VHF     '/
       PRINT*,T
       END
$ g77 data.f
$ ./a.out
 541476950

also the output of "g77 --version" can be useful.


--bud 







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

end of thread, other threads:[~2004-12-19  3:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-18  4:51 Ancient Fortran, help please Benjamin Joseph
2004-12-18  9:54 Bud Davis
2004-12-18 19:22 ` Benjamin Joseph
2004-12-19  0:35   ` Bud Davis
2004-12-19  3:48     ` Benjamin Joseph

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