Fortran 77 and gfortran


 
Thread Tools Search this Thread
Top Forums Programming Fortran 77 and gfortran
# 1  
Old 07-15-2010
Fortran 77 and gfortran

Hi!
I have a program in fortran77. This program was compiled with pgf90, but now, I need compiled it with gfortran.

I show a bit of code.

Code:
     
program hello

  PARAMETER(a=100)
  
  integer a
    
  write(*,*)'value ', a

end program hello

What's the problem?

Thanks
# 2  
Old 07-15-2010
Hi.

You didn't say what problem you were having.

Here's the result on a Linux system as noted:
Code:
#!/usr/bin/env bash

# @(#) s1	Demonstrate gfortran.

# Infrastructure details, environment, commands for forum posts. 
# Uncomment export command to run script as external user.
# export PATH="/usr/local/bin:/usr/bin:/bin"
set +o nounset
pe() { for i;do printf "%s" "$i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
LC_ALL=C ; LANG=C ; export LC_ALL LANG
pe ; pe "Environment: LC_ALL = $LC_ALL, LANG = $LANG"
pe "(Versions displayed with local utility \"version\")"
c=$( ps | grep $$ | awk '{print $NF}' )
version >/dev/null 2>&1 && s=$(_eat $0 $1) || s=""
[ "$c" = "$s" ] && p="$s" || p="$c"
version >/dev/null 2>&1 && version "=o" $p printf gfortran
set -o nounset
pe

FILE=${1-hello.f}

# Display sample of data file, with head & tail as a last resort.
pe " || start [ first:middle:last ]"
specimen $FILE \
|| { pe "(head/tail)"; head -n 5 $FILE; pe " ||"; tail -n 5 $FILE; }
pe " || end"

pl " Results:"
gfortran -ffree-form $FILE

exit 0

producing:
Code:
% ./s1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution        : Debian GNU/Linux 5.0 
GNU bash 3.2.39
printf - is a shell builtin [bash]
gfortran GNU Fortran (Debian 4.3.2-1.1) 4.3.2

 || start [ first:middle:last ]
Whole: 5:0:5 of 9 lines in file "hello.f"
program hello

  PARAMETER(a=100)
  
  integer a
    
  write(*,*)'value ', a

end program hello
 || end

-----
 Results:
hello.f:5.11:

  integer a
          1
Error: Symbol 'a' at (1) already has basic type of REAL

The error message seems clear and suggests a solution: declare the symbol type before the first use.

Best wishes ... cheers, drl
# 3  
Old 07-15-2010
Ok. Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

GFORTRAN error in makefile installation

Hi all, I'm a new Linux and gfortran user so facing this problem I could not figure out how to proceed. Trying to install a program with a makefile, at some point the installation stops showing the following error: g++ -std=c++0x -O3 -o CAMILObash.exe ./objects/Class_SurfTri_CheckTools.o... (2 Replies)
Discussion started by: Jefferson_dhv
2 Replies

2. UNIX for Dummies Questions & Answers

Using gFORTRAN to compile something built for g77

Hi, I am having a problem compiling a program with gfortran. The program compiles with g77 and f77 but I don't have those. I edited the makefile from FC = g77 to FC = gfortran but when I run it I get a slew of undefined reference errors. Any suggestions? (8 Replies)
Discussion started by: butson
8 Replies

3. Programming

Arrays of strings in GFORTRAN errors

Hello I am using gfortran and I intended to do thiis: Module variables character(len=:), dimension(:), allocatable, array end module variables Sub test use variables integer (max_len) max_len=len_trim("something here") if(.not.allocated(array))... (1 Reply)
Discussion started by: pepe
1 Replies

4. Programming

gfortran 4.7, no support for qfloat?

I have code that works fine in ifort. But when trying to run on gfortran 4.7.1 (which does support quads and has no problem with real * 16) I can't cast an integer variable to a quad precision float (real*16) using something like: factq(i) = factq(i-1) * qfloat(i) Finding a list of the new... (2 Replies)
Discussion started by: vibrantcascade
2 Replies

5. Programming

Compilation problem with gfortran

Hello everyone, I'm trying since a few days to compile a f90 program with gfortran (on Ubuntu) with a makefile. The fortran program calls 2 routines written in C. Here is my makefile: FC = gfortran SFC = gfortran FFLAGS = -ffree-form -O... (21 Replies)
Discussion started by: leroygr
21 Replies

6. Programming

Gfortran compiler options.

I am a INTEL fortran user recently migrated to linux and installed gfortran on my system. I run numerical models as part of my research. my question is on optimization of the fortran code. I used the - vectorize option to compile for reducing the run time considerably and was happy. But... (1 Reply)
Discussion started by: schamarthi1
1 Replies

7. Programming

f77 program on gfortran

Hi, I am trying to run a simple f77 program on gfortran. Program is as follows. program trial implicit real*8 (a-h,o-z) common/var/a(2),b,c(4),d a=(/0,0/) b=0 c=(/0,0,0,0/) d=0 call add(a,b,c,d) ... (1 Reply)
Discussion started by: anshulfy
1 Replies

8. Programming

Two issues in make file, g++, gfortran

Question 1: I have a c++ project that I am trying to re-organize. I am trying to subdivide the src directory to move some src files that seldom are changed to a more out of the way location. The project is a c++ application with a fortran function called from the c. The reorganization went... (9 Replies)
Discussion started by: LMHmedchem
9 Replies

9. Programming

gfortran not connecting to system libraries

Hi ! I have one program made of several sub programs which I am trying to compile with gfortran on Fedora 14 in my system. The program was originally written in Fortran 77 and compilation command used to be - fort77 -O2 -f -w -o life life_com.f lifetime.f minuit.f tek_life.f utilities.f... (0 Replies)
Discussion started by: cylab123
0 Replies

10. Red Hat

AMBER md/g95/gfortran issue

Hi, i am trying to install AMBER10 which is a molecular dynamcis package onto two linux red hat pcs. I can successfully install the tools that comes with which uses gcc to compile, however AMBER10 requires either g95 or gfortran to compile. This is where the issue lies, i have installed both... (0 Replies)
Discussion started by: olifu02
0 Replies
Login or Register to Ask a Question