[llvm] [llvm] Fix ObjectSizeOffsetVisitor behavior in exact mode upon negati… (PR #116955)
Nathan Chancellor via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 21 08:53:56 PST 2024
nathanchance wrote:
```c
struct {
int list;
} *io_add_buffers_bufs[4];
short io_add_buffers_buf_1, io_add_buffers_pbuf_1;
long io_add_buffers_pbuf_0;
void list_add_tail(int *);
int kmem_cache_alloc_bulk_noprof();
int io_add_buffers() {
long addr = io_add_buffers_pbuf_0;
int bid = io_add_buffers_pbuf_1,
allocated = ({
({
typeof(0) _res = kmem_cache_alloc_bulk_noprof();
_res;
});
});
while (allocated)
list_add_tail(&io_add_buffers_bufs[--allocated]->list);
addr = addr;
io_add_buffers_buf_1 = bid;
return 0;
}
```
```
$ clang --target=powerpc-linux-gnu -O2 -c -o /dev/null kbuf.i
clang: llvm/lib/Analysis/MemoryBuiltins.cpp:569: APInt getSizeWithOverflow(const SizeOffsetAPInt &): Assertion `!Offset.isNegative() && "size for a pointer before the allocated object is ambiguous"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang --target=powerpc-linux-gnu -O2 -c -o /dev/null kbuf.i
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'kbuf.i'.
4. Running pass 'Split GEPs to a variadic base and a constant offset for better CSE' on function '@io_add_buffers'
…
```
https://github.com/llvm/llvm-project/pull/116955
More information about the llvm-commits
mailing list