https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117886
Bug ID: 117886
Summary: GIMPLE pass asan0 no longer works after
LIBGCCJIT_ABI_32
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: jit
Assignee: dmalcolm at gcc dot gnu.org
Reporter: i at zhuyi dot fan
Target Milestone: ---
Created attachment 59767
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59767&action=edit
Github Action Archive
Background
==========
I spotted this when building mlir-gccjit on top of commit
73e7f63ffaacf018b1fad331d2369bf891620e97. The relevant change should be
LIBGCCJIT_ABI_32.
The original scene is at:
https://github.com/Lancern/mlir-gccjit/actions/runs/12128538377/job/33815114366?pr=40
In case it get cleared by github (after a long time), I have also attached the
log archive.
Error Message
=============
```
Unknown type:
<integer_type 0x7fabf2c251f8 public unsigned DI
size <integer_cst 0x7fabf2c02dc8 type <integer_type 0x7fabf2c1d0a8
bitsizetype> constant 64>
unit-size <integer_cst 0x7fabf2c02de0 type <integer_type 0x7fabf2c1d000
sizetype> constant 8>
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fabf2c251f8 precision:64 min <integer_cst 0x7fabf2c211e0 0> max <integer_cst
0x7fabf2c03580 18446744073709551615>>
during GIMPLE pass: asan
libgccjit.so:
/home/runner/work/mlir-gccjit/mlir-gccjit/test/compile/deref_chain.mlir:177:5:
error: in tree_type_to_jit_type, at jit/dummy-frontend.cc:1305
0x7fac034bf57c internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:517
0x7fac01bb55f7 fancy_abort(char const*, int, char const*)
../../gcc/gcc/diagnostic.cc:1696
0x7fac01bd2169 tree_type_to_jit_type(tree_node*)
../../gcc/gcc/jit/dummy-frontend.cc:1305
0x7fac01bd44c8 jit_langhook_builtin_function
../../gcc/gcc/jit/dummy-frontend.cc:1340
0x7fac021821b8 initialize_sanitizer_builtins()
../../gcc/gcc/sanitizer.def:51
0x7fac021821b8 initialize_sanitizer_builtins()
../../gcc/gcc/asan.cc:3486
0x7fac02189824 asan_instrument
../../gcc/gcc/asan.cc:4351
0x7fac02189824 execute
../../gcc/gcc/asan.cc:4393
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
```
Gimple Output
=============
```
struct memref<133x723x?xf32>;
struct fake;
struct memref<133x723x?xf32>
{
float * base;
float * aligned;
size_t offset;
size_t[3] sizes;
size_t[3] strides;
};
struct fake
{
char c;
float t;
};
extern void
main ()
{
size_t %0;
size_t %1;
size_t %2;
size_t %3;
size_t %4;
size_t %5;
size_t %6;
size_t %7;
float * %8;
size_t[3] %9;
size_t[3] %10;
size_t %11;
struct memref<133x723x?xf32> %12;
float * %13;
void * %14;
bb0:
%0 = (size_t)133;
%1 = (size_t)133;
%2 = (size_t)723;
%3 = (size_t)1;
%4 = %0 * %2;
%5 = %4 * %1;
%6 = (size_t)sizeof (float);
%7 = %6 * %5;
%8 = bitcast(aligned_alloc ((bitcast(&(*(struct fake *)NULL).t, size_t)), (%7
+ bitcast(&(*(struct fake *)NULL).t, size_t) - (size_t)1 - (%7 +
bitcast(&(*(struct fake *)NULL).t, size_t) - (size_t)1) % bitcast(&(*(struct
fake *)NULL).t, size_t))), float *);
%9 = (size_t[3]) {%1, %2, %0};
%10 = (size_t[3]) {%4, %0, %3};
%11 = (size_t)0;
%12 = (struct memref<133x723x?xf32>) {.base=%8, .aligned=%8, .offset=%11,
.sizes=%9, .strides=%10};
%13 = %12.aligned;
%14 = bitcast(%13, void *);
(void)free (%14);
return;
}
```
Reproducer
==========
I will attach in a later comment