[PATCH] D89523: PR44406: Follow behavior of array bound constant folding in more recent versions of GCC.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 15 20:27:43 PDT 2020


efriedma added a comment.

Also update the documentation?  See https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes .



================
Comment at: clang/lib/Sema/SemaDecl.cpp:5939
+    ElemTy = TryToFixInvalidVariablyModifiedType(ElemTy, Context,
+                                                 SizeIsNegative, Oversized);
+    if (ElemTy.isNull())
----------------
It's a little surprising to me that you need new code here... was this case getting picked up by the SemaType code?


================
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)
----------------
We probably want some note to explain why OpenCL is special here... if you can't figure out easily, please leave a FIXME.


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