https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115960
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Anyways this is not a GCC issue. The AttrBuilder::addAllocSizeAttr is declared in the preprocessed source as: AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg, const std::optional<unsigned> &NumElemsArg); But the upstream is defined as: AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg, const Optional<unsigned> &NumElemsArg); https://github.com/hdoc/llvm-project/blob/a38b25fa77bdf1437c690494ae6d61179b3bb4f8/llvm/include/llvm/IR/Attributes.h#L1188 Also note https://github.com/llvm/llvm-project/commit/125f4457a54a550846732763ee36b1447ec8d66e Anyways this still not a GCC bug.