[flang-commits] [flang] Revert "[flang][debug] Support mlir::NoneType." (PR #113769)

via flang-commits flang-commits at lists.llvm.org
Sat Oct 26 12:33:25 PDT 2024


https://github.com/jeanPerier created https://github.com/llvm/llvm-project/pull/113769

Reverts llvm/llvm-project#113550

It turns out this causes compiler crashes with assumed-type arrays and -g.

Reproducer:
```
subroutine bug()
interface
  subroutine sub(a)
    type(*) :: a(*)
  end subroutine
end interface
  real :: x(10)
  call sub(x)
end subroutine
```

`flang -g -c` crashes with:

```
array types must have a base type
!18 = !DICompositeType(tag: DW_TAG_array_type, elements: !19)
error: failed to create the LLVM module
```

>From 062f1bcced4819496baf7ec34c3e98e66599c700 Mon Sep 17 00:00:00 2001
From: jeanPerier <jean.perier.polytechnique at gmail.com>
Date: Sat, 26 Oct 2024 21:26:02 +0200
Subject: [PATCH] Revert "[flang][debug] Support mlir::NoneType. (#113550)"

This reverts commit 85af1926f74e88e14c9f58946537e025a74ccf7e.
---
 .../Optimizer/Transforms/DebugTypeGenerator.cpp    |  2 --
 flang/test/Transforms/debug-none-type.fir          | 14 --------------
 2 files changed, 16 deletions(-)
 delete mode 100644 flang/test/Transforms/debug-none-type.fir

diff --git a/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp b/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
index e387e27533a006..1ab6c76dae8eda 100644
--- a/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
+++ b/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
@@ -581,8 +581,6 @@ DebugTypeGenerator::convertType(mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
                                   /*genAssociated=*/false);
   } else if (auto vecTy = mlir::dyn_cast_or_null<fir::VectorType>(Ty)) {
     return convertVectorType(vecTy, fileAttr, scope, declOp);
-  } else if (mlir::isa<mlir::NoneType>(Ty)) {
-    return mlir::LLVM::DINullTypeAttr::get(context);
   } else if (auto boxTy = mlir::dyn_cast_or_null<fir::BoxType>(Ty)) {
     auto elTy = boxTy.getElementType();
     if (auto seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(elTy))
diff --git a/flang/test/Transforms/debug-none-type.fir b/flang/test/Transforms/debug-none-type.fir
deleted file mode 100644
index 5eee6a63321904..00000000000000
--- a/flang/test/Transforms/debug-none-type.fir
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
-
-module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
-  func.func private @_FortranAAssign(i8) -> none loc(#loc1)
-  func.func private @foo() -> !fir.ref<none>  loc(#loc2)
-}
-#loc1 = loc("test.f90":5:1)
-#loc2 = loc("test.f90":15:1)
-
-// CHECK: #[[INT8_TY:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "integer", sizeInBits = 8, encoding = DW_ATE_signed>
-// CHECK: #[[NONE_TY:.*]] = #llvm.di_null_type
-// CHECK: #[[REFNONE_TY:.*]] = #llvm.di_derived_type<tag = DW_TAG_pointer_type, name = "", baseType = #di_null_type{{.*}}>
-// CHECK: #llvm.di_subroutine_type<{{.*}}types = #[[NONE_TY]], #[[INT8_TY]]>
-// CHECK: #llvm.di_subroutine_type<{{.*}}types = #[[REFNONE_TY]]>



More information about the flang-commits mailing list