SAD部屋 - Ticket-1 Diff
- Added parts are displayed like this.
- Deleted parts are displayed
like this.
! tfleval-implementation error by ''a]0[]''
:Priority:High
:Reporter:Akio Morita
:Status:Closed
:Assigned to:Akio Morita
:Version:
:Milestone:787
:Created:2006-04-14
!! Description
FFS Levelで間違った式を入力すると、''tfleval-implementation error: 22''で
インタプリタが停止してしまう
*** Welcome to SAD1.0.8.22.4b 2/1/2006 11:30:00 *** 10:28:47 Friday 04/14/2006
***
cpu time= 4.0297E-02(sec) dt= 40.297(msec) free area:: 16144
OFF LOG ECHO;READ 77 ; 23
cpu time= 4.1187E-02(sec) dt= 41.187(msec) free area:: 16144
cpu time= 4.1281E-02(sec) dt= 41.281(msec) free area:: 16143
FFS;
*** SADScript Initialization: /SAD/share/Packages/init.n ***
*** SADScript Version 1.0.8.20.5b 1/11/2005 ***
no tdr in /users/amorita/bin /sbin /usr/sbin /usr/local/bin /usr/X11R6/bin /usr/bin/X11 /usr/bin /bin
RFSW RADCOD RAD FLUC INTRA POL COD DAPER EMIOU CMPLO FOURI SMEAR
F F F T F F T F F F F T
Design orbit length = 1.
In[1]:= a]0[]
tfleval-implementation error: 22
!! Test Suite
デバッグ用スタックダンプパッチ({{attach_anchor(patch-tfeval.debug)}})
!! Attachement files
{{attach_map('Ticket-1')}}
{{attach_form('','')}}//{{attach_form('','')}}
!! Changelog
!!!Akio Morita (2007-10-17 (水) 01:29:40)
Revision 785で追試したら core dumpになる
% /SAD/bin/gs FFS
*** Welcome to SAD Revision 785 built at 2007-10-15 12:39:56 CEST ***
lminit: rlist0=0x7acb910 align=8 bits=29 offset=0
cpu time= 0.1139 (sec) dt= 113.877(msec) free area:: 3129100
FFS ; 6
*** SADScript Initialization: /SAD/share/Packages/init.n ***
tdr: コマンドが見つかりません
RFSW RADCOD RAD FLUC INTRA POL COD DAPER EMIOU CMPLO FOURI SMEAR
F F F T F F T F F F F T
Design orbit length = 1.
In[1]:= a]0[]
セグメントエラー(coreを出力しました)
!!!Akio Morita (2007-10-17 (水) 01:32:29)
Backtraceはこんな感じ
#0 itfcrelistm_ (m=0xbfb93348, is=0x9f0d018, vs=0xae4f418, ith=0xbfb933cc,
iah=0xbfb933d0)
at /export/home/amorita/src/compile/sad/current/src/tfsetlist.f:628
628 if(ilist(1,ip) .le. 0)then
(gdb) p *m
\$1 = 0
Current language: auto; currently fortran
(gdb) up
#1 0x0808bf6b in tfcomposefull_ (isp1=0xbfb933c8, ith=0xbfb933cc,
iah=0xbfb933d0, itx=0xbfb933b8, iax=0xbfb933bc, vx=0xbfb933c0,
irtc=0xbfbe35c0)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:849
849 10 iax=itfcrelistm(isp-isp1,itastk(1,isp1+1),
(gdb) p isp
\$2 = 4752096
(gdb) p *isp1
\$3 = 4752096
(gdb) bt
#0 itfcrelistm_ (m=0xbfb93348, is=0x9f0d018, vs=0xae4f418, ith=0xbfb933cc,
iah=0xbfb933d0)
at /export/home/amorita/src/compile/sad/current/src/tfsetlist.f:628
#1 0x0808bf6b in tfcomposefull_ (isp1=0xbfb933c8, ith=0xbfb933cc,
iah=0xbfb933d0, itx=0xbfb933b8, iax=0xbfb933bc, vx=0xbfb933c0,
irtc=0xbfbe35c0)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:849
#2 0x0808b05c in tfestk_ (isp0=0xbfb93440, iprior=0x8228620,
lastfirst=0x8228860, irtc=0xbfbe35c0)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:530
#3 0x08089c3c in tfeval_ (string=0x9ed5044, l=0x9ed5040, ist1=0x9ed4fc0,
istop=0xbfbe35b8, itx=0xbfbe35bc, iax=0xbfbe3634, re=0x8210714,
irtc=0xbfbe35c0, __g77_length_string=7)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:178
#4 0x081286ac in itfgeto_ (ira=0xbfbe3634, v=0xbfbe3638)
at /export/home/amorita/src/compile/sad/current/src/itfgeto.f:14
#5 0x0812876d in itfpeeko_ (ira=0xbfbe3634, v=0xbfbe3638, next=0x869d910)
at /export/home/amorita/src/compile/sad/current/src/itfgeto.f:40
#6 0x080c4fb8 in tfprint_ (word=0xbfbfd8a0, lfno=0x9ed4fd4, force=0x8211228,
itx=0xbfbe3b80, next=0xbfbe3b84, exist=0x827e71c, __g77_length_word=255)
at /export/home/amorita/src/compile/sad/current/src/tfprint.f:18
#7 0x080948e3 in tffsa_ (lfnb=0x8210714, itffs=0xbfbfd9f0, iaffs=0xbfbfd9f4,
vffs=0xbfbfd9f8, irtcffs=0xbfbfda04)
at /export/home/amorita/src/compile/sad/current/src/tffsa.f:721
#8 0x0809302c in tffs_ ()
at /export/home/amorita/src/compile/sad/current/src/tffs.f:9
#9 0x080ed8eb in track_ (latt=0x16, iparam=0xbfbfdbd0)
at /export/home/amorita/src/compile/sad/current/src/track.f:140
#10 0x08106f9f in acttra_ (argp=0x0)
at /export/home/amorita/src/compile/sad/current/src/ActTra.f:269
#11 0x0806d836 in funcall1_ (func=0x16, arg1=0xbfbfde00)
at /export/home/amorita/src/compile/sad/current/src/sim/unix_pointer_.c:43
#12 0x0811208b in doact_ (cmdidx=0xbfbfe144)
at /export/home/amorita/src/compile/sad/current/src/doACT.f:206
#13 0x080ebfde in __g77_masterfun_toplvl (__g77_which_entrypoint=0,
jtoken=0x0, jslen=0x16, jttype=0x16, jrval=0x16, jival=0x16,
__g77_length_jtoken=0)
at /export/home/amorita/src/compile/sad/current/src/toplvl.f:40
#14 0x080ec331 in toplvl_ ()
at /export/home/amorita/src/compile/sad/current/src/toplvl.f:2
#15 0x0805bb1d in MAIN__ () at MAIN_VERSION.f:53
#16 0x884f0c8f in main () from /usr/lib/libg2c.so.2
#17 0x0805b881 in _start ()
#18 0x00000002 in ?? ()
!!!Akio Morita (2007-10-17 (水) 19:10:58)
tfeval/tfestk突入直後の stack dumpをとってみる
In[1]:= a]0[]
Enter tfeval isp0= 4752355 isp= 4752355 istart= 2 istop= 3 l= 7
string(istart:l)="a]0[]\\n"
tfetok -> itt= 201 ia= 4426135 x= 0.
stk[ 4752355] -> jtastk= 0/ 0/ 0/ 0 itastk= 0/ 0
Enter tfeval isp0= 4752355 isp= 4752355 istart= 3 istop= 4 l= 7
string(istart:l)="]0[]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752355] -> jtastk= 0/ 201/ -30313/ 67 itastk= 13172736/ 4426135
Enter tfeval isp0= 4752355 isp= 4752356 istart= 4 istop= 5 l= 7
string(istart:l)="0[]\\n"
tfetok -> itt= 1 ia= 22 x= 0.
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 0/ 0/ 0/ 0 itastk= 0/ 0
Enter tfeval isp0= 4752355 isp= 4752356 istart= 5 istop= 6 l= 7
string(istart:l)="[]\\n"
tfetok -> itt= -1 ia= 21 x= 0.
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 0/ 1/ 22/ 0 itastk= 65536/ 22
Enter tfestk isp0= 4752355 isp= 4752356
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 21/ 1/ 22/ 0 itastk= 65557/ 22
Enter tfeval isp0= 4752355 isp= 4752357 istart= 6 istop= 7 l= 7
string(istart:l)="]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 21/ 1/ 22/ 0 itastk= 65557/ 22
stk[ 4752357] -> jtastk= 0/ 0/ 0/ 0 itastk= 0/ 0
Enter tfestk isp0= 4752355 isp= 4752357
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 21/ 1/ 22/ 0 itastk= 65557/ 22
stk[ 4752357] -> jtastk= 22/ 0/ 0/ 0 itastk= 22/ 0
セグメントエラー(coreを出力しました)
!!!Akio Morita (2007-10-17 (水) 19:54:22)
Core Dumpする件だが、どうやら tfsetlist.f:624からのコードで
ith = 1(ntfreal)な時は iahが不定(allocateされていない)なのに
ip=iah-2な領域を参照するのげ原因のようである
tfsetlist.f:626のif文を
-if(ith .ne. ntfoper)then
+if(ith .ne. ntfoper .and. ith .ne. ntfreal)then
で Core Dumpは直って'''tfleval-implementation error: 22'''に戻る
!!!Akio Morita (2007-10-17 (水) 20:02:45)
しかし、ith = ntfreal(1)で iah = 22(mtfleftbra)に成ってるのがどうも妖しい... tfeval()の再調査が必要か?
!!!Akio Morita (2007-10-17 (水) 20:32:00)
Core Dump修正は、念のために tfetok側も直しておく
{{attach_anchor(patch-tfsetlist&tfetok)}}
!!!Akio Morita (2007-10-17 (水) 21:41:26)
もっと短い入力式でエラーに出来る
In[1]:= a]2
Enter tfeval isp0= 4752775 isp= 4752775 istart= 2 istop= 3 l= 5 re= T
string(istart:l)="a]2\\n"
tfetok -> itt= 201 ia= 4426099 x= 0.
stk[ 4752775] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfeval isp0= 4752775 isp= 4752775 istart= 3 istop= 4 l= 5 re= T
string(istart:l)="]2\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 0/ 201/ -30349/ 67 ita= 13172736/ 4426099 v= 0.
Enter tfeval isp0= 4752775 isp= 4752776 istart= 4 istop= 5 l= 5 re= T
string(istart:l)="2\\n"
tfetok -> itt= 1 ia= 0 x= 2.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfeval isp0= 4752775 isp= 4752776 istart= 5 istop= 6 l= 5 re= T
string(istart:l)="\\n"
tfetok -> itt= -2 ia= 0 x= 2.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 1/ 0/ 0 ita= 65536/ 0 v= 2.
Enter tfestk isp0= 4752775 isp= 4752776
stk[ 4752775] jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] jta= 66/ 1/ 0/ 0 ita= 65602/ 0 v= 2.
Enter 7000@tfeval isp0= 4752775 isp= 4752775
stk[ 4752775] -> jta= 66/ 3/ -26629/ 67 ita= 196674/ 4429819 v=
-1.22154846E-268
Breakpoint 1, tfseval_ (is=0x9c983b0, ivs=0x9c983b4, ns=0x9c983a4, ith=0x17,
iah=0x17, iaa=0xbfb933d8, itx=0xbfbe35cc, iax=0xbfbe3644, vx=0xbfb93440,
ref=0x8211094, irtc=0xbfbe35d0)
at /export/home/amorita/src/compile/sad/current/src/tfeeval.f:256
256 1900 write(*,*)'tfleval-implementation error: ',iaf
(gdb) up
#1 0x08077c0d in tfleval_ (ia=0x0, itx=0xbfbe35cc, iax=0xbfbe3644,
vx=0xbfb93440, ref=0x8211094, irtc=0xbfbe35d0)
at /export/home/amorita/src/compile/sad/current/src/tfeeval.f:77
77 call tfseval(ilist(1,iaa+1),ilist(2,iaa+1),ilist(2,iaa-1),
(gdb) up
#2 0x0808ac6c in tfeval_ (string=0x9ed5b04, l=0x9ed5b00, ist1=0x9ed5a80,
istop=0xbfbe35c8, itx=0xbfbe35cc, iax=0xbfbe3644, re=0x8211094,
irtc=0xbfbe35d0, __g77_length_string=5)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:376
376 call tfleval(itastk(2,isp),itx,iax,vx,.true.,irtc)
(gdb) up
#3 0x0812902c in itfgeto_ (ira=0xbfbe3644, v=0xbfbe3648)
at /export/home/amorita/src/compile/sad/current/src/itfgeto.f:14
14 v=tfeval(buffer(1:lrecl),lrecl,ipoint,m,irtype,ira,.true.,irtc)
!!!Akio Morita (2007-10-17 (水) 21:54:41)
正しく、文法エラーでプロンプトに戻る場合
In[1]:= a]]
Enter tfeval isp0= 4752775 isp= 4752775 istart= 2 istop= 3 l= 5 re= T
string(istart:l)="a]]\\n"
tfetok -> itt= 201 ia= 4426099 x= 0.
stk[ 4752775] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfeval isp0= 4752775 isp= 4752775 istart= 3 istop= 4 l= 5 re= T
string(istart:l)="]]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 0/ 201/ -30349/ 67 ita= 13172736/ 4426099 v= 0.
Enter tfeval isp0= 4752775 isp= 4752776 istart= 4 istop= 5 l= 5 re= T
string(istart:l)="]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfestk isp0= 4752775 isp= 4752776
stk[ 4752775] jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] jta= 22/ 0/ 0/ 0 ita= 22/ 0 v= -1.22154846E-268
???General::mismatch: Mismatched (), {}, []:
a]]
^
カッコが少ないと、入力待ちになる(たぶん、''']]'''で Part演算子が閉じる可能性を待っている
In[1]:= a]
Enter tfeval isp0= 4752775 isp= 4752775 istart= 2 istop= 3 l= 4 re= T
string(istart:l)="a]\\n"
tfetok -> itt= 201 ia= 4426099 x= 0.
stk[ 4752775] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfeval isp0= 4752775 isp= 4752775 istart= 3 istop= 4 l= 4 re= T
string(istart:l)="]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 0/ 201/ -30349/ 67 ita= 13172736/ 4426099 v= 0.
Enter tfeval isp0= 4752775 isp= 4752776 istart= 4 istop= 5 l= 4 re= T
string(istart:l)="\\n"
tfetok -> itt= -2 ia= 22 x= 0.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
...]
'''a]['''だと、文法エラーでプロンプトに戻る
In[1]:= a][
Enter tfeval isp0= 4752775 isp= 4752775 istart= 2 istop= 3 l= 5 re= T
string(istart:l)="a][\\n"
tfetok -> itt= 201 ia= 4426099 x= 0.
stk[ 4752775] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= 0.
Enter tfeval isp0= 4752775 isp= 4752775 istart= 3 istop= 4 l= 5 re= T
string(istart:l)="][\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 0/ 201/ -30349/ 67 ita= 13172736/ 4426099 v= 0.
Enter tfeval isp0= 4752775 isp= 4752776 istart= 4 istop= 5 l= 5 re= T
string(istart:l)="[\\n"
tfetok -> itt= -1 ia= 21 x= 0.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
???General::mismatch: Mismatched (), {}, []:
a][
^
つまり、a]0で '''mtfrightbra'''に演算子以外の要素が
続いているときに、mtfleftbraが無いことを検知して
構文エラーに出来ない tfeval()/tfestk()レベルのパーサーのバグ
!!!Akio Morita (2007-10-17 (水) 22:55:55)
とりあえず、スタック上に '''(''', '''{''', '''[''','''[['''が存在しないときのみ
呼び出されるtfestk()の直前で ''')''','''}''',''']'''の存在を検査し、
存在する場合は''General::mismatch''にする
''')''','''}''',''']'''でのみで成り立つ構文は無いはずなので
副作用は無いはず
もっとも、文法的には ''')''','''}''',''']'''をスタックに積む段階で
対応する'''(''','''{''','''[''','''[['''の存在を検査する方がより早く
文法エラーを検知できるはずなのだが...
構文解析器読むの疲れた Orz
{{its_edit_ticket_form}}//{{its_edit_ticket_form}}
:Priority:High
:Reporter:Akio Morita
:Status:Closed
:Assigned to:Akio Morita
:Version:
:Milestone:787
:Created:2006-04-14
!! Description
FFS Levelで間違った式を入力すると、''tfleval-implementation error: 22''で
インタプリタが停止してしまう
*** Welcome to SAD1.0.8.22.4b 2/1/2006 11:30:00 *** 10:28:47 Friday 04/14/2006
***
cpu time= 4.0297E-02(sec) dt= 40.297(msec) free area:: 16144
OFF LOG ECHO;READ 77 ; 23
cpu time= 4.1187E-02(sec) dt= 41.187(msec) free area:: 16144
cpu time= 4.1281E-02(sec) dt= 41.281(msec) free area:: 16143
FFS;
*** SADScript Initialization: /SAD/share/Packages/init.n ***
*** SADScript Version 1.0.8.20.5b 1/11/2005 ***
no tdr in /users/amorita/bin /sbin /usr/sbin /usr/local/bin /usr/X11R6/bin /usr/bin/X11 /usr/bin /bin
RFSW RADCOD RAD FLUC INTRA POL COD DAPER EMIOU CMPLO FOURI SMEAR
F F F T F F T F F F F T
Design orbit length = 1.
In[1]:= a]0[]
tfleval-implementation error: 22
!! Test Suite
デバッグ用スタックダンプパッチ({{attach_anchor(patch-tfeval.debug)}})
!! Attachement files
{{attach_map('Ticket-1')}}
!! Changelog
!!!Akio Morita (2007-10-17 (水) 01:29:40)
Revision 785で追試したら core dumpになる
% /SAD/bin/gs FFS
*** Welcome to SAD Revision 785 built at 2007-10-15 12:39:56 CEST ***
lminit: rlist0=0x7acb910 align=8 bits=29 offset=0
cpu time= 0.1139 (sec) dt= 113.877(msec) free area:: 3129100
FFS ; 6
*** SADScript Initialization: /SAD/share/Packages/init.n ***
tdr: コマンドが見つかりません
RFSW RADCOD RAD FLUC INTRA POL COD DAPER EMIOU CMPLO FOURI SMEAR
F F F T F F T F F F F T
Design orbit length = 1.
In[1]:= a]0[]
セグメントエラー(coreを出力しました)
!!!Akio Morita (2007-10-17 (水) 01:32:29)
Backtraceはこんな感じ
#0 itfcrelistm_ (m=0xbfb93348, is=0x9f0d018, vs=0xae4f418, ith=0xbfb933cc,
iah=0xbfb933d0)
at /export/home/amorita/src/compile/sad/current/src/tfsetlist.f:628
628 if(ilist(1,ip) .le. 0)then
(gdb) p *m
\$1 = 0
Current language: auto; currently fortran
(gdb) up
#1 0x0808bf6b in tfcomposefull_ (isp1=0xbfb933c8, ith=0xbfb933cc,
iah=0xbfb933d0, itx=0xbfb933b8, iax=0xbfb933bc, vx=0xbfb933c0,
irtc=0xbfbe35c0)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:849
849 10 iax=itfcrelistm(isp-isp1,itastk(1,isp1+1),
(gdb) p isp
\$2 = 4752096
(gdb) p *isp1
\$3 = 4752096
(gdb) bt
#0 itfcrelistm_ (m=0xbfb93348, is=0x9f0d018, vs=0xae4f418, ith=0xbfb933cc,
iah=0xbfb933d0)
at /export/home/amorita/src/compile/sad/current/src/tfsetlist.f:628
#1 0x0808bf6b in tfcomposefull_ (isp1=0xbfb933c8, ith=0xbfb933cc,
iah=0xbfb933d0, itx=0xbfb933b8, iax=0xbfb933bc, vx=0xbfb933c0,
irtc=0xbfbe35c0)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:849
#2 0x0808b05c in tfestk_ (isp0=0xbfb93440, iprior=0x8228620,
lastfirst=0x8228860, irtc=0xbfbe35c0)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:530
#3 0x08089c3c in tfeval_ (string=0x9ed5044, l=0x9ed5040, ist1=0x9ed4fc0,
istop=0xbfbe35b8, itx=0xbfbe35bc, iax=0xbfbe3634, re=0x8210714,
irtc=0xbfbe35c0, __g77_length_string=7)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:178
#4 0x081286ac in itfgeto_ (ira=0xbfbe3634, v=0xbfbe3638)
at /export/home/amorita/src/compile/sad/current/src/itfgeto.f:14
#5 0x0812876d in itfpeeko_ (ira=0xbfbe3634, v=0xbfbe3638, next=0x869d910)
at /export/home/amorita/src/compile/sad/current/src/itfgeto.f:40
#6 0x080c4fb8 in tfprint_ (word=0xbfbfd8a0, lfno=0x9ed4fd4, force=0x8211228,
itx=0xbfbe3b80, next=0xbfbe3b84, exist=0x827e71c, __g77_length_word=255)
at /export/home/amorita/src/compile/sad/current/src/tfprint.f:18
#7 0x080948e3 in tffsa_ (lfnb=0x8210714, itffs=0xbfbfd9f0, iaffs=0xbfbfd9f4,
vffs=0xbfbfd9f8, irtcffs=0xbfbfda04)
at /export/home/amorita/src/compile/sad/current/src/tffsa.f:721
#8 0x0809302c in tffs_ ()
at /export/home/amorita/src/compile/sad/current/src/tffs.f:9
#9 0x080ed8eb in track_ (latt=0x16, iparam=0xbfbfdbd0)
at /export/home/amorita/src/compile/sad/current/src/track.f:140
#10 0x08106f9f in acttra_ (argp=0x0)
at /export/home/amorita/src/compile/sad/current/src/ActTra.f:269
#11 0x0806d836 in funcall1_ (func=0x16, arg1=0xbfbfde00)
at /export/home/amorita/src/compile/sad/current/src/sim/unix_pointer_.c:43
#12 0x0811208b in doact_ (cmdidx=0xbfbfe144)
at /export/home/amorita/src/compile/sad/current/src/doACT.f:206
#13 0x080ebfde in __g77_masterfun_toplvl (__g77_which_entrypoint=0,
jtoken=0x0, jslen=0x16, jttype=0x16, jrval=0x16, jival=0x16,
__g77_length_jtoken=0)
at /export/home/amorita/src/compile/sad/current/src/toplvl.f:40
#14 0x080ec331 in toplvl_ ()
at /export/home/amorita/src/compile/sad/current/src/toplvl.f:2
#15 0x0805bb1d in MAIN__ () at MAIN_VERSION.f:53
#16 0x884f0c8f in main () from /usr/lib/libg2c.so.2
#17 0x0805b881 in _start ()
#18 0x00000002 in ?? ()
!!!Akio Morita (2007-10-17 (水) 19:10:58)
tfeval/tfestk突入直後の stack dumpをとってみる
In[1]:= a]0[]
Enter tfeval isp0= 4752355 isp= 4752355 istart= 2 istop= 3 l= 7
string(istart:l)="a]0[]\\n"
tfetok -> itt= 201 ia= 4426135 x= 0.
stk[ 4752355] -> jtastk= 0/ 0/ 0/ 0 itastk= 0/ 0
Enter tfeval isp0= 4752355 isp= 4752355 istart= 3 istop= 4 l= 7
string(istart:l)="]0[]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752355] -> jtastk= 0/ 201/ -30313/ 67 itastk= 13172736/ 4426135
Enter tfeval isp0= 4752355 isp= 4752356 istart= 4 istop= 5 l= 7
string(istart:l)="0[]\\n"
tfetok -> itt= 1 ia= 22 x= 0.
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 0/ 0/ 0/ 0 itastk= 0/ 0
Enter tfeval isp0= 4752355 isp= 4752356 istart= 5 istop= 6 l= 7
string(istart:l)="[]\\n"
tfetok -> itt= -1 ia= 21 x= 0.
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 0/ 1/ 22/ 0 itastk= 65536/ 22
Enter tfestk isp0= 4752355 isp= 4752356
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 21/ 1/ 22/ 0 itastk= 65557/ 22
Enter tfeval isp0= 4752355 isp= 4752357 istart= 6 istop= 7 l= 7
string(istart:l)="]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 21/ 1/ 22/ 0 itastk= 65557/ 22
stk[ 4752357] -> jtastk= 0/ 0/ 0/ 0 itastk= 0/ 0
Enter tfestk isp0= 4752355 isp= 4752357
stk[ 4752355] -> jtastk= 22/ 201/ -30313/ 67 itastk= 13172758/ 4426135
stk[ 4752356] -> jtastk= 21/ 1/ 22/ 0 itastk= 65557/ 22
stk[ 4752357] -> jtastk= 22/ 0/ 0/ 0 itastk= 22/ 0
セグメントエラー(coreを出力しました)
!!!Akio Morita (2007-10-17 (水) 19:54:22)
Core Dumpする件だが、どうやら tfsetlist.f:624からのコードで
ith = 1(ntfreal)な時は iahが不定(allocateされていない)なのに
ip=iah-2な領域を参照するのげ原因のようである
tfsetlist.f:626のif文を
-if(ith .ne. ntfoper)then
+if(ith .ne. ntfoper .and. ith .ne. ntfreal)then
で Core Dumpは直って'''tfleval-implementation error: 22'''に戻る
!!!Akio Morita (2007-10-17 (水) 20:02:45)
しかし、ith = ntfreal(1)で iah = 22(mtfleftbra)に成ってるのがどうも妖しい... tfeval()の再調査が必要か?
!!!Akio Morita (2007-10-17 (水) 20:32:00)
Core Dump修正は、念のために tfetok側も直しておく
{{attach_anchor(patch-tfsetlist&tfetok)}}
!!!Akio Morita (2007-10-17 (水) 21:41:26)
もっと短い入力式でエラーに出来る
In[1]:= a]2
Enter tfeval isp0= 4752775 isp= 4752775 istart= 2 istop= 3 l= 5 re= T
string(istart:l)="a]2\\n"
tfetok -> itt= 201 ia= 4426099 x= 0.
stk[ 4752775] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfeval isp0= 4752775 isp= 4752775 istart= 3 istop= 4 l= 5 re= T
string(istart:l)="]2\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 0/ 201/ -30349/ 67 ita= 13172736/ 4426099 v= 0.
Enter tfeval isp0= 4752775 isp= 4752776 istart= 4 istop= 5 l= 5 re= T
string(istart:l)="2\\n"
tfetok -> itt= 1 ia= 0 x= 2.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfeval isp0= 4752775 isp= 4752776 istart= 5 istop= 6 l= 5 re= T
string(istart:l)="\\n"
tfetok -> itt= -2 ia= 0 x= 2.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 1/ 0/ 0 ita= 65536/ 0 v= 2.
Enter tfestk isp0= 4752775 isp= 4752776
stk[ 4752775] jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] jta= 66/ 1/ 0/ 0 ita= 65602/ 0 v= 2.
Enter 7000@tfeval isp0= 4752775 isp= 4752775
stk[ 4752775] -> jta= 66/ 3/ -26629/ 67 ita= 196674/ 4429819 v=
-1.22154846E-268
Breakpoint 1, tfseval_ (is=0x9c983b0, ivs=0x9c983b4, ns=0x9c983a4, ith=0x17,
iah=0x17, iaa=0xbfb933d8, itx=0xbfbe35cc, iax=0xbfbe3644, vx=0xbfb93440,
ref=0x8211094, irtc=0xbfbe35d0)
at /export/home/amorita/src/compile/sad/current/src/tfeeval.f:256
256 1900 write(*,*)'tfleval-implementation error: ',iaf
(gdb) up
#1 0x08077c0d in tfleval_ (ia=0x0, itx=0xbfbe35cc, iax=0xbfbe3644,
vx=0xbfb93440, ref=0x8211094, irtc=0xbfbe35d0)
at /export/home/amorita/src/compile/sad/current/src/tfeeval.f:77
77 call tfseval(ilist(1,iaa+1),ilist(2,iaa+1),ilist(2,iaa-1),
(gdb) up
#2 0x0808ac6c in tfeval_ (string=0x9ed5b04, l=0x9ed5b00, ist1=0x9ed5a80,
istop=0xbfbe35c8, itx=0xbfbe35cc, iax=0xbfbe3644, re=0x8211094,
irtc=0xbfbe35d0, __g77_length_string=5)
at /export/home/amorita/src/compile/sad/current/src/tfeval.f:376
376 call tfleval(itastk(2,isp),itx,iax,vx,.true.,irtc)
(gdb) up
#3 0x0812902c in itfgeto_ (ira=0xbfbe3644, v=0xbfbe3648)
at /export/home/amorita/src/compile/sad/current/src/itfgeto.f:14
14 v=tfeval(buffer(1:lrecl),lrecl,ipoint,m,irtype,ira,.true.,irtc)
!!!Akio Morita (2007-10-17 (水) 21:54:41)
正しく、文法エラーでプロンプトに戻る場合
In[1]:= a]]
Enter tfeval isp0= 4752775 isp= 4752775 istart= 2 istop= 3 l= 5 re= T
string(istart:l)="a]]\\n"
tfetok -> itt= 201 ia= 4426099 x= 0.
stk[ 4752775] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfeval isp0= 4752775 isp= 4752775 istart= 3 istop= 4 l= 5 re= T
string(istart:l)="]]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 0/ 201/ -30349/ 67 ita= 13172736/ 4426099 v= 0.
Enter tfeval isp0= 4752775 isp= 4752776 istart= 4 istop= 5 l= 5 re= T
string(istart:l)="]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfestk isp0= 4752775 isp= 4752776
stk[ 4752775] jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] jta= 22/ 0/ 0/ 0 ita= 22/ 0 v= -1.22154846E-268
???General::mismatch: Mismatched (), {}, []:
a]]
^
カッコが少ないと、入力待ちになる(たぶん、''']]'''で Part演算子が閉じる可能性を待っている
In[1]:= a]
Enter tfeval isp0= 4752775 isp= 4752775 istart= 2 istop= 3 l= 4 re= T
string(istart:l)="a]\\n"
tfetok -> itt= 201 ia= 4426099 x= 0.
stk[ 4752775] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
Enter tfeval isp0= 4752775 isp= 4752775 istart= 3 istop= 4 l= 4 re= T
string(istart:l)="]\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 0/ 201/ -30349/ 67 ita= 13172736/ 4426099 v= 0.
Enter tfeval isp0= 4752775 isp= 4752776 istart= 4 istop= 5 l= 4 re= T
string(istart:l)="\\n"
tfetok -> itt= -2 ia= 22 x= 0.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
...]
'''a]['''だと、文法エラーでプロンプトに戻る
In[1]:= a][
Enter tfeval isp0= 4752775 isp= 4752775 istart= 2 istop= 3 l= 5 re= T
string(istart:l)="a][\\n"
tfetok -> itt= 201 ia= 4426099 x= 0.
stk[ 4752775] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= 0.
Enter tfeval isp0= 4752775 isp= 4752775 istart= 3 istop= 4 l= 5 re= T
string(istart:l)="][\\n"
tfetok -> itt= -1 ia= 22 x= 0.
stk[ 4752775] -> jta= 0/ 201/ -30349/ 67 ita= 13172736/ 4426099 v= 0.
Enter tfeval isp0= 4752775 isp= 4752776 istart= 4 istop= 5 l= 5 re= T
string(istart:l)="[\\n"
tfetok -> itt= -1 ia= 21 x= 0.
stk[ 4752775] -> jta= 22/ 201/ -30349/ 67 ita= 13172758/ 4426099 v= 0.
stk[ 4752776] -> jta= 0/ 0/ 0/ 0 ita= 0/ 0 v= -1.22154846E-268
???General::mismatch: Mismatched (), {}, []:
a][
^
つまり、a]0で '''mtfrightbra'''に演算子以外の要素が
続いているときに、mtfleftbraが無いことを検知して
構文エラーに出来ない tfeval()/tfestk()レベルのパーサーのバグ
!!!Akio Morita (2007-10-17 (水) 22:55:55)
とりあえず、スタック上に '''(''', '''{''', '''[''','''[['''が存在しないときのみ
呼び出されるtfestk()の直前で ''')''','''}''',''']'''の存在を検査し、
存在する場合は''General::mismatch''にする
''')''','''}''',''']'''でのみで成り立つ構文は無いはずなので
副作用は無いはず
もっとも、文法的には ''')''','''}''',''']'''をスタックに積む段階で
対応する'''(''','''{''','''[''','''[['''の存在を検査する方がより早く
文法エラーを検知できるはずなのだが...
構文解析器読むの疲れた Orz