Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed in gcc fortran

Status
Not open for further replies.

psbgccft

Technical User
Feb 2, 2011
2
US
Hi,

I was trying to compile a fortran subroutine, using gcc compiler. I got the following errors during compilation,

radff.f:4339.25:

RANDOM(I) = rand(random(max(1,i-1)))
1

Error: 'i' argument of 'rand' intrinsic at (1) must be INTEGER

radff.f:4350.28:

RANDOM(I) = rand(random(max(1,i-1)))
1

Error: 'i' argument of 'rand' intrinsic at (1) must be INTEGER


Can you please help to suggest how to fix it. Thanks.
 
What it is trying to tell you is

random(max(1,i-1)) should be an integer

What has random been defined as?
 
Just have defined RND and RANDOM in dimension :

DO I = 1,IRM
DIMENSION RND(0:NRND)
DIMENSION RANDOM(IRM)
 
Then they have been defined as real. You need something like
Code:
INTEGER RND(0:NRND)
INTEGER RANDOM(IRM)
The dimension keyword is a hangover from the Fortran I/II/IV days. Not really necessary. Alternative syntax is
Code:
INTEGER, DIMENSION(0:NRND):: RND
INTEGER, DIMENSION(IRM):: RANDOM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top