[PATCH] D99696: [clang] NRVO: Improvements and handling of more cases.

Anh Tuyen Tran via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 2 15:08:04 PDT 2021


anhtuyen added a comment.

Hi Mathew @mizvekov,
The commit 12c90e2e25dfd1d38250055efc21acb42d158912 <https://reviews.llvm.org/rG12c90e2e25dfd1d38250055efc21acb42d158912> from this patch seems to cause a regression, where an assertion failure starts to occur with testcases such as

  template <int A> int foo() {
    int a alignas(A) = 0;
    return a;
  }

To reproduce the issue, please try:

1. Reset the HEAD of your branch to commit 12c90e2e25dfd1d38250055efc21acb42d158912 <https://reviews.llvm.org/rG12c90e2e25dfd1d38250055efc21acb42d158912>, which was just before yours:

  git reset --hard 12c90e2e25dfd1d38250055efc21acb42d158912

2. Build llvm/clamg
3. Compile the above reduced testcase (let's call it test.cpp)

  bin/clang -std=c++11 -c test.cpp

4. There should be no warning nor error

5. Now, please pull in commit 12c90e2e25dfd1d38250055efc21acb42d158912 <https://reviews.llvm.org/rG12c90e2e25dfd1d38250055efc21acb42d158912>

  git pull origin 12c90e2e25dfd1d38250055efc21acb42d158912



6. Rebuild and rerun the above compilation command, you will see the following assertion failure

  clang: tools/clang/include/clang/AST/AttrImpl.inc:1750: unsigned int clang::AlignedAttr::getAlignment(clang::ASTContext &) const: Assertion `!isAlignmentDependent()' failed.

GCC does not have that assertion, either.

Can you have a look, please!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99696/new/

https://reviews.llvm.org/D99696



More information about the cfe-commits mailing list