×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Need help resolving INTEGER based and "out of bounds" errors please

Need help resolving INTEGER based and "out of bounds" errors please

Need help resolving INTEGER based and "out of bounds" errors please

(OP)
Quite a newbie here with fortran and require some assistance with the few errors that I am unable to resolve after quite a lot of efforts put into reading and understanding similar problems. Would be great if someone is able to help me out :)

CODE -->

$ make Trial1
gfortran    Trial1.f   -o Trial1
Trial1.f:16.24:

      INTEGER IER,IW,K,J
                        1
Error: Symbol 'j' at (1) already has basic type of INTEGER
Trial1.f:47.11:

      IW = 1500
           1
Warning: Extension: Conversion from INTEGER(4) to LOGICAL(4) at (1)
Trial1.f:164.12:

      DO 18,  K=1,1000
            1
Error: Loop variable at (1) must be INTEGER
Trial1.f:267.10:

      Fxr(2) = (Ex(2)/psi)*(FR(2)/ER(2))
          1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
Trial1.f:268.10:

      Fyr(2) = (Ey(2)/phi)*(FR(2)/ER(2))
          1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
Trial1.f:283.30:

      F(3) = (-S(2)-2.0d0*Fxr(2)-FT(2)*X(5))/mw
                              1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
Trial1.f:284.32:

      F(4) = (-S(4)-2.0d0*a*Fyr(2))/Iwy
                                1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
<builtin>: recipe for target 'Trial1' failed
make: *** [Trial1] Error 1 

The code file can be found here: sysden.com/Trial.f

RE: Need help resolving INTEGER based and "out of bounds" errors please

you have declared J a second time; apparently this is producing such an error in that line so that the entire line was not executed and, so, the other variable in the same line were not properly declared either and producing subsequent errors...follow?

Basically, until you gain more experience fix one error at a time...the first, every time. And THEN see what happens next.

I hope you know what you are doing when you say "IMPLICIT LOGICAL (A-Z)"

RE: Need help resolving INTEGER based and "out of bounds" errors please

You also have a spurious comma after the 18 in your do loop on line 267. I'd recommend coding in a later version of Fortran rather than Fortran 66.

RE: Need help resolving INTEGER based and "out of bounds" errors please

(OP)
Thank you salgerman and xwb for your help :)

xwb, this is part of my project work and have been asked to code as per Fortran 77. Don't really have an option there. :)

- I removed the "J" from line 16. Should have spotted that earlier. Don't know how I missed that out.
- Also changed "IMPLICIT LOGICAL (A-Z)" to "IMPLICIT NONE" which helped me get rid of the IW error and the DO loop error based on some advise.
- Managed to get rid of the Fxr and Fyr errors by changing Fxr(2) to Fxr(1) and similarly.

This has popped out a few more errors though.

Quote:


$ make Trial1
gfortran Trial1.f -o Trial1
Trial1.f:219.20:

COMMON /PARAM/ V
1
Warning: Named COMMON block 'param' at (1) shall be of the same size as elsewhere (8 vs 16 bytes)
Trial1.f:302.20:

COMMON /EXTRA/ mw,mf,k1,k2,k3,k4,k5,k6
1
Warning: Named COMMON block 'extra' at (1) shall be of the same size as elsewhere (64 vs 360 bytes)
Trial1.f:301.20:

COMMON /PARAM/ V
1
Warning: Named COMMON block 'param' at (1) shall be of the same size as elsewhere (8 vs 16 bytes)
/tmp/cceH8Y8s.o:Trial1.f:(.text+0x800): undefined reference to `ode2_'
/tmp/cceH8Y8s.o:Trial1.f:(.text+0x800): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `ode2_'
/tmp/cceH8Y8s.o:Trial1.f:(.text+0xa46): undefined reference to `path_'
/tmp/cceH8Y8s.o:Trial1.f:(.text+0xa46): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `path_'
/tmp/cceH8Y8s.o:Trial1.f:(.text+0xb2e): undefined reference to `path_'
/tmp/cceH8Y8s.o:Trial1.f:(.text+0xb2e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `path_'
/tmp/cceH8Y8s.o:Trial1.f:(.text+0xce0): undefined reference to `path_'
/tmp/cceH8Y8s.o:Trial1.f:(.text+0xce0): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `path_'
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cceH8Y8s.o: bad reloc address 0x0 in section `.pdata'
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../x86_64-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'Trial1' failed
make: *** [Trial1] Error 1

I searched for all the "COMMON /PARAM/ V" entries and it seems that there are no other variables mentioned alongside. Don't know what exactly the error telling me to be honest.

Any help is greatly appreciated!

RE: Need help resolving INTEGER based and "out of bounds" errors please

(OP)
Oh wait, that was supposed to be in the "code" brackets. Can't seem to edit my post now. Sorry about that.

RE: Need help resolving INTEGER based and "out of bounds" errors please

From what I can see, your common /param/ C at the top of the program has C being declared as C(2)

But common /param/ V in subroutine FCN has V being declared as a scalar.

In subroutine, they do calculate two creep forces, namely, front and rear axles...so Fxr(2), Fyr(2) was the intended thing to do on the left hand side of those equations...the fix was to go back to the declaration of those arrays and make them be 2 entries long and not just 1.

RE: Need help resolving INTEGER based and "out of bounds" errors please

Oh, and just in case you don't know, common blocks are common memory blocks where values in memory are assignment to the variables listed...no matter what their names are. In your case, the variable in one common block is being referred to as C and in the other as V...but they are meant to be the same exact quantity and variable and as such they need to be declared in the same exact way...because this is not the case, above, the program complains about the overall length (in bytes) of the memory block.

When programming in this style, I typically keep variable names the same everywhere in my program so that I can type declarations and common blocks once and then copy and paste wherever else I need them.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close