VariableReferenceGraphBuilder is causing stack overflows #123

Open
opened 2012-10-04 16:04:44 -05:00 by dgrunwald · 0 comments
dgrunwald commented 2012-10-04 16:04:44 -05:00 (Migrated from github.com)

When analyzing Mono.CSharp.Attribute.Emit(...) (attribute.cs, line 971ff), the VariableReferenceGraphBuilder+CfgVariableReferenceNodeBuilder.AddNode() method causes a stack overflow exception.
This can be reproduced by enabling the 'redundant assignment' issue provider and opening attribute.cs in SharpDevelop.

Here is the repeating portion of the call stack: (startNode argument for each stack frame)

"StartNode: if (Type == predefined.Guid) { try { string v = ((StringConstant)arg_expr).Value; new Guid (v); }..."
"StartNode: if (Type == predefined.AttributeUsage) { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Va..."
"StartNode: { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Value; if (v == 0) { context.Module.Compi..."
"StartNode: { context.Module.Compiler.Report.Error (591, Location, "Invalid value for argument to `{0}' attri..."
"StartNode: { var pt = param_types [j]; var arg_expr = pos_args [j].Expr; if (j == 0) { if ((Type == predefin..."
"StartNode: { if ((Type == predefined.IndexerName || Type == predefined.Conditional) && arg_expr is Constant)..."
"StartNode: if (Type == predefined.Guid) { try { string v = ((StringConstant)arg_expr).Value; new Guid (v); }..."
"StartNode: if (Type == predefined.AttributeUsage) { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Va..."
"StartNode: { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Value; if (v == 0) { context.Module.Compi..."
"StartNode: { context.Module.Compiler.Report.Error (591, Location, "Invalid value for argument to `{0}' attri..."
"StartNode: { var pt = param_types [j]; var arg_expr = pos_args [j].Expr; if (j == 0) { if ((Type == predefin..."
"StartNode: { if ((Type == predefined.IndexerName || Type == predefined.Conditional) && arg_expr is Constant)..."
"StartNode: if (Type == predefined.Guid) { try { string v = ((StringConstant)arg_expr).Value; new Guid (v); }..."
"StartNode: if (Type == predefined.AttributeUsage) { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Va..."
"StartNode: { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Value; if (v == 0) { context.Module.Compi..."

These are statements from line 996 to 1016 in attribute.cs.

When analyzing `Mono.CSharp.Attribute.Emit(...)` (attribute.cs, line 971ff), the `VariableReferenceGraphBuilder+CfgVariableReferenceNodeBuilder.AddNode()` method causes a stack overflow exception. This can be reproduced by enabling the 'redundant assignment' issue provider and opening attribute.cs in SharpDevelop. Here is the repeating portion of the call stack: (startNode argument for each stack frame) ``` "StartNode: if (Type == predefined.Guid) { try { string v = ((StringConstant)arg_expr).Value; new Guid (v); }..." "StartNode: if (Type == predefined.AttributeUsage) { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Va..." "StartNode: { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Value; if (v == 0) { context.Module.Compi..." "StartNode: { context.Module.Compiler.Report.Error (591, Location, "Invalid value for argument to `{0}' attri..." "StartNode: { var pt = param_types [j]; var arg_expr = pos_args [j].Expr; if (j == 0) { if ((Type == predefin..." "StartNode: { if ((Type == predefined.IndexerName || Type == predefined.Conditional) && arg_expr is Constant)..." "StartNode: if (Type == predefined.Guid) { try { string v = ((StringConstant)arg_expr).Value; new Guid (v); }..." "StartNode: if (Type == predefined.AttributeUsage) { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Va..." "StartNode: { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Value; if (v == 0) { context.Module.Compi..." "StartNode: { context.Module.Compiler.Report.Error (591, Location, "Invalid value for argument to `{0}' attri..." "StartNode: { var pt = param_types [j]; var arg_expr = pos_args [j].Expr; if (j == 0) { if ((Type == predefin..." "StartNode: { if ((Type == predefined.IndexerName || Type == predefined.Conditional) && arg_expr is Constant)..." "StartNode: if (Type == predefined.Guid) { try { string v = ((StringConstant)arg_expr).Value; new Guid (v); }..." "StartNode: if (Type == predefined.AttributeUsage) { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Va..." "StartNode: { int v = ((IntConstant)((EnumConstant)arg_expr).Child).Value; if (v == 0) { context.Module.Compi..." ``` These are statements from line 996 to 1016 in attribute.cs.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-icsharpcode/NRefactory#123
No description provided.