Issue 61405
Summary `mlir-translate` fails with Assertion error in `llvm::checkGEPType`
Labels new issue
Assignees
Reporter AntonLydike
    Might be related to #41833

## MLIR Version:

Compiled from commit `e0282cb4da9402de5712ac7855af6c71a03d0c19`.

```
> mlir-translate --version
LLVM (http://llvm.org/):
  LLVM version 17.0.0git
  Optimized build with assertions.
```

## Reproduce:

Runnning `cat gep.mlir | mlir-translate --mlir-to-llvmir` produces the following error:

```
mlir-translate: /home/anton/uni/llvm-project/llvm/include/llvm/IR/Instructions.h:933: llvm::Type *llvm::checkGEPType(llvm::Type *): Assertion `Ty && "Invalid GetElementPtrInst indices for type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: mlir-translate --mlir-to-llvmir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  mlir-translate 0x00000000009837cb
1  mlir-translate 0x000000000098152e
2  mlir-translate 0x0000000000984186
3  libc.so.6      0x00007f51fb23dbf0
4  libc.so.6      0x00007f51fb28abc7
5  libc.so.6      0x00007f51fb23db46 raise + 22
6  libc.so.6      0x00007f51fb2284b5 abort + 215
7  libc.so.6      0x00007f51fb2283d9
8  libc.so.6      0x00007f51fb2367b6
9  mlir-translate 0x0000000000f61991
10 mlir-translate 0x0000000000f616d2
11 mlir-translate 0x0000000000f615d6
12 mlir-translate 0x0000000000f5f2d4
13 mlir-translate 0x0000000000f4db07
14 mlir-translate 0x0000000000da64e7
15 mlir-translate 0x0000000000da6aa6
16 mlir-translate 0x0000000000da873a
17 mlir-translate 0x0000000000daa201
18 mlir-translate 0x0000000000dac7b4
19 mlir-translate 0x0000000000d99816
20 mlir-translate 0x00000000011b7f99
21 mlir-translate 0x00000000011b6697
22 mlir-translate 0x00000000011be7d3
23 mlir-translate 0x00000000011b50ff
24 mlir-translate 0x000000000092f635
25 libc.so.6      0x00007f51fb22924e
26 libc.so.6      0x00007f51fb229309 __libc_start_main + 137
27 mlir-translate 0x000000000092f535
fish: Process 189236, 'mlir-translate' from job 1, 'cat gep.mlir | mlir-translate -…' terminated by signal SIGABRT (Abort)
```

The contents of `gep.mlir`:

```mlir
module attributes {llvm.data_layout = ""} {
  llvm.func @test(%arg0: !llvm.ptr<struct<(ptr, ptr<i32>)>>) attributes {sym_visibility = "private"} {
    %0 = llvm.getelementptr %arg0[0, 1, 0] : (!llvm.ptr<struct<(ptr, ptr<i32>)>>) -> !llvm.ptr<i32>
    llvm.return
  }
}
```

Is this a malformed `gep` operation? I'd think that we should access the `llvm.ptr<i32>` inside the struct and add offsets to that, no?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to