Skip to content

[flang][OpenMP][debug] Build failure with duplicate variable mapping #146847

@abidh

Description

@abidh

Please see the following program

PROGRAM test
  implicit none
  integer i
  type :: t1
    integer :: i1
  end type t1
  type(t1), dimension(10) :: v2
  call fn()
       
  CONTAINS 
  subroutine fn()
    !$omp target map(alloc: v2(:))
        v2(5)%i1 = 5
    !$omp end target
  end subroutine
end program test

When compiled with

flang -fc1 -emit-llvm -debug-info-kind=standalone -fopenmp

it fails with the following error:

conflicting debug info for argument
#dbg_declare(ptr %1, !41, !DIExpression(), !40)
!39 = !DILocalVariable(name: "v2", arg: 2, scope: !35, file: !4, line: 22, type: !9)
!41 = !DILocalVariable(name: "v2", arg: 2, scope: !35, file: !4, line: 23, type: !9)
error: failed to create the LLVM module

The reason seems to be that variable v2 is mapped twice and get 2 DeclareOp (and 2 local variables) in the outlined function for target region. This eventually maps to same location and cause this verification failure.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions