UPDATE: bug was seemingly fixed by adding an invariant condition to the merge function with excludes subparsers with the error action. Further testing is needed before closing this.
The error occurs on the following code snippet:
#ifdef A
typedef int a;
#endif
#ifdef B
typedef int b;
#endif
#ifdef C
typedef int c;
#endif
struct y
{
#ifndef A
a i;
b j;
#endif
#ifdef B
c k;
#endif
};
int main()
{
#ifdef B
int d = 2;
#else
int d = 2;
#endif
return 0;
}
What we see is that the parser forks on #ifdef C, and then does not merge on struct. From here we see the !defined C branch fork as follows:
forked 1 into 3 parsers
(!(defined C), (#if !(defined A)
, REDUCE, 179, 22, !(defined C)):[(}, SHIFT, 623, 0, (defined A) && !(defined B) && !(defined C)), (a, ERROR, 0, 22, !(defined A) && !(defined C)), (c, ERROR, 0, 30, (defined A) && (defined B) && !(defined C))])
--into--
(!(defined A) && !(defined C), (a, ERROR, 0, 22, !(defined A) && !(defined C)))
((defined A) && (defined B) && !(defined C), (c, ERROR, 0, 30, (defined A) && (defined B) && !(defined C)))
((defined A) && !(defined B) && !(defined C), (}, SHIFT, 623, 0, (defined A) && !(defined B) && !(defined C)))
However we see the defined C branch for as this:
forked 1 into 2 parsers
((defined C), (#if !(defined A)
, REDUCE, 179, 22, (defined C)):[(}, SHIFT, 623, 0, (defined A) && !(defined B) && (defined C)), (a, ERROR, 0, 22, !(defined A) && (defined C)), (c, SHIFT, 24, 0, (defined A) && (defined B) && (defined C))])
--into--
(!(defined A) && (defined C), (a, ERROR, 0, 22, !(defined A) && (defined C)))
((defined A) && (defined C), (#if !(defined A)
, SHIFT, 623, 22, (defined A) && (defined C)):[(}, SHIFT, 623, 0, (defined A) && !(defined B) && (defined C)), (c, SHIFT, 24, 0, (defined A) && (defined B) && (defined C))])
What's interesting here is that the second branch stays on the same token. Although both parsers seem to have the same look ahead conditions. We then see a merge action occur after some type errors.
merged 5 to 3
(!(defined A) || (defined A) && (defined C), (#if (defined B)
, ERROR, 0, 30, !(defined A) || (defined A) && (defined C)))
((defined A) && (defined B) && !(defined C), (c, ERROR, 0, 30, (defined A) && (defined B) && !(defined C)))
((defined A) && !(defined B) && !(defined C), (}, SHIFT, 623, 0, (defined A) && !(defined B) && !(defined C)))
subparsers 3
This leaves the potential valid subparser with condition !A && B && C unexecuted, and therefore unrepresented. The following is the entire output:
java superc.SugarC -showActions -showFM tripleTypedef.c
subparsers 1
reducing ExternalDeclarationList with 0 frames
forked 1 into 2 parsers
(1, (#if (defined A)
, SHIFT, 11, 1, 1):[(typedef, SHIFT, 11, 1, (defined A)), (struct, SHIFT, 7, 0, !(defined A) && !(defined B) && !(defined C)), (typedef, SHIFT, 11, 7, !(defined A) && (defined B)), (typedef, SHIFT, 11, 13, !(defined A) && !(defined B) && (defined C))])
--into--
((defined A), (typedef, SHIFT, 11, 1, (defined A)))
(!(defined A), (#if (defined B)
, NONE, -1, 7, !(defined A)))
subparsers 2
shifting TYPEDEF(typedef)
reducing StorageClass with 1 frames
reducing DeclarationQualifierList with 1 frames
shifting INT(int)
reducing BasicTypeName with 1 frames
reducing BasicDeclarationSpecifier with 2 frames
reducing DeclarationSpecifier with 1 frames
shifting IDENTIFIER(a)
reducing SimpleDeclarator with 1 frames
reducing ParenIdentifierDeclarator with 1 frames
reducing IdentifierDeclaratorMain with 1 frames
reducing IdentifierDeclarator with 1 frames
reducing Declarator with 1 frames
reducing AssemblyExpressionOpt with 0 frames
TODO: support AssemblyExpressionOpt (1)
reducing AttributeSpecifierListOpt with 0 frames
TODO: support AttributeSpecifierListOpt (1), replaced with empty string now
reducing InitializerOpt with 0 frames
reducing DeclaringList with 5 frames
not syntax:DeclarationSpecifier(BasicDeclarationSpecifier(DeclarationQualifierList(Conditional((defined A), StorageClass(superc.core.Syntax$Language("typedef")))), BasicTypeName(superc.core.Syntax$Language("int"))))
not syntax:BasicDeclarationSpecifier(DeclarationQualifierList(Conditional((defined A), StorageClass(superc.core.Syntax$Language("typedef")))), BasicTypeName(superc.core.Syntax$Language("int")))
not syntax:DeclarationQualifierList(Conditional((defined A), StorageClass(superc.core.Syntax$Language("typedef"))))
not syntax:Conditional((defined A), StorageClass(superc.core.Syntax$Language("typedef")))
not syntax:StorageClass(superc.core.Syntax$Language("typedef"))
reducing $@8 with 0 frames
shifting SEMICOLON(;)
reducing Declaration with 3 frames
TODO: typecheck initializers
MVMultiverse(
<UNDECLARED>:1
<ERROR>:0
COMPLEMENT: 0)
PC (defined A) FILT Multiverse(
<UNDECLARED>:(defined A)
COMPLEMENT: !(defined A))
reducing DeclarationExtension with 1 frames
reducing ExternalDeclaration with 1 frames
reducing ExternalDeclarationList with 2 frames
merged 2 to 1
(1, (#if (defined B)
, NONE, -1, 7, 1))
subparsers 1
forked 1 into 2 parsers
(1, (#if (defined B)
, SHIFT, 7, 7, 1):[(struct, SHIFT, 7, 0, !(defined B) && !(defined C)), (typedef, SHIFT, 11, 7, (defined B)), (typedef, SHIFT, 11, 13, !(defined B) && (defined C))])
--into--
((defined B), (typedef, SHIFT, 11, 7, (defined B)))
(!(defined B), (#if (defined C)
, NONE, -1, 13, !(defined B)))
subparsers 2
shifting TYPEDEF(typedef)
reducing StorageClass with 1 frames
reducing DeclarationQualifierList with 1 frames
shifting INT(int)
reducing BasicTypeName with 1 frames
reducing BasicDeclarationSpecifier with 2 frames
reducing DeclarationSpecifier with 1 frames
shifting IDENTIFIER(b)
reducing SimpleDeclarator with 1 frames
reducing ParenIdentifierDeclarator with 1 frames
reducing IdentifierDeclaratorMain with 1 frames
reducing IdentifierDeclarator with 1 frames
reducing Declarator with 1 frames
reducing AssemblyExpressionOpt with 0 frames
TODO: support AssemblyExpressionOpt (1)
reducing AttributeSpecifierListOpt with 0 frames
TODO: support AttributeSpecifierListOpt (1), replaced with empty string now
reducing InitializerOpt with 0 frames
reducing DeclaringList with 5 frames
not syntax:DeclarationSpecifier(BasicDeclarationSpecifier(DeclarationQualifierList(Conditional((defined B), StorageClass(superc.core.Syntax$Language("typedef")))), BasicTypeName(superc.core.Syntax$Language("int"))))
not syntax:BasicDeclarationSpecifier(DeclarationQualifierList(Conditional((defined B), StorageClass(superc.core.Syntax$Language("typedef")))), BasicTypeName(superc.core.Syntax$Language("int")))
not syntax:DeclarationQualifierList(Conditional((defined B), StorageClass(superc.core.Syntax$Language("typedef"))))
not syntax:Conditional((defined B), StorageClass(superc.core.Syntax$Language("typedef")))
not syntax:StorageClass(superc.core.Syntax$Language("typedef"))
reducing $@8 with 0 frames
shifting SEMICOLON(;)
reducing Declaration with 3 frames
TODO: typecheck initializers
MVMultiverse(
<UNDECLARED>:1
<ERROR>:0
COMPLEMENT: 0)
PC (defined B) FILT Multiverse(
<UNDECLARED>:(defined B)
COMPLEMENT: !(defined B))
reducing DeclarationExtension with 1 frames
reducing ExternalDeclaration with 1 frames
reducing ExternalDeclarationList with 2 frames
merged 2 to 1
(1, (#if (defined C)
, NONE, -1, 13, 1))
subparsers 1
forked 1 into 2 parsers
(1, (#if (defined C)
, SHIFT, 7, 13, 1):[(struct, SHIFT, 7, 0, !(defined C)), (typedef, SHIFT, 11, 13, (defined C))])
--into--
((defined C), (typedef, SHIFT, 11, 13, (defined C)))
(!(defined C), (struct, NONE, -1, 0, !(defined C)))
subparsers 2
shifting TYPEDEF(typedef)
reducing StorageClass with 1 frames
reducing DeclarationQualifierList with 1 frames
shifting INT(int)
reducing BasicTypeName with 1 frames
reducing BasicDeclarationSpecifier with 2 frames
reducing DeclarationSpecifier with 1 frames
shifting IDENTIFIER(c)
reducing SimpleDeclarator with 1 frames
reducing ParenIdentifierDeclarator with 1 frames
reducing IdentifierDeclaratorMain with 1 frames
reducing IdentifierDeclarator with 1 frames
reducing Declarator with 1 frames
reducing AssemblyExpressionOpt with 0 frames
TODO: support AssemblyExpressionOpt (1)
reducing AttributeSpecifierListOpt with 0 frames
TODO: support AttributeSpecifierListOpt (1), replaced with empty string now
reducing InitializerOpt with 0 frames
reducing DeclaringList with 5 frames
not syntax:DeclarationSpecifier(BasicDeclarationSpecifier(DeclarationQualifierList(Conditional((defined C), StorageClass(superc.core.Syntax$Language("typedef")))), BasicTypeName(superc.core.Syntax$Language("int"))))
not syntax:BasicDeclarationSpecifier(DeclarationQualifierList(Conditional((defined C), StorageClass(superc.core.Syntax$Language("typedef")))), BasicTypeName(superc.core.Syntax$Language("int")))
not syntax:DeclarationQualifierList(Conditional((defined C), StorageClass(superc.core.Syntax$Language("typedef"))))
not syntax:Conditional((defined C), StorageClass(superc.core.Syntax$Language("typedef")))
not syntax:StorageClass(superc.core.Syntax$Language("typedef"))
reducing $@8 with 0 frames
shifting SEMICOLON(;)
shifting STRUCT(struct)
reducing Declaration with 3 frames
TODO: typecheck initializers
MVMultiverse(
<UNDECLARED>:1
<ERROR>:0
COMPLEMENT: 0)
PC (defined C) FILT Multiverse(
<UNDECLARED>:(defined C)
COMPLEMENT: !(defined C))
reducing DeclarationExtension with 1 frames
reducing ExternalDeclaration with 1 frames
reducing ExternalDeclarationList with 2 frames
shifting STRUCT(struct)
reducing AttributeSpecifierListOpt with 0 frames
TODO: support AttributeSpecifierListOpt (1), replaced with empty string now
reducing AttributeSpecifierListOpt with 0 frames
TODO: support AttributeSpecifierListOpt (1), replaced with empty string now
shifting IDENTIFIER(y)
shifting IDENTIFIER(y)
shifting LBRACE({)
shifting LBRACE({)
reducing StructDeclarationList with 0 frames
forked 1 into 3 parsers
(!(defined C), (#if !(defined A)
, REDUCE, 179, 22, !(defined C)):[(}, SHIFT, 623, 0, (defined A) && !(defined B) && !(defined C)), (a, ERROR, 0, 22, !(defined A) && !(defined C)), (c, ERROR, 0, 30, (defined A) && (defined B) && !(defined C))])
--into--
(!(defined A) && !(defined C), (a, ERROR, 0, 22, !(defined A) && !(defined C)))
((defined A) && (defined B) && !(defined C), (c, ERROR, 0, 30, (defined A) && (defined B) && !(defined C)))
((defined A) && !(defined B) && !(defined C), (}, SHIFT, 623, 0, (defined A) && !(defined B) && !(defined C)))
reducing StructDeclarationList with 0 frames
forked 1 into 2 parsers
((defined C), (#if !(defined A)
, REDUCE, 179, 22, (defined C)):[(}, SHIFT, 623, 0, (defined A) && !(defined B) && (defined C)), (a, ERROR, 0, 22, !(defined A) && (defined C)), (c, SHIFT, 24, 0, (defined A) && (defined B) && (defined C))])
--into--
(!(defined A) && (defined C), (a, ERROR, 0, 22, !(defined A) && (defined C)))
((defined A) && (defined C), (#if !(defined A)
, SHIFT, 623, 22, (defined A) && (defined C)):[(}, SHIFT, 623, 0, (defined A) && !(defined B) && (defined C)), (c, SHIFT, 24, 0, (defined A) && (defined B) && (defined C))])
subparsers 5
error: parse error on "a" at tripleTypedef.c:16:2
error: parse error on "a" at tripleTypedef.c:16:2
error: parse error on "i" at tripleTypedef.c:16:4
error: parse error on "i" at tripleTypedef.c:16:4
error: parse error on ";" at tripleTypedef.c:16:6
error: parse error on ";" at tripleTypedef.c:16:6
error: parse error on "b" at tripleTypedef.c:17:2
error: parse error on "b" at tripleTypedef.c:17:2
error: parse error on "j" at tripleTypedef.c:17:4
error: parse error on "j" at tripleTypedef.c:17:4
error: parse error on ";" at tripleTypedef.c:17:6
error: parse error on ";" at tripleTypedef.c:17:6
merged 5 to 3
(!(defined A) || (defined A) && (defined C), (#if (defined B)
, ERROR, 0, 30, !(defined A) || (defined A) && (defined C)))
((defined A) && (defined B) && !(defined C), (c, ERROR, 0, 30, (defined A) && (defined B) && !(defined C)))
((defined A) && !(defined B) && !(defined C), (}, SHIFT, 623, 0, (defined A) && !(defined B) && !(defined C)))
subparsers 3
error: parse error on "#if (defined B)
" at tripleTypedef.c:19:1
error: parse error on "c" at tripleTypedef.c:20:2
error: parse error on "c" at tripleTypedef.c:20:2
error: parse error on "k" at tripleTypedef.c:20:4
error: parse error on "k" at tripleTypedef.c:20:4
error: parse error on ";" at tripleTypedef.c:20:6
error: parse error on ";" at tripleTypedef.c:20:6
(defined A) && (defined B) && !(defined C)
!(defined A) || (defined A) && (defined C)
merged 3 to 1
(1, (}, SHIFT, 623, 0, 1))
subparsers 1
shifting RBRACE(})
reducing StructOrUnionSpecifier with 6 frames
TODO: account for bitfieldsize alone as a struct field with no name.
MVMultiverse(
<UNDECLARED>:1
<ERROR>:0
COMPLEMENT: 0)
PC 1 FILT Multiverse(
<UNDECLARED>:1
COMPLEMENT: 0)
TODO: check to see if something needs to be done for empty struct/union
reducing ElaboratedTypeName with 1 frames
reducing SUETypeSpecifier with 1 frames
reducing $@7 with 0 frames
shifting SEMICOLON(;)
reducing Declaration with 3 frames
reducing DeclarationExtension with 1 frames
reducing ExternalDeclaration with 1 frames
reducing ExternalDeclarationList with 2 frames
shifting INT(int)
reducing BasicTypeName with 1 frames
reducing BasicTypeSpecifier with 1 frames
reducing TypeSpecifier with 1 frames
shifting IDENTIFIER(main)
reducing SimpleDeclarator with 1 frames
reducing ParenIdentifierDeclarator with 1 frames
shifting LPAREN(()
reducing $@22 with 0 frames
reducing ParameterTypeListOpt with 0 frames
reducing $@23 with 0 frames
shifting RPAREN())
reducing PostfixingFunctionDeclarator with 5 frames
reducing FunctionDeclarator with 2 frames
reducing PostfixIdentifierDeclarator with 1 frames
reducing UnaryIdentifierDeclarator with 1 frames
reducing IdentifierDeclaratorMain with 1 frames
reducing IdentifierDeclarator with 1 frames
reducing FunctionPrototype with 2 frames
not syntax:TypeSpecifier(BasicTypeSpecifier(BasicTypeName(superc.core.Syntax$Language("int"))))
not syntax:BasicTypeSpecifier(BasicTypeName(superc.core.Syntax$Language("int")))
not syntax:BasicTypeName(superc.core.Syntax$Language("int"))
shifting LBRACE({)
reducing $@26 with 0 frames
reducing LocalLabelDeclarationListOpt with 0 frames
reducing DeclarationOrStatementList with 0 frames
forked 1 into 2 parsers
(1, (#if (defined B)
, SHIFT, 6, 42, 1):[(int, SHIFT, 6, 42, !(defined B)), (int, SHIFT, 6, 42, (defined B))])
--into--
(!(defined B), (int, SHIFT, 6, 42, !(defined B)))
((defined B), (int, SHIFT, 6, 42, (defined B)))
subparsers 2
shifting INT(int)
reducing BasicTypeName with 1 frames
reducing BasicTypeSpecifier with 1 frames
reducing TypeSpecifier with 1 frames
shifting IDENTIFIER(d)
reducing SimpleDeclarator with 1 frames
reducing ParenIdentifierDeclarator with 1 frames
reducing IdentifierDeclaratorMain with 1 frames
reducing IdentifierDeclarator with 1 frames
reducing Declarator with 1 frames
reducing AssemblyExpressionOpt with 0 frames
TODO: support AssemblyExpressionOpt (1)
reducing AttributeSpecifierListOpt with 0 frames
TODO: support AttributeSpecifierListOpt (1), replaced with empty string now
shifting ASSIGN(=)
shifting INTEGERconstant(2)
reducing Constant with 1 frames
reducing PrimaryExpression with 1 frames
reducing PostfixExpression with 1 frames
reducing UnaryExpression with 1 frames
reducing CastExpression with 1 frames
reducing MultiplicativeExpression with 1 frames
reducing AdditiveExpression with 1 frames
reducing ShiftExpression with 1 frames
reducing RelationalExpression with 1 frames
reducing EqualityExpression with 1 frames
reducing AndExpression with 1 frames
reducing ExclusiveOrExpression with 1 frames
reducing InclusiveOrExpression with 1 frames
reducing LogicalAndExpression with 1 frames
reducing LogicalORExpression with 1 frames
reducing ConditionalExpression with 1 frames
reducing AssignmentExpression with 1 frames
reducing Initializer with 1 frames
reducing InitializerOpt with 2 frames
reducing DeclaringList with 5 frames
not syntax:TypeSpecifier(BasicTypeSpecifier(BasicTypeName(superc.core.Syntax$Language("int"))))
not syntax:BasicTypeSpecifier(BasicTypeName(superc.core.Syntax$Language("int")))
not syntax:BasicTypeName(superc.core.Syntax$Language("int"))
reducing $@8 with 0 frames
shifting SEMICOLON(;)
shifting INT(int)
reducing BasicTypeName with 1 frames
reducing BasicTypeSpecifier with 1 frames
reducing TypeSpecifier with 1 frames
shifting IDENTIFIER(d)
reducing SimpleDeclarator with 1 frames
reducing ParenIdentifierDeclarator with 1 frames
reducing IdentifierDeclaratorMain with 1 frames
reducing IdentifierDeclarator with 1 frames
reducing Declarator with 1 frames
reducing AssemblyExpressionOpt with 0 frames
TODO: support AssemblyExpressionOpt (1)
reducing AttributeSpecifierListOpt with 0 frames
TODO: support AttributeSpecifierListOpt (1), replaced with empty string now
shifting ASSIGN(=)
shifting INTEGERconstant(2)
reducing Constant with 1 frames
reducing PrimaryExpression with 1 frames
reducing PostfixExpression with 1 frames
reducing UnaryExpression with 1 frames
reducing CastExpression with 1 frames
reducing MultiplicativeExpression with 1 frames
reducing AdditiveExpression with 1 frames
reducing ShiftExpression with 1 frames
reducing RelationalExpression with 1 frames
reducing EqualityExpression with 1 frames
reducing AndExpression with 1 frames
reducing ExclusiveOrExpression with 1 frames
reducing InclusiveOrExpression with 1 frames
reducing LogicalAndExpression with 1 frames
reducing LogicalORExpression with 1 frames
reducing ConditionalExpression with 1 frames
reducing AssignmentExpression with 1 frames
reducing Initializer with 1 frames
reducing InitializerOpt with 2 frames
reducing DeclaringList with 5 frames
not syntax:TypeSpecifier(BasicTypeSpecifier(BasicTypeName(superc.core.Syntax$Language("int"))))
not syntax:BasicTypeSpecifier(BasicTypeName(superc.core.Syntax$Language("int")))
not syntax:BasicTypeName(superc.core.Syntax$Language("int"))
reducing $@8 with 0 frames
shifting SEMICOLON(;)
reducing Declaration with 3 frames
TODO: typecheck initializers
MVMultiverse(
<UNDECLARED>:1
<ERROR>:0
COMPLEMENT: 0)
PC (defined B) FILT Multiverse(
<UNDECLARED>:(defined B)
COMPLEMENT: !(defined B))
reducing Declaration with 3 frames
TODO: typecheck initializers
merged 2 to 1
(1, (return, REDUCE, 49, 0, 1))
subparsers 1
reducing DeclarationExtension with 1 frames
reducing DeclarationOrStatement with 1 frames
reducing DeclarationOrStatementList with 2 frames
shifting RETURN(return)
shifting OCTALconstant(0)
reducing Constant with 1 frames
reducing PrimaryExpression with 1 frames
reducing PostfixExpression with 1 frames
reducing UnaryExpression with 1 frames
reducing CastExpression with 1 frames
reducing MultiplicativeExpression with 1 frames
reducing AdditiveExpression with 1 frames
reducing ShiftExpression with 1 frames
reducing RelationalExpression with 1 frames
reducing EqualityExpression with 1 frames
reducing AndExpression with 1 frames
reducing ExclusiveOrExpression with 1 frames
reducing InclusiveOrExpression with 1 frames
reducing LogicalAndExpression with 1 frames
reducing LogicalORExpression with 1 frames
reducing ConditionalExpression with 1 frames
reducing AssignmentExpression with 1 frames
reducing Expression with 1 frames
reducing ExpressionOpt with 1 frames
shifting SEMICOLON(;)
reducing ReturnStatement with 3 frames
TODO: check the type of the return value
return type:Multiverse(
int:1
COMPLEMENT: 0)
transform:Multiverse(
0:1
COMPLEMENT: 0)
reducing JumpStatement with 1 frames
reducing Statement with 1 frames
reducing DeclarationOrStatement with 1 frames
reducing DeclarationOrStatementList with 2 frames
reducing CompoundStatementBody with 2 frames
TODO: account for bitfield sizes in forward refs
reducing $@27 with 0 frames
shifting RBRACE(})
reducing CompoundStatement with 5 frames
reducing FunctionDefinition with 2 frames
TODO: don't permit extern prototypes to have a definition
TYPEMultiverse(
int :1
COMPLEMENT: 0)
DECMultiverse(
main ():1
COMPLEMENT: 0)
MVMultiverse(
<UNDECLARED>:1
<ERROR>:0
COMPLEMENT: 0)
PC 1 FILT Multiverse(
<UNDECLARED>:1
COMPLEMENT: 0)
TODO: multiplex functions to so that each can have its own function name. try using function pointers as a kind of vtable.
PROTOTYPESTRMV Multiverse(
int __main_6 ():1
COMPLEMENT: 0)
1
FunctionPrototype(TypeSpecifier(BasicTypeSpecifier(BasicTypeName(superc.core.Syntax$Language("int")))), IdentifierDeclarator(IdentifierDeclaratorMain(UnaryIdentifierDeclarator(PostfixIdentifierDeclarator(FunctionDeclarator(ParenIdentifierDeclarator(SimpleDeclarator(superc.core.Syntax$Text("main"))), PostfixingFunctionDeclarator(superc.core.Syntax$Language("("), $@22(), ParameterTypeListOpt(), $@23(), superc.core.Syntax$Language(")"))))))))
reducing FunctionDefinitionExtension with 1 frames
reducing ExternalDeclaration with 1 frames
reducing ExternalDeclarationList with 2 frames
reducing TranslationUnit with 1 frames
#include <stdbool.h>
extern void __static_parse_error(char *msg);
extern void __static_type_error(char *msg);
extern void __static_renaming(char *renaming, char *original);
extern void __static_condition_renaming(char *expression, char *renaming);
TODO: record original presence condition strings in file as well once raw strings are collected
void __static_initializer_default();
extern const bool __static_condition_default_7;
void __static_initializer_default() {
__static_renaming("__a_0", "a");
__static_renaming("__b_1", "b");
__static_renaming("__c_2", "c");
__static_renaming("__d_4", "d");
__static_renaming("__d_5", "d");
__static_renaming("__main_6", "main");
__static_condition_renaming("__static_condition_default_7", "!(defined A) || (defined A) && !(defined B) && (defined C) || (defined A) && (defined B)");
if (__static_condition_default_7)
{
__static_parse_error("Unable to parse");
}
};
TODO: account for bitfield sizes in forward refs
typedef int __a_0;
typedef int __b_1;
typedef int __c_2;
struct __y_3 {
};
// typedef moved to top of scope
// typedef moved to top of scope
// typedef moved to top of scope
struct __y_3 ;
int __main_6 () {
{
int __d_4= 2;
int __d_5= 2;
return 0 ;
}
}
UPDATE: bug was seemingly fixed by adding an invariant condition to the merge function with excludes subparsers with the error action. Further testing is needed before closing this.
The error occurs on the following code snippet:
What we see is that the parser forks on #ifdef C, and then does not merge on struct. From here we see the !defined C branch fork as follows:
However we see the defined C branch for as this:
What's interesting here is that the second branch stays on the same token. Although both parsers seem to have the same look ahead conditions. We then see a merge action occur after some type errors.
This leaves the potential valid subparser with condition !A && B && C unexecuted, and therefore unrepresented. The following is the entire output: