[clang] [Clang] Fix crash on invalid pointer argument to `__builtin_assume_aligned` (PR #233112)

Akash Manna via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 18 07:20:47 PDT 2026


================
@@ -102,3 +102,54 @@ void foo() {
   f<int>(0); // expected-note {{in instantiation of function template specialization 'GH26612::f<int>' requested here}}
 }
 } // namespace GH26612
+
+namespace GH194289 {
+template<int qux>
+void bar() { // expected-note {{'bar' declared here}} expected-note {{possible target for call}}
+  int foo = (int *) __builtin_assume_aligned(baz, qux + 1);
+  // expected-error at -1 {{use of undeclared identifier 'baz'; did you mean 'bar'?}}
+  // expected-error at -2 {{reference to overloaded function could not be resolved}}
+  // expected-error at -3 {{cannot initialize a variable of type 'int'}}
----------------
akash-manna-sky wrote:

That was the reporter's reproducer kept verbatim. The cast and initializer play no part in the crash, so reduced to the `(void)` form. Thanks!


https://github.com/llvm/llvm-project/pull/233112


More information about the cfe-commits mailing list