Namelist IOSTAT behaviour

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Sun Jun 12 13:48:00 GMT 2005


Paul Thomas wrote:
>>I only attempted to understand the "USE, ONLY" construct.
>>There is a struct gfc_use_rename that is used in gfc_match_use()
>>to build a list of symbols as they are read.   This is the
>>root of the problem with "USE, only : a => z, b => z".  By the
>>time "b => z" is parsed, z has already been renamed to a and
>>so it no longer exists.  I think you want to be around line 504
>>in module.c.
> 
> 
> OK. I was looking around there but obviously did not understand what it is
> doing.  I'll have to build the namelist for build_dt, won't I?

You have to save the namelist information to the module file alongside the
symbol, which we previously didn't.

The attached patch does this, this is straight from g95.  It works in Neilen's
testcase but I don't know the namelist stuff well enough to write reasonable
testcases.  Paul, can I defer this to you?

WRT how the symbol code works: most of it  is fairly clear once you get a few
basic ideas.  Looking at it again, I have to say that I'm sorry to say that I
don't really understand how symbol renaming works.

The basic ideas are this:
1. the relations between different data structures need tobe saved / restored.
 These relations are encoded in memory via pointers, so these pointers have to
be converted in a reliable fashion.  This is done via the fixup tables, which
basically assign a unique number to every pointer encountered when writing
module files, and which are converted back to pointers upon reading.
2. the low-level I/O routines are symmetric WRT reading and writing, that is,
the mio_* routines contain the code for both reading and writing.  This way it
is easily ensured that reading and writing modules happens consistently
3. the read_ and write_* routines ensure that everything happens in a
reasonable order

- Tobi

2005-06-12  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>

	PR fortran/22010
	Port from g95.
	* module.c (mio_namelist): New function.
	(mio_symbol): Call mio_namelist.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: namelist.diff
Type: text/x-patch
Size: 1244 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050612/ba5c9783/attachment.bin>


More information about the Fortran mailing list