Prev: McFor: a MATLAB-to-Fortran 95 Compiler
Next: 100% free dell laptaps offerd by dell and Vodafone companies.
From: e p chandler on 30 Jul 2010 14:25 I want to relate the short story of a bug that took about a week to find. I was working on a program that emulated keyed access from VMS. The data is split into two files, an index file that contains keys and byte offsets into a separate data file. I wrote a program that matched a key in the index file and read the corresponding data in the data file. The keys, the offsets and all the data are in chunks of 32 bit words. The design spec was Fortran 77, so I used unformatted direct access. Writing for gfortran, I set RECL=4. The program works just fine. I sent a copy of the program, the databases and the index file to a colleague who compiled and ran it on his machine, but it did not work. His program returns garbage data. The data he reads from the file was nothing like mine. Evan a debugger gives us no insight. Both of us are running 32 bit Windows with 32 bit default integers. He is using Intel Fortran. [pause to think about the answer before reading below] I puzzled and puzzled over this. He was also seeing an end of file error when I was not. Why was he running off the end of the data file? A little light came on and I remembered that in IVF the units for RECL are 32 bit words, not bytes. He was reading from a byte position in the data file approximately 4 times too high. Once he set the compiler option to RECL in bytes instead of words (from the IDE), the program ran just fine. I've probably just blown my chances of ever being hired for a programming job by telling this story!. [smile] --- Elliot
From: GaryScott on 30 Jul 2010 15:56 On Jul 30, 1:25 pm, e p chandler <e...(a)juno.com> wrote: > I want to relate the short story of a bug that took about a week to > find. I was working on a program that emulated keyed access from VMS. > The data is split into two files, an index file that contains keys and > byte offsets into a separate data file. I wrote a program that matched > a key in the index file and read the corresponding data in the data > file. > > The keys, the offsets and all the data are in chunks of 32 bit words. > The design spec was Fortran 77, so I used unformatted direct access. > Writing for gfortran, I set RECL=4. The program works just fine. I > sent a copy of the program, the databases and the index file to a > colleague who compiled and ran it on his machine, but it did not work. > His program returns garbage data. The data he reads from the file was > nothing like mine. Evan a debugger gives us no insight. > > Both of us are running 32 bit Windows with 32 bit default integers. He > is using Intel Fortran. > > [pause to think about the answer before reading below] > > I puzzled and puzzled over this. He was also seeing an end of file > error when I was not. Why was he running off the end of the data file? > A little light came on and I remembered that in IVF the units for RECL > are 32 bit words, not bytes. He was reading from a byte position in > the data file approximately 4 times too high. Once he set the compiler > option to RECL in bytes instead of words (from the IDE), the program > ran just fine. > > I've probably just blown my chances of ever being hired for a > programming job by telling this story!. [smile] > > --- Elliot This is deja vu all over again...how many times does this happen...maybe the IVF manual should put this in 36 point font :)
From: Steve Lionel on 30 Jul 2010 16:32 On 7/30/2010 3:56 PM, GaryScott wrote: > This is deja vu all over again...how many times does this > happen...maybe the IVF manual should put this in 36 point font :) If users actually read the manual, and thought to look at the proper section, that might help. However, this gives me an idea as part of a "new user's FAQ" I am working on. -- Steve Lionel Developer Products Division Intel Corporation Nashua, NH For email address, replace "invalid" with "com" User communities for Intel Software Development Products http://software.intel.com/en-us/forums/ Intel Software Development Products Support http://software.intel.com/sites/support/ My Fortran blog http://www.intel.com/software/drfortran
From: e p chandler on 30 Jul 2010 16:51 On Jul 30, 4:32 pm, Steve Lionel <steve.lio...(a)intel.invalid> wrote: > On 7/30/2010 3:56 PM, GaryScott wrote: > > > This is deja vu all over again...how many times does this > > happen...maybe the IVF manual should put this in 36 point font :) > > If users actually read the manual, and thought to look at the proper > section, that might help. However, this gives me an idea as part of a > "new user's FAQ" I am working on. > > Steve Lionel > Developer Products Division > Intel Corporation > Nashua, NH Does the IVF manual have a guide to porting programs or a guide to portability? [disclaimer, I'm not an IVF user.]
From: nmm1 on 30 Jul 2010 16:52
In article <8bgr7sFtqoU1(a)mid.individual.net>, Steve Lionel <steve.lionel(a)intel.invalid> wrote: >On 7/30/2010 3:56 PM, GaryScott wrote: >> This is deja vu all over again...how many times does this >> happen...maybe the IVF manual should put this in 36 point font :) > >If users actually read the manual, and thought to look at the proper >section, that might help. However, this gives me an idea as part of a >"new user's FAQ" I am working on. There is a strong negative correlation between the people who most need to read documentation and those that do so, and that has been true for as long as I have been involved. That being said, this aspect of Fortran is a particular evil "gotcha". Regards, Nick Maclaren. |