NRefactory icon indicating copy to clipboard operation
NRefactory copied to clipboard

VariableReferenceGraphBuilder is causing stack overflows

Open dgrunwald opened this issue 13 years ago • 0 comments

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.

dgrunwald avatar Oct 04 '12 21:10 dgrunwald