Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Compiler Error for ExplicitTuple conversion in CodeGen/Emit #66265

Closed
bernd5 opened this issue Jan 5, 2023 · 0 comments · Fixed by #69934
Closed

Internal Compiler Error for ExplicitTuple conversion in CodeGen/Emit #66265

bernd5 opened this issue Jan 5, 2023 · 0 comments · Fixed by #69934
Assignees
Milestone

Comments

@bernd5
Copy link
Contributor

bernd5 commented Jan 5, 2023

Version Used: main from 2023-01-02

Steps to Reproduce:

Compile:

(byte, byte) a = (1, 2);
var eq = ((int, int))a == a;

Diagnostic Id:

System.InvalidOperationException: Unexpected value 'ExplicitTuple' of type 'Microsoft.CodeAnalysis.CSharp.ConversionKind'

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversion(BoundConversion conversion) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitConversion.cs:line 93

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversionExpression(BoundConversion conversion, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitConversion.cs:line 42

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCore(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 95

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 74

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitFieldLoadReceiver(BoundExpression receiver) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 1093

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitFieldLoadNoIndirection(BoundFieldAccess fieldAccess, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 1039

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitFieldLoad(BoundFieldAccess fieldAccess, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 1005

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCore(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 95

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 74

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitCondBranchCore(BoundExpression condition, Object& dest, Boolean sense) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 471

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitCondBranch(BoundExpression condition, Object& dest, Boolean sense) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 373

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitShortCircuitingOperator(BoundBinaryOperator condition, Boolean sense, Boolean stopSense, Boolean stopValue) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitOperators.cs:line 285

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitBinaryCondOperator(BoundBinaryOperator binOp, Boolean sense) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitOperators.cs:line 299

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitBinaryOperatorExpression(BoundBinaryOperator expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitOperators.cs:line 60

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCore(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 95

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 74

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitSequenceExpression(BoundSequence sequence, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 778

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCore(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 95

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCoreWithStackGuard(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 91

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs:line 74

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 104

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatementAndCountInstructions(BoundStatement statement) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 121

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitSequencePointStatement(BoundSequencePointWithSpan node) in /_/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs:line 396

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 104

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatements(ImmutableArray`1 statements) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 665

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitBlock(BoundBlock block) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 642

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 104

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatementList(BoundStatementList list) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 128

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) in /_/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs:line 104

   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl() in /_/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs:line 305

   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.GenerateMethodBody(PEModuleBuilder moduleBuilder, MethodSymbol method, Int32 methodOrdinal, BoundStatement block, ImmutableArray`1 lambdaDebugInfo, ImmutableArray`1 closureDebugInfo, ImmutableArray`1 stateMachineStateDebugInfos, StateMachineTypeSymbol stateMachineTypeOpt, VariableSlotAllocator variableSlotAllocatorOpt, BindingDiagnosticBag diagnostics, DebugDocumentProvider debugDocumentProvider, ImportChain importChainOpt, Boolean emittingPdb, Boolean emitTestCoverageData, ImmutableArray`1 dynamicAnalysisSpans, AsyncForwardEntryPoint entryPointOpt) in /_/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs:line 1652

   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers& processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState) in /_/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs:line 931

   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType) in /_/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs:line 530

   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0() in /_/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs:line 430

   at Roslyn.Utilities.UICultureUtilities.<>c__DisplayClass5_0.<WithCurrentUICulture>b__0() in /_/src/Compilers/Core/Portable/InternalUtilities/UICultureUtilities.cs:line 141

   at System.Threading.Tasks.Task.InnerInvoke()

   at System.Threading.Tasks.Task.<>c.<.cctor>b__273_0(Object obj)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

--- End of stack trace from previous location ---

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

--- End of stack trace from previous location ---

   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.WaitForWorkers() in /_/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs:line 335

   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean emittingPdb, Boolean emitTestCoverageData, Boolean hasDeclarationErrors, Boolean emitMethodBodies, BindingDiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken) in /_/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs:line 217

   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CompileMethods(CommonPEModuleBuilder moduleBuilder, Boolean emittingPdb, Boolean emitMetadataOnly, Boolean emitTestCoverageData, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken) in /_/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs:line 3265

   at Microsoft.CodeAnalysis.Compilation.Emit(Stream peStream, Stream metadataPEStream, Stream pdbStream, Stream xmlDocumentationStream, Stream win32Resources, IEnumerable`1 manifestResources, EmitOptions options, IMethodSymbol debugEntryPoint, Stream sourceLinkStream, IEnumerable`1 embeddedTexts, RebuildData rebuildData, CompilationTestData testData, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/Compilation/Compilation.cs:line 2981

   at Microsoft.CodeAnalysis.Compilation.Emit(Stream peStream, Stream pdbStream, Stream xmlDocumentationStream, Stream win32Resources, IEnumerable`1 manifestResources, EmitOptions options, IMethodSymbol debugEntryPoint, Stream sourceLinkStream, IEnumerable`1 embeddedTexts, Stream metadataPEStream, RebuildData rebuildData, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/Compilation/Compilation.cs:line 2811

   at SharpLab.Server.Compilation.Compiler.TryCompileToStreamAsync(MemoryStream assemblyStream, MemoryStream symbolStream, IWorkSession session, IList`1 diagnostics, CancellationToken cancellationToken) in D:\a\SharpLab\SharpLab\!roslyn-branches\dotnet-main\sharplab\source\Server\Compilation\Compiler.cs:line 52

   at SharpLab.Server.MirrorSharp.SlowUpdate.ProcessAsync(IWorkSession session, IList`1 diagnostics, CancellationToken cancellationToken) in D:\a\SharpLab\SharpLab\!roslyn-branches\dotnet-main\sharplab\source\Server\MirrorSharp\SlowUpdate.cs:line 139

   at MirrorSharp.Internal.Handlers.SlowUpdateHandler.ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken) in D:\a\SharpLab\SharpLab\!roslyn-branches\dotnet-main\sharplab\source\#external\mirrorsharp\Common\Internal\Handlers\SlowUpdateHandler.cs:line 39

   at MirrorSharp.Internal.Connection.ReceiveAndProcessInternalAsync(CancellationToken cancellationToken) in D:\a\SharpLab\SharpLab\!roslyn-branches\dotnet-main\sharplab\source\#external\mirrorsharp\Common\Internal\Connection.cs:line 118

   at MirrorSharp.Internal.Connection.ReceiveAndProcessAsync(CancellationToken cancellationToken) in D:\a\SharpLab\SharpLab\!roslyn-branches\dotnet-main\sharplab\source\#external\mirrorsharp\Common\Internal\Connection.cs:line 73

Expected Behavior:
No error

Actual Behavior:
InvalidOperationException

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 5, 2023
@jcouv jcouv self-assigned this Jan 5, 2023
@jcouv jcouv added this to the 17.6 milestone Jan 5, 2023
@jcouv jcouv added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 5, 2023
@bernd5 bernd5 changed the title Internal Compiler Error for ExplicitTupleType to ImplicitTupleType conversion in CodeGen/Emit Internal Compiler Error for ExplicitTupleType conversion in CodeGen/Emit Jan 5, 2023
@bernd5 bernd5 changed the title Internal Compiler Error for ExplicitTupleType conversion in CodeGen/Emit Internal Compiler Error for ExplicitTuple conversion in CodeGen/Emit Jan 5, 2023
@jcouv jcouv modified the milestones: 17.6, C# 12.0 Mar 2, 2023
@jaredpar jaredpar assigned AlekseyTs and unassigned jcouv Sep 11, 2023
@jaredpar jaredpar modified the milestones: C# 12.0, 17.8 Sep 11, 2023
AlekseyTs added a commit to AlekseyTs/roslyn that referenced this issue Sep 13, 2023
AlekseyTs added a commit that referenced this issue Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants