[Prev][Next][Index]
Problem parsing NAMELIST in f2dep (with fix)
- Date: Thu, 14 Sep 95 1:21:58 EDT
- From: Mark Nelson <mnelson@eecis.udel.edu>
- To: sage-bugs@extreme.indiana.edu
- Subject: Problem parsing NAMELIST in f2dep (with fix)
- Sender: owner-sage-bugs@extreme.indiana.edu
In Sage++ 1.7 f2dep fails parsing named NAMELIST, sometimes giving a
segmentation fault (under SunOS 4). The problem is in the reduction
NAMELIST in_dcl comblock name -> namelist
found in cftn.gram.
The relevant lines look like:
namelist: NAMELIST in_dcl name
.
.
.
| NAMELIST in_dcl comblock name
{ PTR_LLND p, q, r;
PTR_SYMB s;
s = make_scalar($3, TYNULL, LOCAL);
make_scalar() expects a first argument of type PTR_HASH. But the type
returned by comblock (return value of make_common()) is PTR_SYMB.
This one-line file causes f2dep to core dump:
----------------------------cut here------------------------------
NAMELIST /EXPDEF/ NSVSN
----------------------------cut here------------------------------
Looking around for similar constructs in cftn.gram leads me to believe
that make_scalar() should really be passed the result of "name", not
"comblock", so the "$3" should really be "$4". Here is a context diff,
suitable for patch, to fix the file:
----------------------------cut here------------------------------
*** cftn.gram Thu Sep 14 00:11:21 1995
--- cftn.gram.new Thu Sep 14 00:11:22 1995
***************
*** 1377,1383 ****
{ PTR_LLND p, q, r;
PTR_SYMB s;
! s = make_scalar($3, TYNULL, LOCAL);
p = make_llnd(fi,VAR_REF, LLNULL, LLNULL, s);
q = make_llnd(fi,EXPR_LIST, p, LLNULL, SMNULL);
r = make_llnd(fi,NAMELIST_LIST, q, LLNULL, $3);
--- 1377,1383 ----
{ PTR_LLND p, q, r;
PTR_SYMB s;
! s = make_scalar($4, TYNULL, LOCAL);
p = make_llnd(fi,VAR_REF, LLNULL, LLNULL, s);
q = make_llnd(fi,EXPR_LIST, p, LLNULL, SMNULL);
r = make_llnd(fi,NAMELIST_LIST, q, LLNULL, $3);
----------------------------cut here------------------------------
Also, while rebuilding f2dep I noticed a missing dependency in
f2dep/Makefile: lex.o depends on tokdefs.h. Here is another context
diff suitable for patch to fix up the Makefile:
----------------------------cut here------------------------------
*** Makefile Thu Sep 14 00:11:42 1995
--- Makefile.new Thu Sep 14 00:11:55 1995
***************
*** 144,150 ****
$(HINCLUDE)/bif.h $(HINCLUDE)/db.h $(HINCLUDE)/ll.h $(HINCLUDE)/sets.h
init.o: inc.h $(HINCLUDE)/defs.h $(HINCLUDE)/tag $(HINCLUDE)/bif.h defines.h \
$(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/sets.h $(HINCLUDE)/db.h
! lex.o: extern.h
lists.o:defs.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/bif.h
misc.o: $(HINCLUDE)/defs.h $(HINCLUDE)/tag defines.h $(HINCLUDE)/db.h \
$(HINCLUDE)/bif.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/sets.h
--- 144,150 ----
$(HINCLUDE)/bif.h $(HINCLUDE)/db.h $(HINCLUDE)/ll.h $(HINCLUDE)/sets.h
init.o: inc.h $(HINCLUDE)/defs.h $(HINCLUDE)/tag $(HINCLUDE)/bif.h defines.h \
$(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/sets.h $(HINCLUDE)/db.h
! lex.o: extern.h tokdefs.h
lists.o:defs.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/bif.h
misc.o: $(HINCLUDE)/defs.h $(HINCLUDE)/tag defines.h $(HINCLUDE)/db.h \
$(HINCLUDE)/bif.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/sets.h
----------------------------cut here------------------------------
Ceci n'est pas une signature.
Mark Nelson mnelson@cis.udel.edu