Changeset 3657 for trunk/src/sed/lib/dfa.c
- Timestamp:
- Nov 4, 2024, 1:57:24 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sed/lib/dfa.c
r3613 r3657 1223 1223 if (backslash) 1224 1224 goto normal_char; 1225 /* kmk: cl v19.29.30139/amd64 messes this function up when optimizing 1226 for speed, workaround is to optimize it for size instead. The 1227 symptom is that the following SED expression fail to match: 1228 s/^[0-9a-fA-F]\{1,\} \(00[0-9a-fA-F]*\) ABS *notype *External *| \([^.]\{1,\}\)\.\(.*$\)/ 1=\1 2=\2 3=\3/ 1229 1230 Seems the exact problem is that it gets the indexing here wrong: 1231 dfa->lex.ptr[!(dfa->syntax.syntax_bits & RE_NO_BK_PARENS) & (dfa->lex.ptr[0] == '\\')] 1232 It forgets to do the ` dfa->lex.ptr[0] == '\\' ` part and instead 1233 ANDs with a register initialized to zero. Rewriting the 1234 expressions using the tinary operator works around the problem, 1235 although the resulting code is a lot bulkier. 1236 */ 1225 1237 if (dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_ANCHORS 1226 1238 || dfa->lex.left == 0 1239 #ifdef _MSC_VER /* see above */ 1240 || (!(dfa->syntax.syntax_bits & RE_NO_BK_PARENS) 1241 ? dfa->lex.left > 1 && dfa->lex.ptr[dfa->lex.ptr[0] == '\\'] == ')' 1242 : dfa->lex.left > 0 && dfa->lex.ptr[0] == ')') 1243 #else 1227 1244 || ((dfa->lex.left 1228 1245 > !(dfa->syntax.syntax_bits & RE_NO_BK_PARENS)) … … 1230 1247 & (dfa->lex.ptr[0] == '\\')] 1231 1248 == ')')) 1249 #endif 1250 #ifdef _MSC_VER /* see above */ 1251 || (!(dfa->syntax.syntax_bits & RE_NO_BK_VBAR) 1252 ? dfa->lex.left > 1 && dfa->lex.ptr[dfa->lex.ptr[0] == '\\'] == '|' 1253 : dfa->lex.left > 0 && dfa->lex.ptr[0] == '|') 1254 #else 1232 1255 || ((dfa->lex.left 1233 1256 > !(dfa->syntax.syntax_bits & RE_NO_BK_VBAR)) … … 1235 1258 & (dfa->lex.ptr[0] == '\\')] 1236 1259 == '|')) 1260 #endif 1237 1261 || ((dfa->syntax.syntax_bits & RE_NEWLINE_ALT) 1238 1262 && dfa->lex.left > 0 && dfa->lex.ptr[0] == '\n'))
Note:
See TracChangeset
for help on using the changeset viewer.