home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / fortran / 4204 next >
Encoding:
Text File  |  1992-11-04  |  2.3 KB  |  53 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!spool.mu.edu!umn.edu!doug.cae.wisc.edu!dafnioti
  3. From: dafnioti@cae.wisc.edu (Petros Dafniotis)
  4. Subject: Re: VAX FORTRAN COMMON block problem
  5. Organization: U of Wisconsin-Madison College of Engineering
  6. Date: 4 Nov 92 23:10:00 CST
  7. Message-ID: <1992Nov4.231000.16114@doug.cae.wisc.edu>
  8. References: <1992Nov4.215456.9045@Princeton.EDU>
  9. Lines: 42
  10.  
  11. In article <1992Nov4.215456.9045@Princeton.EDU> mfterman@phoenix.Princeton.EDU (Mutant for Hire) writes:
  12. >Here's the problem. I have the following set of lines in my code. This
  13. >is the only common block in the entire program. These lines are repeated
  14. >verbatim in every subroutine and in the main code.
  15. >
  16. >      real t0,ts,c1,c2
  17. >      real e(-ks:ks,-ks:ks,-ks:ks)
  18. >      real ei(-ks:ks,-ks:ks,-ks:ks)
  19. >      real qqi(-ks:ks,-ks:ks,-ks:ks)
  20. >      complex y(0:iter,-ks:ks,-ks:ks,-ks:ks,1:dimf)
  21. >      common t0,ts,c1,c2,e,ei,qqi,y
  22.  
  23. Martin,
  24.   I cannot find (at first glance) anything wrong with your code; so I only
  25. have three suggestions:
  26. 1) you might mess up the values of ks or dimf in the places where you
  27.    use the COMMON block (e.g. in one routine you may use ks=10 and in
  28.    another ks=20).
  29. 2) you might (even without realizing it) pass as a dummy argument to this
  30.    or another function that contains the same COMMON, one of the arguments
  31.    of the common block, thereby introducing side effects (that are of course
  32.    illegal).
  33. 3) you might want to use the debugger and set a watch point for your y
  34.    variable that you know is messed up
  35. 4) you might have in a part of your program another blank COMMON block
  36.    that messes you up.
  37.  
  38.   Now, two advices before posting:
  39. 1) present a small as possible though complete fragment of your code that
  40.    most reasonably represents your problem. This way we can check than
  41.    imagining what might go wrong.
  42. 2) use a FORTRAN checker for spotting syntactical/program errors. FTNCHEK
  43.    is a free (and quite good) tool that I use; FLINT is a commercial and
  44.    extremely flexible tool. I use both. See FAQ list for locations/companies
  45.    and other information. Believe me, you will see BIG differences, especially
  46.    with big codes.
  47.  
  48.   I really hope that these are of any usefulness.
  49.  
  50.                 Petros Dafniotis
  51.                 Chem Engr Dept, UW-Madison
  52.             e-mail: dafnioti@cae.wisc.edu
  53.