[PATCH] D89523: PR44406: Follow behavior of array bound constant folding in more recent versions of GCC.
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 15 22:17:19 PDT 2020
rsmith marked 3 inline comments as done.
rsmith added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:5939
+ ElemTy = TryToFixInvalidVariablyModifiedType(ElemTy, Context,
+ SizeIsNegative, Oversized);
+ if (ElemTy.isNull())
----------------
efriedma wrote:
> It's a little surprising to me that you need new code here... was this case getting picked up by the SemaType code?
Yes, and it previously didn't work outside GNU mode: https://godbolt.org/z/ncqKvo
I suppose that means that it probably isn't important to handle this, but we have a test for the multi-level VLA -> constant array case and it seemed easy enough to make it work.
================
Comment at: clang/lib/Sema/SemaType.cpp:2278
ArraySize, &SizeVal, Diagnoser,
- (S.LangOpts.GNUMode || S.LangOpts.OpenCL) ? Sema::AllowFold
- : Sema::NoFold);
+ S.LangOpts.OpenCL ? Sema::AllowFold : Sema::NoFold);
if (Diagnoser.IsVLA)
----------------
efriedma wrote:
> efriedma wrote:
> > We probably want some note to explain why OpenCL is special here... if you can't figure out easily, please leave a FIXME.
> Oh, I see you posted a separate patch for that.
For posterity, that's D89520.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89523/new/
https://reviews.llvm.org/D89523
More information about the cfe-commits
mailing list