A compile time error in GFortran I don't understand
It is a Ubuntu VM. I am trying to use a Fast Fourier Transform module given here. I get an error which is in this code block:
Code:
! COMPUTE THE TRANSFORM Quote:
Could anybody explain what is wrong? Thanks, - A. |
i tend to use a fair amount of old code
so the first is that this f90 is from 2002 so i would expect a issue with the current gfortran 4.8 or 4.9 now the legacy gcc33 or 34 has g77 i would first see if it builds using the gfortran from gcc 4.0 or 4.1 getting 12 year old code to build on modern 64 bit hardware in a modern OS is -- lets just say " fun" you will want to use the 32 bit compiler and build a 32 bit program |
64bits g77 for Ubuntu 12* and later :
compat-gcc34-g77-3.4.6-ubuntu12-1_amd64.deb https://drive.google.com/file/d/0B7S...ew?usp=sharing Depends on compat-gcc34-3.4.6-ubuntu1204-1_amd64.deb https://drive.google.com/file/d/0B7S...ew?usp=sharing And compat-libf2c-3.4.6-ubuntu12-2_amd64.deb https://drive.google.com/file/d/0B7S...ew?usp=sharing - |
Quote:
Of course, they are different functions, and your calls could be correct. But that's where I would start, confirming the type of each of the variables in the calls. |
I will try to answer a couple of issues raised here. First, it is a 32 bit Ubuntu. For some reason I could not install a 64 bit on my 64 bit machine, now I don't recall why. Secondly, answering Toadbrooks: it is not my code. I provided a link to the source code I copied exactly. I also noticed that an array is passed in the first call and an array's member, a number, is passed in the second two calls. I deliberately included the first call for comparison. Still I don't have a good answer. I kind of afraid to change the code but perhaps I will have to. Thanks.
|
That's just a block of subroutines. What does your driver look like? How have you declared trigs?
|
What do you mean driver? I drive myself to work, :-) Just kidding. I posted a link to that software. I copied the whole package faithfully but I cannot answer any questions, because I do not understand that part of the code, I do not understand the error message. Thanks, suicidaleggroll.
|
Alex, your code or not, you are going to have to look for the definition of the 3 CALLed procedures. There should be a type definition somewhere near the top of the code for each of those routines. That will help you determine if what you are passing is the correct type or not, especially given that is what the error message seems to mean to me.
If you can't, you can't. But I can't offer much more help than that. MANY years ago, I came across an Integer Programming model in Fortran. I wanted it, but all I had in 1978 was a machine that spoke BASIC. I managed to convert it from Fortran to Basic, and got it working. Took weeks and I couldn't have done it if I wasn't skilled in both languages. You may be attempting the impossible. (Which doesn't mean you shouldn't try, but the point at which you can't determine the type of the variables you are passing versus the type the routines require might be as far as you will get.) |
Quote:
However, I see now you're just trying to compile the module by itself. In that case, it looks like an error in the code. I REALLY don't like the way this is written. They're passing a single element of the array into the function, and then accessing it as if the entire array was passed in. Code:
CALL gpfa3f(a, b, trigs(i), inc, jump, n, iq, lot, ISIGN) Code:
SUBROUTINE gpfa3f(a, b, trigs, inc, jump, n, mm, lot, ISIGN) I deal a lot with fortran, and I've seen a lot of really bad code, but I've never seen somebody do this. I would start by modifying the call and declaration for gpfa3f and gpfa5f. Pass "i" in as a separate parameter, so the call would look like: Code:
CALL gpfa3f(a, b, trigs, i, inc, jump, n, mm, log, ISIGN) Code:
SUBROUTINE gpfa3f(a, b, trigs, trigidx, inc, jump, n, mm, lot, ISIGN) Code:
REAL (dp), INTENT(IN) :: trigs(*) Code:
REAL (dp), INTENT(IN) :: trigs(:) and finally, every time trigs is accessed inside gpfa3f and gpfa5f, add trigidx (or whatever you want to call it) to the index, for example change this: co1 = trigs(kk+1) to this co1 = trigs(trigidx+kk+1) At least I assume that's what the original developer is intending to do. Fortran is usually very portable, AS LONG AS people write it properly. I deal a lot with old code, and running something from 2002 on a modern compiler rarely takes much effort UNLESS the original developer took a bunch of shortcuts and assumptions. For example, I have one HUGE code that can't be built using any compiler more recent than 2005 because they did crap like this all of the place: Code:
real :: a(50), b(50) Code:
real :: a(50), b(50) Code:
real :: a(100) |
Thank you both. It is quite a bit of specific information. I will start modifying the code tonight after work.
|
Quote:
Code:
SUBROUTINE gpfa(a, b, trigs, inc, jump, n, lot, ISIGN) Code:
SUBROUTINE gpfa2f(a, b, trigs, inc, jump, n, mm, lot, ISIGN) Code:
SUBROUTINE gpfa3f(a, b, trigs, inc, jump, n, mm, lot, ISIGN) Code:
SUBROUTINE gpfa5f(a, b, trigs, inc, jump, n, mm, lot, ISIGN) |
Thank you, everyone who helped. I marked all the posts as helpful and they really are. On a practical side, I simply removed the index (i) but did not pass it separately to the subroutines. I want to try it without doing it and should I run into trouble, hopefully, I can always do it later. Many thanks, - A.
|
While I'm sure it compiles and runs now, I highly doubt the answers will be correct. You should be VERY suspicious of your results.
|
Quote:
|
With Fast Fourier Transform there is a simple way to verify if the process is correct. You do a reverse transform and if everything is proper, you should get approximately the original result.
|
All times are GMT -5. The time now is 12:24 AM. |