diff options
author | Adrian Thurston <thurston@complang.org> | 2010-09-19 17:52:59 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2010-09-19 17:52:59 +0000 |
commit | 209e21a26af2c41b8cf071c97e9c6eaee8839f3b (patch) | |
tree | 3aaf21468cf36a5e7b335eb804c09ec58e922811 /ragel | |
parent | 5cfb7382a1958a15b8d1bfa3cd39e4f9c794e6f7 (diff) | |
download | ragel-209e21a26af2c41b8cf071c97e9c6eaee8839f3b.tar.gz |
The _acts and _nacts variables are scalars that are used as idicies into
arrays. They shouldn't have a type determined by the size of the values in the
arrays, they should just be big enough (int). In C/C++ these are pointers, so
the type needs to be computed. Here just indicies.
Fixes bug reported by Attila Sztupák in Jan 2010.
Diffstat (limited to 'ragel')
-rw-r--r-- | ragel/csflat.cpp | 6 | ||||
-rw-r--r-- | ragel/csflat.h | 2 | ||||
-rw-r--r-- | ragel/cstable.cpp | 10 | ||||
-rw-r--r-- | ragel/cstable.h | 2 | ||||
-rw-r--r-- | ragel/fsmap.cpp | 1 |
5 files changed, 7 insertions, 14 deletions
diff --git a/ragel/csflat.cpp b/ragel/csflat.cpp index 37628397..0ea4bbd9 100644 --- a/ragel/csflat.cpp +++ b/ragel/csflat.cpp @@ -716,8 +716,8 @@ void CSharpFlatCodeGen::writeExec() redFsm->anyRegActions() || redFsm->anyFromStateActions() ) { out << - " " << actsType << " _acts;\n" - " " << nactsType << " _nacts;\n"; + " int _acts;\n" + " int _nacts;\n"; } out << @@ -877,8 +877,6 @@ void CSharpFlatCodeGen::initVarTypes() { slenType = ARRAY_TYPE(MAX(redFsm->maxSpan, redFsm->maxCondSpan)); transType = ARRAY_TYPE(redFsm->maxIndex+1); - actsType = ARRAY_TYPE(redFsm->maxActionLoc); - nactsType = ARRAY_TYPE(redFsm->maxActArrItem); indsType = ARRAY_TYPE(redFsm->maxFlatIndexOffset); condsType = ARRAY_TYPE(redFsm->maxCondIndexOffset); } diff --git a/ragel/csflat.h b/ragel/csflat.h index 9f55f618..a576cd95 100644 --- a/ragel/csflat.h +++ b/ragel/csflat.h @@ -85,7 +85,7 @@ protected: virtual void writeExec(); void initVarTypes(); - string slenType, transType, actsType, nactsType, indsType, condsType; + string slenType, transType, indsType, condsType; }; #endif diff --git a/ragel/cstable.cpp b/ragel/cstable.cpp index cde4ba90..cb3dd746 100644 --- a/ragel/cstable.cpp +++ b/ragel/cstable.cpp @@ -949,8 +949,8 @@ void CSharpTabCodeGen::writeExec() || redFsm->anyFromStateActions() ) { out << - " " << actsType << " _acts;\n" - " " << nactsType << " _nacts;\n"; + " int _acts;\n" + " int _nacts;\n"; } out << @@ -1077,9 +1077,9 @@ void CSharpTabCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << - " " << actsType << " __acts = " << + " int __acts = " << EA() << "[" << vCS() << "]" << ";\n" - " " << nactsType << " __nacts = " << + " int __nacts = " << A() << "[__acts++];\n" " while ( __nacts-- > 0 ) {\n" " switch ( " << A() << "[__acts++] ) {\n"; @@ -1112,6 +1112,4 @@ void CSharpTabCodeGen::initVarTypes() klenType = ARRAY_TYPE(klenMax); keysType = ARRAY_TYPE(keysMax); signedKeysType = ARRAY_TYPE(keysMax, true); - actsType = ARRAY_TYPE(redFsm->maxActionLoc); - nactsType = ARRAY_TYPE(redFsm->maxActArrItem); } diff --git a/ragel/cstable.h b/ragel/cstable.h index 623f6700..a8206fc9 100644 --- a/ragel/cstable.h +++ b/ragel/cstable.h @@ -95,8 +95,6 @@ protected: string keysType; string signedKeysType; string transType; - string actsType; - string nactsType; }; #endif diff --git a/ragel/fsmap.cpp b/ragel/fsmap.cpp index 12d9e566..0a987998 100644 --- a/ragel/fsmap.cpp +++ b/ragel/fsmap.cpp @@ -827,7 +827,6 @@ bool FsmAp::hasOutData( StateAp *state ) * Setting Conditions. */ - void logNewExpansion( Expansion *exp ); void logCondSpace( CondSpace *condSpace ); |