From 7d7ebeb94473a053f4f4c6cd7f31a42d9e06b639 Mon Sep 17 00:00:00 2001 From: thurston Date: Thu, 26 Mar 2009 02:07:09 +0000 Subject: [PATCH] Can't pass item->nameTarg->id into makeTargetItem. Just pass item->nameTarg and derefence it after checking generatingSectionSubset. This bug crept in during the merge of the frontend and backend and only showed up when using -V and -M and the specified machine referenced another machine that didn't exist. git-svn-id: http://svn.complang.org/ragel/trunk@766 052ea7fc-9027-0410-9066-f65837a77df0 --- ragel/xmlcodegen.cpp | 13 +++++++------ ragel/xmlcodegen.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ragel/xmlcodegen.cpp b/ragel/xmlcodegen.cpp index ed7b692..994fec7 100644 --- a/ragel/xmlcodegen.cpp +++ b/ragel/xmlcodegen.cpp @@ -464,13 +464,14 @@ void BackendGen::makeText( GenInlineList *outList, InlineItem *item ) outList->append( inlineItem ); } -void BackendGen::makeTargetItem( GenInlineList *outList, long entryId, GenInlineItem::Type type ) +void BackendGen::makeTargetItem( GenInlineList *outList, NameInst *nameTarg, + GenInlineItem::Type type ) { long targetState; if ( pd->generatingSectionSubset ) targetState = -1; else { - EntryMapEl *targ = fsm->entryPoints.find( entryId ); + EntryMapEl *targ = fsm->entryPoints.find( nameTarg->id ); targetState = targ->value->alg.stateNum; } @@ -627,19 +628,19 @@ void BackendGen::makeGenInlineList( GenInlineList *outList, InlineList *inList ) makeText( outList, item ); break; case InlineItem::Goto: - makeTargetItem( outList, item->nameTarg->id, GenInlineItem::Goto ); + makeTargetItem( outList, item->nameTarg, GenInlineItem::Goto ); break; case InlineItem::GotoExpr: makeSubList( outList, item->children, GenInlineItem::GotoExpr ); break; case InlineItem::Call: - makeTargetItem( outList, item->nameTarg->id, GenInlineItem::Call ); + makeTargetItem( outList, item->nameTarg, GenInlineItem::Call ); break; case InlineItem::CallExpr: makeSubList( outList, item->children, GenInlineItem::CallExpr ); break; case InlineItem::Next: - makeTargetItem( outList, item->nameTarg->id, GenInlineItem::Next ); + makeTargetItem( outList, item->nameTarg, GenInlineItem::Next ); break; case InlineItem::NextExpr: makeSubList( outList, item->children, GenInlineItem::NextExpr ); @@ -663,7 +664,7 @@ void BackendGen::makeGenInlineList( GenInlineList *outList, InlineList *inList ) outList->append( new GenInlineItem( InputLoc(), GenInlineItem::Targs ) ); break; case InlineItem::Entry: - makeTargetItem( outList, item->nameTarg->id, GenInlineItem::Entry ); + makeTargetItem( outList, item->nameTarg, GenInlineItem::Entry ); break; case InlineItem::Hold: diff --git a/ragel/xmlcodegen.h b/ragel/xmlcodegen.h index 16eb8e5..d20d6ea 100644 --- a/ragel/xmlcodegen.h +++ b/ragel/xmlcodegen.h @@ -157,7 +157,7 @@ private: void makeSetAct( GenInlineList *outList, long lmId ); void makeSubList( GenInlineList *outList, InlineList *inlineList, GenInlineItem::Type type ); - void makeTargetItem( GenInlineList *outList, long targetId, GenInlineItem::Type type ); + void makeTargetItem( GenInlineList *outList, NameInst *nameTarg, GenInlineItem::Type type ); void makeExecGetTokend( GenInlineList *outList ); void makeExports(); void makeMachine(); -- 2.7.4