Prev: What exactly does the SAVE statement do ?
Next: "static" explanation. What exactly does it mean?
From: Richard Maine on 25 May 2010 15:40 mecej4 <mecej4.nyetspam(a)operamail.com> wrote: > A module may contain just interface definitions > with not a single executable statement in it. Yes, but that doesn't help much in the current case. That just moves the interface body from the main program to the module, but it would still have all the same problems. It doesn't benefit from the way in which module procedures get their interfaces generated automatically in such a way that you know they are correct without having to laboriously check them item by item. There are benefits in that, having checked them once, you can then use the module in multiple places instead of having to redo it for each new place. But that's not much help in the current case, which only involves a single place. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: mecej4 on 25 May 2010 16:15 rudra wrote: > This might be a silly question and/or i am missing a faq but plz help > me. I have a subroutine declared as: < subroutine declared with 67 arguments > > In the main program, I have defined an interface < interface declared with 67 arguments > > > and then called the subroutine as < subroutine call with 63 arguments > > > but as soon as it getes asnit, it gives segmentation fault, as evident > forrtl: severe (174): SIGSEGV, segmentation fault occurred as one would expect, given that 63 /= 67. > plz help 1. Match the number of arguments. 2. Match the types,sizes and shapes of arguments 3. Make sure that any arguments that need to be set have been set. You have not quite finished step-1. -- mecej4
From: mecej4 on 25 May 2010 16:23 mecej4 wrote: > rudra wrote: > >> This might be a silly question and/or i am missing a faq but plz help >> me. I have a subroutine declared as: > > < subroutine declared with 67 arguments > Correction: 68 >> In the main program, I have defined an interface > < interface declared with 67 arguments > Correction: 68 >> >> and then called the subroutine as > > < subroutine call with 63 arguments > Correction: 64 >> >> but as soon as it getes asnit, it gives segmentation fault, as evident >> forrtl: severe (174): SIGSEGV, segmentation fault occurred > > as one would expect, given that 63 /= 67. > >> plz help > > 1. Match the number of arguments. > 2. Match the types,sizes and shapes of arguments > 3. Make sure that any arguments that need to be set have been set. > > You have not quite finished step-1. > I overlooked the fact that the number of commas = number of arguments - 1. -- mecej4
From: steve on 25 May 2010 16:45 On May 25, 1:15 pm, mecej4 <mecej4.nyets...(a)operamail.com> wrote: > rudra wrote: > > This might be a silly question and/or i am missing a faq but plz help > > me. I have a subroutine declared as: > > < subroutine declared with 67 arguments > > > > In the main program, I have defined an interface > > < interface declared with 67 arguments > > > > > > and then called the subroutine as > > < subroutine call with 63 arguments > > > > > > but as soon as it getes asnit, it gives segmentation fault, as evident > > forrtl: severe (174): SIGSEGV, segmentation fault occurred > > as one would expect, given that 63 /= 67. > > > plz help > > 1. Match the number of arguments. > 2. Match the types,sizes and shapes of arguments > 3. Make sure that any arguments that need to be set have been set. > > You have not quite finished step-1. > > -- mecej4 Interesting observation. I wonder if a module would help. module foo implicit none private public bar contains subroutine bar(i,j) integer i, j print *, i, j end subroutine bar end module foo program atest use foo call bar(1) end program atest troutmask:sgk[211] gfc -o z t.f90 t.f90:14.13: call bar(1) 1 Error: Missing actual argument for argument 'j' at (1) :-) -- steve
From: mecej4 on 25 May 2010 17:43
steve wrote: > On May 25, 1:15 pm, mecej4 <mecej4.nyets...(a)operamail.com> wrote: >> rudra wrote: >> > This might be a silly question and/or i am missing a faq but plz help >> > me. I have a subroutine declared as: >> >> < subroutine declared with 67 arguments > >> >> > In the main program, I have defined an interface >> >> < interface declared with 67 arguments > >> >> >> >> > and then called the subroutine as >> >> < subroutine call with 63 arguments > >> >> >> >> > but as soon as it getes asnit, it gives segmentation fault, as evident >> > forrtl: severe (174): SIGSEGV, segmentation fault occurred >> >> as one would expect, given that 63 /= 67. >> >> > plz help >> >> 1. Match the number of arguments. >> 2. Match the types,sizes and shapes of arguments >> 3. Make sure that any arguments that need to be set have been set. >> >> You have not quite finished step-1. >> >> -- mecej4 > > Interesting observation. I wonder if a module would help. Probably not! The routine he is calling is in an "old library", and there is at least one character*n argument. With IMPLICIT NONE added, he is going to see more error messages. We don't know which compiler he used, but the fact that he was able to produce an a.out (.EXE) file despite having the wrong number of arguments suggests that the MS decoration @nn was not used. > > module foo > implicit none > private > public bar > contains > subroutine bar(i,j) > integer i, j > print *, i, j > end subroutine bar > end module foo > > program atest > use foo > call bar(1) > end program atest > > troutmask:sgk[211] gfc -o z t.f90 > t.f90:14.13: > > call bar(1) > 1 > Error: Missing actual argument for argument 'j' at (1) > > :-) > > -- > steve -- mecej4 |