Index: clang/lib/CodeGen/CodeGenFunction.cpp =================================================================== --- clang/lib/CodeGen/CodeGenFunction.cpp +++ clang/lib/CodeGen/CodeGenFunction.cpp @@ -2521,7 +2521,7 @@ // Don't check pointers to volatile data. The behavior here is implementation- // defined. - if (Ty->getPointeeType().isVolatileQualified()) + if (!Ty->getPointeeType().isNull() && Ty->getPointeeType().isVolatileQualified()) return; // We need to temorairly remove the assumption so we can insert the Index: clang/test/CodeGen/ubsan-assume-aligned-crash.c =================================================================== --- /dev/null +++ clang/test/CodeGen/ubsan-assume-aligned-crash.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsanitize=alignment -emit-llvm %s -o /dev/null + +/* Testcase for PR45813 - clang crashes checking isVolatileQualified of isNull pointee. */ + +__attribute__((aligned(8))) int data[2]; + +int* test() { + return __builtin_assume_aligned(data, 8); +}