mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 11:26:06 +00:00

The CodeGen for __builtin_assume_aligned assumes that the first argument is a pointer, so crashes if the int-conversion error is downgraded or disabled. Emit a non-downgradable error if the argument is not a pointer, like we currently do for __builtin_launder. Fixes #110914.
10 lines
505 B
C
10 lines
505 B
C
// RUN: %clang_cc1 -fsyntax-only -Wno-int-conversion -triple x86_64-linux -verify %s
|
|
|
|
// Check that the pointer->int conversion error is not downgradable for the
|
|
// pointer argument to __builtin_assume_aligned.
|
|
|
|
int test(int *a, int b) {
|
|
a = (int *)__builtin_assume_aligned(b, 32); // expected-error {{non-pointer argument to '__builtin_assume_aligned' is not allowed}}
|
|
int *y = __builtin_assume_aligned(1, 1); // expected-error {{non-pointer argument to '__builtin_assume_aligned' is not allowed}}
|
|
}
|