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