Skip to content

rustc produces invalid IR with -O -g #28947

Closed
@wthrowe

Description

@wthrowe

When compiling rustc with "--enable-debug --enable-optimize" the stage0 compiler fails to build libsyntax with

!dbg attachment points at wrong subprogram for function
!157085 = !DISubprogram(name: "fnfn", linkageName: "fnfn", scope: !157069, file: !157069, line: 38, type: !42899, isLocal: true, isDefinition: true, scopeLine: 38, flags: DIFlagPrototyped, isOptimized: true, function: i64 (%closure.1242*, %"ast::Expr"*)* @_ZN3ext6expand11expand_expr13closure.69625E, templateParams: !1036, variables: !157086)
i64 (%closure.1242*, %"ast::Expr"*)* @_ZN3ext6expand11expand_expr13closure.69625E
  tail call void @llvm.dbg.value(metadata %"ext::expand::IdentRenamer"* %rename_fld.i.857, i64 0, metadata !157464, metadata !190803), !dbg !771025
!771025 = !DILocation(line: 113, scope: !157458, inlinedAt: !771026)
!771027 = distinct !DILexicalBlock(scope: !771028, file: !157069, line: 129, column: 56)
!160753 = !DISubprogram(name: "fnfn", linkageName: "fnfn", scope: !157069, file: !157069, line: 129, type: !160754, isLocal: true, isDefinition: true, scopeLine: 129, flags: DIFlagPrototyped, isOptimized: true, templateParams: !1036, variables: !160756)
LLVM ERROR: Broken function found, compilation aborted!

This started with #28857, but it looks to me like that just happened to trigger a preexisting bug.

Metadata

Metadata

Assignees

Labels

A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions