<div dir="ltr"><div dir="ltr">On Thu, 29 Oct 2020 at 19:32, Nico Weber <<a href="mailto:thakis@chromium.org">thakis@chromium.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Thu, Oct 29, 2020 at 6:10 PM Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Thu, 29 Oct 2020 at 08:07, Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Richard,<div><br></div><div>this fires on</div><div><br></div><div>thakis@thakis:~/src/llvm-project$ cat foo.m<br>static const int gSignals[] = { 0, 1, 2, 3, 4 };<br>static const int kNumSignals = sizeof(gSignals) / sizeof(gSignals[0]);<br>static int gPreviousSignalHandlers[kNumSignals];</div><div><br>thakis@thakis:~/src/llvm-project$ out/gn/bin/clang -c foo.m<br>foo.m:3:12: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant]<br>static int gPreviousSignalHandlers[kNumSignals];<br>           ^<br>1 warning generated.<br></div><div><br></div><div><br></div><div>Is that intentional? I don't see the VLA there.</div></div></blockquote><div><br></div><div>gPreviousSignalHandlers is a VLA. Unlike C++, C doesn't permit the use of a 'const int' variable in a constant expression.</div></div></div></blockquote><div><br></div><div>What's the suggested alternative?</div></div></div></blockquote><div><br></div><div>This should work reliably:</div><div><br></div><div>-static const int kNumSignals = sizeof(gSignals) / sizeof(gSignals[0]);<br></div><div>+enum { kNumSignals = sizeof(gSignals) / sizeof(gSignals[0]) };<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 16, 2020 at 5:34 PM Richard Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Richard Smith<br>
Date: 2020-10-16T14:34:35-07:00<br>
New Revision: 552c6c2328723a248c2b4d2765f75d49129dff20<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/552c6c2328723a248c2b4d2765f75d49129dff20" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/552c6c2328723a248c2b4d2765f75d49129dff20</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/552c6c2328723a248c2b4d2765f75d49129dff20.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/552c6c2328723a248c2b4d2765f75d49129dff20.diff</a><br>
<br>
LOG: PR44406: Follow behavior of array bound constant folding in more recent versions of GCC.<br>
<br>
Old GCC used to aggressively fold VLAs to constant-bound arrays at block<br>
scope in GNU mode. That's non-conforming, and more modern versions of<br>
GCC only do this at file scope. Update Clang to do the same.<br>
<br>
Also promote the warning for this from off-by-default to on-by-default<br>
in all cases; more recent versions of GCC likewise warn on this by<br>
default.<br>
<br>
This is still slightly more permissive than GCC, as pointed out in<br>
PR44406, as we still fold VLAs to constant arrays in structs, but that<br>
seems justifiable given that we don't support VLA-in-struct (and don't<br>
intend to ever support it), but GCC does.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D89523" rel="noreferrer" target="_blank">https://reviews.llvm.org/D89523</a><br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
    clang/docs/UsersManual.rst<br>
    clang/include/clang/Basic/DiagnosticSemaKinds.td<br>
    clang/lib/Sema/SemaDecl.cpp<br>
    clang/lib/Sema/SemaType.cpp<br>
    clang/test/CXX/basic/basic.types/p10.cpp<br>
    clang/test/CXX/drs/dr3xx.cpp<br>
    clang/test/CodeGen/vla.c<br>
    clang/test/Misc/warning-flags.c<br>
    clang/test/PCH/cxx-constexpr.cpp<br>
    clang/test/Profile/misexpect-switch-default.c<br>
    clang/test/Profile/misexpect-switch-nonconst.c<br>
    clang/test/Profile/misexpect-switch-only-default-case.c<br>
    clang/test/Profile/misexpect-switch.c<br>
    clang/test/Sema/builtin-assume.c<br>
    clang/test/Sema/builtins.c<br>
    clang/test/Sema/complex-int.c<br>
    clang/test/Sema/const-eval-64.c<br>
    clang/test/Sema/const-eval.c<br>
    clang/test/Sema/darwin-align-cast.c<br>
    clang/test/Sema/decl-in-prototype.c<br>
    clang/test/Sema/gnu-flags.c<br>
    clang/test/Sema/i-c-e.c<br>
    clang/test/Sema/offsetof-64.c<br>
    clang/test/Sema/rounding-math.c<br>
    clang/test/Sema/struct-decl.c<br>
    clang/test/Sema/typedef-variable-type.c<br>
    clang/test/Sema/vla.c<br>
    clang/test/SemaCXX/anonymous-struct.cpp<br>
    clang/test/SemaCXX/constant-expression.cpp<br>
    clang/test/SemaCXX/cxx1z-noexcept-function-type.cpp<br>
    clang/test/SemaCXX/i-c-e-cxx.cpp<br>
    clang/test/SemaObjC/gcc-cast-ext.m<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst<br>
index 473fbb6d8d04..9726a25f7f63 100644<br>
--- a/clang/docs/UsersManual.rst<br>
+++ b/clang/docs/UsersManual.rst<br>
@@ -2502,10 +2502,6 @@ Differences between all ``c*`` and ``gnu*`` modes:<br>
 -  The Apple "blocks" extension is recognized by default in ``gnu*`` modes<br>
    on some platforms; it can be enabled in any mode with the ``-fblocks``<br>
    option.<br>
--  Arrays that are VLA's according to the standard, but which can be<br>
-   constant folded by the frontend are treated as fixed size arrays.<br>
-   This occurs for things like "int X[(1, 2)];", which is technically a<br>
-   VLA. ``c*`` modes are strictly compliant and treat these as VLAs.<br>
<br>
 Differences between ``*89`` and ``*94`` modes:<br>
<br>
@@ -2594,10 +2590,12 @@ Intentionally unsupported GCC extensions<br>
    the extension appears to be rarely used. Note that clang *does*<br>
    support flexible array members (arrays with a zero or unspecified<br>
    size at the end of a structure).<br>
--  clang does not have an equivalent to gcc's "fold"; this means that<br>
-   clang doesn't accept some constructs gcc might accept in contexts<br>
-   where a constant expression is required, like "x-x" where x is a<br>
-   variable.<br>
+-  GCC accepts many expression forms that are not valid integer constant<br>
+   expressions in bit-field widths, enumerator constants, case labels,<br>
+   and in array bounds at global scope. Clang also accepts additional<br>
+   expression forms in these contexts, but constructs that GCC accepts due to<br>
+   simplifications GCC performs while parsing, such as ``x - x`` (where ``x`` is a<br>
+   variable) will likely never be accepted by Clang.<br>
 -  clang does not support ``__builtin_apply`` and friends; this extension<br>
    is extremely obscure and <br>
diff icult to implement reliably.<br>
<br>
<br>
diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td<br>
index b3b3bc723863..90a48ad7e93c 100644<br>
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td<br>
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td<br>
@@ -137,8 +137,9 @@ def err_vla_decl_has_static_storage : Error<<br>
   "variable length array declaration cannot have 'static' storage duration">;<br>
 def err_vla_decl_has_extern_linkage : Error<<br>
   "variable length array declaration cannot have 'extern' linkage">;<br>
-def ext_vla_folded_to_constant : Extension<<br>
-  "variable length array folded to constant array as an extension">, InGroup<GNUFoldingConstant>;<br>
+def ext_vla_folded_to_constant : ExtWarn<<br>
+  "variable length array folded to constant array as an extension">,<br>
+  InGroup<GNUFoldingConstant>;<br>
 def err_vla_unsupported : Error<<br>
   "variable length arrays are not supported for the current target">;<br>
 def note_vla_unsupported : Note<<br>
@@ -5474,8 +5475,6 @@ def warn_flag_enum_constant_out_of_range : Warning<<br>
   "enumeration value %0 is out of range of flags in enumeration type %1">,<br>
   InGroup<FlagEnum>;<br>
<br>
-def warn_illegal_constant_array_size : Extension<<br>
-  "size of static array must be an integer constant expression">;<br>
 def err_vm_decl_in_file_scope : Error<<br>
   "variably modified type declaration not allowed at file scope">;<br>
 def err_vm_decl_has_extern_linkage : Error<<br>
<br>
diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp<br>
index 8542c20ec069..5a38a9585d30 100644<br>
--- a/clang/lib/Sema/SemaDecl.cpp<br>
+++ b/clang/lib/Sema/SemaDecl.cpp<br>
@@ -5932,9 +5932,14 @@ static QualType TryToFixInvalidVariablyModifiedType(QualType T,<br>
   const VariableArrayType* VLATy = dyn_cast<VariableArrayType>(T);<br>
   if (!VLATy)<br>
     return QualType();<br>
-  // FIXME: We should probably handle this case<br>
-  if (VLATy->getElementType()->isVariablyModifiedType())<br>
-    return QualType();<br>
+<br>
+  QualType ElemTy = VLATy->getElementType();<br>
+  if (ElemTy->isVariablyModifiedType()) {<br>
+    ElemTy = TryToFixInvalidVariablyModifiedType(ElemTy, Context,<br>
+                                                 SizeIsNegative, Oversized);<br>
+    if (ElemTy.isNull())<br>
+      return QualType();<br>
+  }<br>
<br>
   Expr::EvalResult Result;<br>
   if (!VLATy->getSizeExpr() ||<br>
@@ -5950,16 +5955,18 @@ static QualType TryToFixInvalidVariablyModifiedType(QualType T,<br>
   }<br>
<br>
   // Check whether the array is too large to be addressed.<br>
-  unsigned ActiveSizeBits<br>
-    = ConstantArrayType::getNumAddressingBits(Context, VLATy->getElementType(),<br>
-                                              Res);<br>
+  unsigned ActiveSizeBits =<br>
+      (!ElemTy->isDependentType() && !ElemTy->isVariablyModifiedType() &&<br>
+       !ElemTy->isIncompleteType() && !ElemTy->isUndeducedType())<br>
+          ? ConstantArrayType::getNumAddressingBits(Context, ElemTy, Res)<br>
+          : Res.getActiveBits();<br>
   if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) {<br>
     Oversized = Res;<br>
     return QualType();<br>
   }<br>
<br>
-  return Context.getConstantArrayType(<br>
-      VLATy->getElementType(), Res, VLATy->getSizeExpr(), ArrayType::Normal, 0);<br>
+  return Context.getConstantArrayType(ElemTy, Res, VLATy->getSizeExpr(),<br>
+                                      ArrayType::Normal, 0);<br>
 }<br>
<br>
 static void<br>
@@ -5985,7 +5992,13 @@ FixInvalidVariablyModifiedTypeLoc(TypeLoc SrcTL, TypeLoc DstTL) {<br>
   ArrayTypeLoc DstATL = DstTL.castAs<ArrayTypeLoc>();<br>
   TypeLoc SrcElemTL = SrcATL.getElementLoc();<br>
   TypeLoc DstElemTL = DstATL.getElementLoc();<br>
-  DstElemTL.initializeFullCopy(SrcElemTL);<br>
+  if (VariableArrayTypeLoc SrcElemATL =<br>
+          SrcElemTL.getAs<VariableArrayTypeLoc>()) {<br>
+    ConstantArrayTypeLoc DstElemATL = DstElemTL.castAs<ConstantArrayTypeLoc>();<br>
+    FixInvalidVariablyModifiedTypeLoc(SrcElemATL, DstElemATL);<br>
+  } else {<br>
+    DstElemTL.initializeFullCopy(SrcElemTL);<br>
+  }<br>
   DstATL.setLBracketLoc(SrcATL.getLBracketLoc());<br>
   DstATL.setSizeExpr(SrcATL.getSizeExpr());<br>
   DstATL.setRBracketLoc(SrcATL.getRBracketLoc());<br>
@@ -6115,7 +6128,7 @@ Sema::CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *NewTD) {<br>
                                                       SizeIsNegative,<br>
                                                       Oversized);<br>
       if (FixedTInfo) {<br>
-        Diag(NewTD->getLocation(), diag::warn_illegal_constant_array_size);<br>
+        Diag(NewTD->getLocation(), diag::ext_vla_folded_to_constant);<br>
         NewTD->setTypeSourceInfo(FixedTInfo);<br>
       } else {<br>
         if (SizeIsNegative)<br>
@@ -7984,7 +7997,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {<br>
       return;<br>
     }<br>
<br>
-    Diag(NewVD->getLocation(), diag::warn_illegal_constant_array_size);<br>
+    Diag(NewVD->getLocation(), diag::ext_vla_folded_to_constant);<br>
     NewVD->setType(FixedT);<br>
     NewVD->setTypeSourceInfo(FixedTInfo);<br>
   }<br>
@@ -16675,7 +16688,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,<br>
                                                     SizeIsNegative,<br>
                                                     Oversized);<br>
     if (FixedTInfo) {<br>
-      Diag(Loc, diag::warn_illegal_constant_array_size);<br>
+      Diag(Loc, diag::ext_vla_folded_to_constant);<br>
       TInfo = FixedTInfo;<br>
       T = FixedTInfo->getType();<br>
     } else {<br>
<br>
diff  --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp<br>
index 5eb05bfcaee3..390b457792fe 100644<br>
--- a/clang/lib/Sema/SemaType.cpp<br>
+++ b/clang/lib/Sema/SemaType.cpp<br>
@@ -2273,13 +2273,9 @@ static ExprResult checkArraySize(Sema &S, Expr *&ArraySize,<br>
     }<br>
   } Diagnoser(VLADiag, VLAIsError);<br>
<br>
-  // FIXME: GCC does *not* allow folding here in general; see PR44406.<br>
-  // For GCC compatibility, we should remove this folding and leave it to<br>
-  // TryFixVariablyModifiedType to convert VLAs to constant array types.<br>
   ExprResult R = S.VerifyIntegerConstantExpression(<br>
       ArraySize, &SizeVal, Diagnoser,<br>
-      (S.LangOpts.GNUMode || S.LangOpts.OpenCL) ? Sema::AllowFold<br>
-                                                : Sema::NoFold);<br>
+      S.LangOpts.OpenCL ? Sema::AllowFold : Sema::NoFold);<br>
   if (Diagnoser.IsVLA)<br>
     return ExprResult();<br>
   return R;<br>
<br>
diff  --git a/clang/test/CXX/basic/basic.types/p10.cpp b/clang/test/CXX/basic/basic.types/p10.cpp<br>
index 31ef6b62cead..124a489dfebe 100644<br>
--- a/clang/test/CXX/basic/basic.types/p10.cpp<br>
+++ b/clang/test/CXX/basic/basic.types/p10.cpp<br>
@@ -139,6 +139,7 @@ constexpr int f(ArrBad) { return 0; } // expected-error {{1st parameter type 'Ar<br>
 constexpr int arb(int n) {<br>
   int a[n]; // expected-error {{variable of non-literal type 'int [n]' cannot be defined in a constexpr function}}<br>
 }<br>
+// expected-warning@+1 {{variable length array folded to constant array as an extension}}<br>
 constexpr long Overflow[ // expected-error {{constexpr variable cannot have non-literal type 'long const[(1 << 30) << 2]'}}<br>
     (1 << 30) << 2]{};   // expected-warning {{requires 34 bits to represent}}<br>
<br>
<br>
diff  --git a/clang/test/CXX/drs/dr3xx.cpp b/clang/test/CXX/drs/dr3xx.cpp<br>
index f297d5e930d0..be3169ceab76 100644<br>
--- a/clang/test/CXX/drs/dr3xx.cpp<br>
+++ b/clang/test/CXX/drs/dr3xx.cpp<br>
@@ -898,8 +898,8 @@ namespace dr367 { // dr367: yes<br>
   int c[true ? *new int : 4]; // expected-error 2{{variable length array}} expected-note {{read of uninitialized}}<br>
   int d[true ? 4 : *new int];<br>
 #if __cplusplus < 201103L<br>
-  // expected-error@-4 {{variable length array}} expected-error@-4 {{constant expression}}<br>
-  // expected-error@-3 {{variable length array}} expected-error@-3 {{constant expression}}<br>
+  // expected-error@-4 2{{variable length array}}<br>
+  // expected-error@-3 2{{variable length array}}<br>
 #endif<br>
 }<br>
<br>
<br>
diff  --git a/clang/test/CodeGen/vla.c b/clang/test/CodeGen/vla.c<br>
index 3142050149aa..ab7dac67d8d2 100644<br>
--- a/clang/test/CodeGen/vla.c<br>
+++ b/clang/test/CodeGen/vla.c<br>
@@ -210,3 +210,15 @@ void test9(int n, int a[static n]) { }<br>
 void test10(int a[static 0]) {}<br>
 // NULL-INVALID: define void @test10(i32* nonnull align 4 %a)<br>
 // NULL-VALID: define void @test10(i32* align 4 %a)<br>
+<br>
+const int constant = 32;<br>
+// CHECK: define {{.*}}pr44406(<br>
+int pr44406() {<br>
+  int n = 0;<br>
+  // Do not fold this VLA to an array of constant bound; that would miscompile<br>
+  // this testcase.<br>
+  char c[1][(constant - constant) + 3];<br>
+  // CHECK: store i32 1,<br>
+  sizeof(c[n = 1]);<br>
+  return n;<br>
+}<br>
<br>
diff  --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c<br>
index e4f9069b88c8..54e36e1e0884 100644<br>
--- a/clang/test/Misc/warning-flags.c<br>
+++ b/clang/test/Misc/warning-flags.c<br>
@@ -91,4 +91,4 @@ CHECK-NEXT:   warn_weak_import<br>
<br>
 The list of warnings in -Wpedantic should NEVER grow.<br>
<br>
-CHECK: Number in -Wpedantic (not covered by other -W flags): 27<br>
+CHECK: Number in -Wpedantic (not covered by other -W flags): 26<br>
<br>
diff  --git a/clang/test/PCH/cxx-constexpr.cpp b/clang/test/PCH/cxx-constexpr.cpp<br>
index cce3fd851217..6ec1c8467e07 100644<br>
--- a/clang/test/PCH/cxx-constexpr.cpp<br>
+++ b/clang/test/PCH/cxx-constexpr.cpp<br>
@@ -16,7 +16,7 @@ const int b = a;<br>
 #else<br>
<br>
 const int a = 5;<br>
-typedef int T[b]; // expected-error {{variable length array}} expected-error {{must be an integer constant expression}} expected-note {{initializer of 'b'}}<br>
+typedef int T[b]; // expected-error 2{{variable length array}} expected-note {{initializer of 'b'}}<br>
 // expected-note@14 {{here}}<br>
 typedef int T[5];<br>
<br>
<br>
diff  --git a/clang/test/Profile/misexpect-switch-default.c b/clang/test/Profile/misexpect-switch-default.c<br>
index 3d1079d79f96..900c0a5df31f 100644<br>
--- a/clang/test/Profile/misexpect-switch-default.c<br>
+++ b/clang/test/Profile/misexpect-switch-default.c<br>
@@ -10,7 +10,7 @@ void init_arry();<br>
<br>
 const int inner_loop = 1000;<br>
 const int outer_loop = 20;<br>
-const int arry_size = 25;<br>
+enum { arry_size = 25 };<br>
<br>
 int arry[arry_size] = {0};<br>
<br>
<br>
diff  --git a/clang/test/Profile/misexpect-switch-nonconst.c b/clang/test/Profile/misexpect-switch-nonconst.c<br>
index fb719c5a2d1d..1573df538ac2 100644<br>
--- a/clang/test/Profile/misexpect-switch-nonconst.c<br>
+++ b/clang/test/Profile/misexpect-switch-nonconst.c<br>
@@ -11,7 +11,7 @@ void init_arry();<br>
<br>
 const int inner_loop = 1000;<br>
 const int outer_loop = 20;<br>
-const int arry_size = 25;<br>
+enum { arry_size = 25 };<br>
<br>
 int arry[arry_size] = {0};<br>
<br>
<br>
diff  --git a/clang/test/Profile/misexpect-switch-only-default-case.c b/clang/test/Profile/misexpect-switch-only-default-case.c<br>
index 3886472e2b45..d6c68f07d092 100644<br>
--- a/clang/test/Profile/misexpect-switch-only-default-case.c<br>
+++ b/clang/test/Profile/misexpect-switch-only-default-case.c<br>
@@ -11,7 +11,7 @@ void init_arry();<br>
<br>
 const int inner_loop = 1000;<br>
 const int outer_loop = 20;<br>
-const int arry_size = 25;<br>
+enum { arry_size = 25 };<br>
<br>
 int arry[arry_size] = {0};<br>
<br>
<br>
diff  --git a/clang/test/Profile/misexpect-switch.c b/clang/test/Profile/misexpect-switch.c<br>
index a7f01bcc9986..c4fa5f90d440 100644<br>
--- a/clang/test/Profile/misexpect-switch.c<br>
+++ b/clang/test/Profile/misexpect-switch.c<br>
@@ -10,7 +10,7 @@ void init_arry();<br>
<br>
 const int inner_loop = 1000;<br>
 const int outer_loop = 20;<br>
-const int arry_size = 25;<br>
+enum { arry_size = 25 };<br>
<br>
 int arry[arry_size] = {0};<br>
<br>
<br>
diff  --git a/clang/test/Sema/builtin-assume.c b/clang/test/Sema/builtin-assume.c<br>
index 43b31375f200..932fb5c973eb 100644<br>
--- a/clang/test/Sema/builtin-assume.c<br>
+++ b/clang/test/Sema/builtin-assume.c<br>
@@ -23,7 +23,7 @@ int foo(int *a, int i) {<br>
   __builtin_assume(ispure(i) > 2);<br>
   __builtin_assume(ispure(++i) > 2); //expected-warning {{the argument to '__builtin_assume' has side effects that will be discarded}}<br>
<br>
-  int test = sizeof(struct{char qq[(__builtin_assume(i != 5), 7)];});<br>
+  int test = sizeof(struct{char qq[(__builtin_assume(i != 5), 7)];}); // expected-warning {{variable length array}}<br>
 #endif<br>
   return a[i];<br>
 }<br>
<br>
diff  --git a/clang/test/Sema/builtins.c b/clang/test/Sema/builtins.c<br>
index e4093edb5f00..e534f4727252 100644<br>
--- a/clang/test/Sema/builtins.c<br>
+++ b/clang/test/Sema/builtins.c<br>
@@ -141,7 +141,7 @@ typedef __typeof(sizeof(int)) size_t;<br>
 size_t strlen(const char *);<br>
<br>
 void test17() {<br>
-#define ASSERT(...) { int arr[(__VA_ARGS__) ? 1 : -1]; }<br>
+#define ASSERT(...) { enum { folded = (__VA_ARGS__) }; int arr[folded ? 1 : -1]; }<br>
 #define T(...) ASSERT(__builtin_constant_p(__VA_ARGS__))<br>
 #define F(...) ASSERT(!__builtin_constant_p(__VA_ARGS__))<br>
<br>
@@ -179,12 +179,12 @@ void test17() {<br>
   ASSERT(!OPT("abcd"));<br>
   // In these cases, the strlen is non-constant, but the __builtin_constant_p<br>
   // is 0: the array size is not an ICE but is foldable.<br>
-  ASSERT(!OPT(test17_c));        // expected-warning {{folded}}<br>
-  ASSERT(!OPT(&test17_c[0]));    // expected-warning {{folded}}<br>
-  ASSERT(!OPT((char*)test17_c)); // expected-warning {{folded}}<br>
-  ASSERT(!OPT(test17_d));        // expected-warning {{folded}}<br>
-  ASSERT(!OPT(&test17_d[0]));    // expected-warning {{folded}}<br>
-  ASSERT(!OPT((char*)test17_d)); // expected-warning {{folded}}<br>
+  ASSERT(!OPT(test17_c));        // expected-warning {{folding}}<br>
+  ASSERT(!OPT(&test17_c[0]));    // expected-warning {{folding}}<br>
+  ASSERT(!OPT((char*)test17_c)); // expected-warning {{folding}}<br>
+  ASSERT(!OPT(test17_d));        // expected-warning {{folding}}<br>
+  ASSERT(!OPT(&test17_d[0]));    // expected-warning {{folding}}<br>
+  ASSERT(!OPT((char*)test17_d)); // expected-warning {{folding}}<br>
<br>
 #undef OPT<br>
 #undef T<br>
<br>
diff  --git a/clang/test/Sema/complex-int.c b/clang/test/Sema/complex-int.c<br>
index f73b338c4010..4f7093256db5 100644<br>
--- a/clang/test/Sema/complex-int.c<br>
+++ b/clang/test/Sema/complex-int.c<br>
@@ -60,14 +60,16 @@ void test5(_Complex int *x) {<br>
   (*x)++;<br>
 }<br>
<br>
-int i1[(2+3i)*(5+7i) == 29i-11 ? 1 : -1];<br>
-int i2[(29i-11)/(5+7i) == 2+3i ? 1 : -1];<br>
-int i3[-(2+3i) == +(-3i-2) ? 1 : -1];<br>
-int i4[~(2+3i) == 2-3i ? 1 : -1];<br>
-int i5[(3i == -(-3i) ? ((void)3, 1i - 1) : 0) == 1i - 1 ? 1 : -1];<br>
+// None of these array bounds is an ICE due to the use of literals of<br>
+// non-integer type. But we can constant-fold all of them.<br>
+int i1[(2+3i)*(5+7i) == 29i-11 ? 1 : -1]; // expected-warning {{fold}}<br>
+int i2[(29i-11)/(5+7i) == 2+3i ? 1 : -1]; // expected-warning {{fold}}<br>
+int i3[-(2+3i) == +(-3i-2) ? 1 : -1]; // expected-warning {{fold}}<br>
+int i4[~(2+3i) == 2-3i ? 1 : -1]; // expected-warning {{fold}}<br>
+int i5[(3i == -(-3i) ? ((void)3, 1i - 1) : 0) == 1i - 1 ? 1 : -1]; // expected-warning {{fold}}<br>
<br>
-int f1[(2.0+3.0i)*(5.0+7.0i) == 29.0i-11.0 ? 1 : -1];<br>
-int f2[(29.0i-11.0)/(5.0+7.0i) == 2.0+3.0i ? 1 : -1];<br>
-int f3[-(2.0+3.0i) == +(-3.0i-2.0) ? 1 : -1];<br>
-int f4[~(2.0+3.0i) == 2.0-3.0i ? 1 : -1];<br>
-int f5[(3.0i == -(-3.0i) ? ((void)3.0, __extension__ (1.0i - 1.0)) : 0) == 1.0i - 1.0 ? 1 : -1];<br>
+int f1[(2.0+3.0i)*(5.0+7.0i) == 29.0i-11.0 ? 1 : -1]; // expected-warning {{fold}}<br>
+int f2[(29.0i-11.0)/(5.0+7.0i) == 2.0+3.0i ? 1 : -1]; // expected-warning {{fold}}<br>
+int f3[-(2.0+3.0i) == +(-3.0i-2.0) ? 1 : -1]; // expected-warning {{fold}}<br>
+int f4[~(2.0+3.0i) == 2.0-3.0i ? 1 : -1]; // expected-warning {{fold}}<br>
+int f5[(3.0i == -(-3.0i) ? ((void)3.0, __extension__ (1.0i - 1.0)) : 0) == 1.0i - 1.0 ? 1 : -1]; // expected-warning {{fold}}<br>
<br>
diff  --git a/clang/test/Sema/const-eval-64.c b/clang/test/Sema/const-eval-64.c<br>
index 1290bf4dd85d..f198b8bf5d14 100644<br>
--- a/clang/test/Sema/const-eval-64.c<br>
+++ b/clang/test/Sema/const-eval-64.c<br>
@@ -1,8 +1,7 @@<br>
 // RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-linux %s<br>
-// expected-no-diagnostics<br>
<br>
 #define EVAL_EXPR(testno, expr) int test##testno = sizeof(struct{char qq[expr];});<br>
<br>
 // <rdar://problem/10962435><br>
-EVAL_EXPR(1, ((char*)-1LL) + 1 == 0 ? 1 : -1)<br>
-EVAL_EXPR(2, ((char*)-1LL) + 1 < (char*) -1 ? 1 : -1)<br>
+EVAL_EXPR(1, ((char*)-1LL) + 1 == 0 ? 1 : -1) // expected-warning {{folded}}<br>
+EVAL_EXPR(2, ((char*)-1LL) + 1 < (char*) -1 ? 1 : -1) // expected-warning {{folded}}<br>
<br>
diff  --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c<br>
index bbcbb0e25237..c3cecc06cfcd 100644<br>
--- a/clang/test/Sema/const-eval.c<br>
+++ b/clang/test/Sema/const-eval.c<br>
@@ -1,6 +1,6 @@<br>
 // RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-linux %s -Wno-tautological-pointer-compare -Wno-pointer-to-int-cast<br>
<br>
-#define EVAL_EXPR(testno, expr) int test##testno = sizeof(struct{char qq[expr];});<br>
+#define EVAL_EXPR(testno, expr) enum { test##testno = (expr) }; struct check_positive##testno { int a[test##testno]; };<br>
 int x;<br>
 EVAL_EXPR(1, (_Bool)&x)<br>
 EVAL_EXPR(2, (int)(1.0+(double)4))<br>
@@ -14,12 +14,12 @@ EVAL_EXPR(8, (_Bool)"asdf")<br>
 EVAL_EXPR(9, !!&x)<br>
 EVAL_EXPR(10, ((void)1, 12))<br>
 void g0(void);<br>
-EVAL_EXPR(11, (g0(), 12)) // expected-error {{must have a constant size}}<br>
+EVAL_EXPR(11, (g0(), 12)) // expected-error {{not an integer constant expression}}<br>
 EVAL_EXPR(12, 1.0&&2.0)<br>
-EVAL_EXPR(13, x || 3.0) // expected-error {{must have a constant size}}<br>
+EVAL_EXPR(13, x || 3.0) // expected-error {{not an integer constant expression}}<br>
<br>
 unsigned int l_19 = 1;<br>
-EVAL_EXPR(14, (1 ^ l_19) && 1); // expected-error {{fields must have a constant size}}<br>
+EVAL_EXPR(14, (1 ^ l_19) && 1); // expected-error {{not an integer constant expression}}<br>
<br>
 void f()<br>
 {<br>
@@ -36,7 +36,7 @@ int g17[(3?:1) - 2];<br>
 EVAL_EXPR(18, ((int)((void*)10 + 10)) == 20 ? 1 : -1);<br>
<br>
 struct s {<br>
-  int a[(int)-1.0f]; // expected-error {{'a' declared as an array with a negative size}}<br>
+  int a[(int)-1.0f]; // expected-error {{array size is negative}}<br>
 };<br>
<br>
 EVAL_EXPR(19, ((int)&*(char*)10 == 10 ? 1 : -1));<br>
@@ -47,9 +47,9 @@ EVAL_EXPR(21, (__imag__ 2i) == 2 ? 1 : -1);<br>
<br>
 EVAL_EXPR(22, (__real__ (2i+3)) == 3 ? 1 : -1);<br>
<br>
-int g23[(int)(1.0 / 1.0)] = { 1 };<br>
-int g24[(int)(1.0 / 1.0)] = { 1 , 2 }; // expected-warning {{excess elements in array initializer}}<br>
-int g25[(int)(1.0 + 1.0)], g26 = sizeof(g25);<br>
+int g23[(int)(1.0 / 1.0)] = { 1 }; // expected-warning {{folded to constant array}}<br>
+int g24[(int)(1.0 / 1.0)] = { 1 , 2 }; // expected-warning {{folded to constant array}} expected-warning {{excess elements in array initializer}}<br>
+int g25[(int)(1.0 + 1.0)], g26 = sizeof(g25); // expected-warning {{folded to constant array}}<br>
<br>
 EVAL_EXPR(26, (_Complex double)0 ? -1 : 1)<br>
 EVAL_EXPR(27, (_Complex int)0 ? -1 : 1)<br>
@@ -116,17 +116,17 @@ EVAL_EXPR(42, __builtin_constant_p(pr11391.f = 1))<br>
 // PR12043<br>
 float varfloat;<br>
 const float constfloat = 0;<br>
-EVAL_EXPR(43, varfloat && constfloat) // expected-error {{must have a constant size}}<br>
+EVAL_EXPR(43, varfloat && constfloat) // expected-error {{not an integer constant expression}}<br>
<br>
 // <rdar://problem/10962435><br>
 EVAL_EXPR(45, ((char*)-1) + 1 == 0 ? 1 : -1)<br>
 EVAL_EXPR(46, ((char*)-1) + 1 < (char*) -1 ? 1 : -1)<br>
 EVAL_EXPR(47, &x < &x + 1 ? 1 : -1)<br>
 EVAL_EXPR(48, &x != &x - 1 ? 1 : -1)<br>
-EVAL_EXPR(49, &x < &x - 100 ? 1 : -1) // expected-error {{must have a constant size}}<br>
+EVAL_EXPR(49, &x < &x - 100 ? 1 : -1) // expected-error {{not an integer constant expression}}<br>
<br>
 extern struct Test50S Test50;<br>
-EVAL_EXPR(50, &Test50 < (struct Test50S*)((unsigned long)&Test50 + 10)) // expected-error {{must have a constant size}}<br>
+EVAL_EXPR(50, &Test50 < (struct Test50S*)((unsigned long)&Test50 + 10)) // expected-error {{not an integer constant expression}}<br>
<br>
 // <rdar://problem/11874571><br>
 EVAL_EXPR(51, 0 != (float)1e99)<br>
@@ -136,7 +136,7 @@ void PR21945() { int i = (({}), 0l); }<br>
<br>
 void PR24622();<br>
 struct PR24622 {} pr24622;<br>
-EVAL_EXPR(52, &pr24622 == (void *)&PR24622); // expected-error {{must have a constant size}}<br>
+EVAL_EXPR(52, &pr24622 == (void *)&PR24622); // expected-error {{not an integer constant expression}}<br>
<br>
 // We evaluate these by providing 2s' complement semantics in constant<br>
 // expressions, like we do for integers.<br>
<br>
diff  --git a/clang/test/Sema/darwin-align-cast.c b/clang/test/Sema/darwin-align-cast.c<br>
index 3a1824901277..114a1d9672c2 100644<br>
--- a/clang/test/Sema/darwin-align-cast.c<br>
+++ b/clang/test/Sema/darwin-align-cast.c<br>
@@ -1,5 +1,4 @@<br>
 // RUN: %clang_cc1 -fsyntax-only -Wno-pointer-to-int-cast -verify %s<br>
-// expected-no-diagnostics<br>
 typedef long unsigned int __darwin_size_t;<br>
 typedef long __darwin_ssize_t;<br>
 typedef __darwin_size_t size_t;<br>
@@ -18,6 +17,7 @@ i386/_param.h:#define __DARWIN_ALIGN(p) ((__darwin_size_t)((char *)(p)<br>
<br>
 ssize_t sendFileDescriptor(int fd, void *data, size_t nbytes, int sendfd) {<br>
   union {<br>
+    // expected-warning@+1 {{folded to constant array}}<br>
     char control[(((__darwin_size_t)((char *)(sizeof(struct cmsghdr)) + (sizeof(__darwin_size_t) - 1)) &~ (sizeof(__darwin_size_t) - 1)) + ((__darwin_size_t)((char *)(sizeof(int)) + (sizeof(__darwin_size_t) - 1)) &~ (sizeof(__darwin_size_t) - 1)))];<br>
   } control_un;<br>
   return 0;<br>
<br>
diff  --git a/clang/test/Sema/decl-in-prototype.c b/clang/test/Sema/decl-in-prototype.c<br>
index 64caea6a38a8..83e35a673390 100644<br>
--- a/clang/test/Sema/decl-in-prototype.c<br>
+++ b/clang/test/Sema/decl-in-prototype.c<br>
@@ -49,7 +49,7 @@ void f(struct q *, struct __attribute__((aligned(4))) q *); // expected-warning<br>
 // function.<br>
 enum { BB = 0 };<br>
 void enum_in_fun_in_fun(void (*fp)(enum { AA, BB } e)) { // expected-warning {{will not be visible}}<br>
-  SA(1, AA == 5);<br>
+  SA(1, AA == 5); // expected-error {{variable-sized object may not be initialized}}<br>
   SA(2, BB == 0);<br>
 }<br>
<br>
<br>
diff  --git a/clang/test/Sema/gnu-flags.c b/clang/test/Sema/gnu-flags.c<br>
index e7588b7b371e..e53e5fdf11df 100644<br>
--- a/clang/test/Sema/gnu-flags.c<br>
+++ b/clang/test/Sema/gnu-flags.c<br>
@@ -124,7 +124,9 @@ enum {<br>
        fic = (int)(0.75 * 1000 * 1000)<br>
 };<br>
 static const int size = 100;<br>
-void foo(void) { int data[size]; }<br>
+int data[size];<br>
+<br>
+void foo(void) { int data[size]; } // OK, always a VLA<br>
<br>
 #if ALL || REDECLAREDENUM<br>
 // expected-note@+4 {{previous definition is here}}<br>
<br>
diff  --git a/clang/test/Sema/i-c-e.c b/clang/test/Sema/i-c-e.c<br>
index e2d921b8ffd6..120f4b5f4889 100644<br>
--- a/clang/test/Sema/i-c-e.c<br>
+++ b/clang/test/Sema/i-c-e.c<br>
@@ -12,7 +12,7 @@ char w[__builtin_constant_p(expr) ? expr : 1];<br>
 char v[sizeof(__builtin_constant_p(0)) == sizeof(int) ? 1 : -1];<br>
<br>
 int implicitConversion = 1.0;<br>
-char floatArith[(int)(1.0+2.0)]; // expected-warning {{must be an integer constant expression}}<br>
+char floatArith[(int)(1.0+2.0)]; // expected-warning {{variable length array folded to constant array as an extension}}<br>
<br>
 // __builtin_constant_p as the condition of ?: allows arbitrary foldable<br>
 // constants to be transmogrified into i-c-e's.<br>
@@ -57,7 +57,7 @@ char z[__builtin_constant_p(4) ? 1 : -1];<br>
 int comma1[0?1,2:3];<br>
 int comma2[1||(1,2)]; // expected-warning {{use of logical '||' with constant operand}} \<br>
                       // expected-note {{use '|' for a bitwise operation}}<br>
-int comma3[(1,2)]; // expected-warning {{size of static array must be an integer constant expression}}<br>
+int comma3[(1,2)]; // expected-warning {{variable length array folded to constant array as an extension}}<br>
<br>
 // Pointer + __builtin_constant_p<br>
 char pbcp[__builtin_constant_p(4) ? (intptr_t)&expr : 0]; // expected-error {{variable length array declaration not allowed at file scope}}<br>
<br>
diff  --git a/clang/test/Sema/offsetof-64.c b/clang/test/Sema/offsetof-64.c<br>
index 4a80dee2fc2f..8ffc3af98588 100644<br>
--- a/clang/test/Sema/offsetof-64.c<br>
+++ b/clang/test/Sema/offsetof-64.c<br>
@@ -5,15 +5,15 @@<br>
 const unsigned long Size = (1l << 60);<br>
<br>
 struct Chunk1 {<br>
-  char padding[Size];<br>
-  char more_padding[1][Size];<br>
+  char padding[Size]; // expected-warning {{folded to constant}}<br>
+  char more_padding[1][Size]; // expected-warning {{folded to constant}}<br>
   char data;<br>
 };<br>
<br>
 int test1 = __builtin_offsetof(struct Chunk1, data);<br>
<br>
 struct Chunk2 {<br>
-  char padding[Size][Size][Size];  // expected-error 2{{array is too large}}<br>
+  char padding[Size][Size][Size];  // expected-error {{array is too large}}<br>
   char data;<br>
 };<br>
<br>
<br>
diff  --git a/clang/test/Sema/rounding-math.c b/clang/test/Sema/rounding-math.c<br>
index 3cb5d034b143..89951b1726db 100644<br>
--- a/clang/test/Sema/rounding-math.c<br>
+++ b/clang/test/Sema/rounding-math.c<br>
@@ -1,6 +1,7 @@<br>
-// RUN: %clang_cc1 -triple x86_64-linux -verify=norounding %s<br>
-// RUN: %clang_cc1 -triple x86_64-linux -std=c17 -verify=rounding-std %s -frounding-math<br>
-// RUN: %clang_cc1 -triple x86_64-linux -std=gnu17 -verify=rounding-gnu %s -frounding-math<br>
+// RUN: %clang_cc1 -triple x86_64-linux -std=c17 -verify=expected,norounding %s<br>
+// RUN: %clang_cc1 -triple x86_64-linux -std=gnu17 -verify=expected,norounding %s<br>
+// RUN: %clang_cc1 -triple x86_64-linux -std=c17 -verify=expected,rounding %s -frounding-math<br>
+// RUN: %clang_cc1 -triple x86_64-linux -std=gnu17 -verify=expected,rounding %s -frounding-math<br>
<br>
 #define fold(x) (__builtin_constant_p(x) ? (x) : (x))<br>
<br>
@@ -24,8 +25,11 @@ void bitfield(struct Bitfield *b) {<br>
 }<br>
<br>
 void vlas() {<br>
-  // Under -frounding-math, this is a VLA.<br>
-  // FIXME: Due to PR44406, in GNU mode we constant-fold the initializer resulting in a non-VLA.<br>
-  typedef int vla[(int)(-3 * (1.0 / 3.0))]; // norounding-error {{negative size}} rounding-gnu-error {{negative size}}<br>
-  struct X { vla v; }; // rounding-std-error {{fields must have a constant size}}<br>
+  // This is always a VLA due to its syntactic form.<br>
+  typedef int vla1[(int)(-3 * (1.0 / 3.0))];<br>
+  struct X1 { vla1 v; }; // expected-error {{fields must have a constant size}}<br>
+<br>
+  // This is always folded to a constant.<br>
+  typedef int vla2[fold((int)(-3 * (1.0 / 3.0)))]; // expected-error {{negative size}}<br>
+  struct X2 { vla2 v; };<br>
 }<br>
<br>
diff  --git a/clang/test/Sema/struct-decl.c b/clang/test/Sema/struct-decl.c<br>
index ee3e79182eaa..a119e59eab93 100644<br>
--- a/clang/test/Sema/struct-decl.c<br>
+++ b/clang/test/Sema/struct-decl.c<br>
@@ -5,8 +5,8 @@ struct bar {<br>
 };<br>
<br>
 struct foo {<br>
-  char name[(int)&((struct bar *)0)->n];<br>
-  char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{'name2' declared as an array with a negative size}}<br>
+  char name[(int)&((struct bar *)0)->n]; // expected-warning {{folded to constant}}<br>
+  char name2[(int)&((struct bar *)0)->n - 1]; // expected-error {{array size is negative}}<br>
 };<br>
<br>
 // PR3430<br>
<br>
diff  --git a/clang/test/Sema/typedef-variable-type.c b/clang/test/Sema/typedef-variable-type.c<br>
index 8a7ee8b911c0..da1c241eea3d 100644<br>
--- a/clang/test/Sema/typedef-variable-type.c<br>
+++ b/clang/test/Sema/typedef-variable-type.c<br>
@@ -1,8 +1,8 @@<br>
 // RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic -Wno-typedef-redefinition -std=c99<br>
<br>
 // Make sure we accept a single typedef<br>
-typedef int (*a)[!.0]; // expected-warning{{size of static array must be an integer constant expression}}<br>
+typedef int (*a)[!.0]; // expected-warning{{folded to constant array}}<br>
<br>
 // And make sure we accept identical redefinitions in system headers<br>
 // (The test uses -Wno-typedef-redefinition to simulate this.)<br>
-typedef int (*a)[!.0]; // expected-warning{{size of static array must be an integer constant expression}}<br>
+typedef int (*a)[!.0]; // expected-warning{{folded to constant array}}<br>
<br>
diff  --git a/clang/test/Sema/vla.c b/clang/test/Sema/vla.c<br>
index 8d83100b9d68..f49e8bbf5f7b 100644<br>
--- a/clang/test/Sema/vla.c<br>
+++ b/clang/test/Sema/vla.c<br>
@@ -53,7 +53,7 @@ int pr2044b;<br>
 int (*pr2044c(void))[pr2044b]; // expected-error {{variably modified type}}<br>
<br>
 const int f5_ci = 1;<br>
-void f5() { char a[][f5_ci] = {""}; } // expected-warning {{variable length array folded to constant array as an extension}}<br>
+void f5() { char a[][f5_ci] = {""}; } // expected-error {{variable-sized object may not be initialized}}<br>
<br>
 // PR5185<br>
 void pr5185(int a[*]);<br>
@@ -89,3 +89,14 @@ void VLAPtrAssign(int size) {<br>
   // Not illegal in C, program _might_ be well formed if size == 3.<br>
   int (*p4)[2][size][3][4][5] = array;<br>
 }<br>
+<br>
+void pr44406() {<br>
+  goto L; // expected-error {{cannot jump}}<br>
+  int z[(int)(1.0 * 2)]; // expected-note {{bypasses initialization of variable length array}}<br>
+L:;<br>
+}<br>
+<br>
+const int pr44406_a = 32;<br>
+typedef struct {<br>
+  char c[pr44406_a]; // expected-warning {{folded to constant array as an extension}}<br>
+} pr44406_s;<br>
<br>
diff  --git a/clang/test/SemaCXX/anonymous-struct.cpp b/clang/test/SemaCXX/anonymous-struct.cpp<br>
index f85b00bc8bce..1b6207d19e44 100644<br>
--- a/clang/test/SemaCXX/anonymous-struct.cpp<br>
+++ b/clang/test/SemaCXX/anonymous-struct.cpp<br>
@@ -131,6 +131,9 @@ namespace ValidButUnsupported {<br>
   typedef struct { // expected-error {{unsupported}}<br>
     enum X {};<br>
     int arr[&f<X> ? 1 : 2];<br>
+#if __cplusplus < 201103L<br>
+    // expected-warning@-2 {{folded to constant}}<br>
+#endif<br>
   } C; // expected-note {{by this typedef}}<br>
 }<br>
<br>
<br>
diff  --git a/clang/test/SemaCXX/constant-expression.cpp b/clang/test/SemaCXX/constant-expression.cpp<br>
index 82f9657d84f6..2bec62f46b66 100644<br>
--- a/clang/test/SemaCXX/constant-expression.cpp<br>
+++ b/clang/test/SemaCXX/constant-expression.cpp<br>
@@ -110,7 +110,7 @@ extern const int recurse1;<br>
 const int recurse2 = recurse1; // expected-note {{here}}<br>
 const int recurse1 = 1;<br>
 int array1[recurse1]; // ok<br>
-int array2[recurse2]; // expected-warning {{variable length array}} expected-warning {{integer constant expression}} expected-note {{initializer of 'recurse2' is not a constant expression}}<br>
+int array2[recurse2]; // expected-warning 2{{variable length array}} expected-note {{initializer of 'recurse2' is not a constant expression}}<br>
<br>
 namespace FloatConvert {<br>
   typedef int a[(int)42.3];<br>
<br>
diff  --git a/clang/test/SemaCXX/cxx1z-noexcept-function-type.cpp b/clang/test/SemaCXX/cxx1z-noexcept-function-type.cpp<br>
index 82ed724e1bd9..6cbc6b69e82f 100644<br>
--- a/clang/test/SemaCXX/cxx1z-noexcept-function-type.cpp<br>
+++ b/clang/test/SemaCXX/cxx1z-noexcept-function-type.cpp<br>
@@ -120,7 +120,7 @@ namespace Builtins {<br>
   extern "C" int strncmp(const char *, const char *, decltype(sizeof(0))) noexcept;<br>
<br>
   // Check we recognized both as builtins.<br>
-  typedef int arr[strcmp("bar", "foo") + 4 * strncmp("foo", "bar", 4)];<br>
+  typedef int arr[strcmp("bar", "foo") + 4 * strncmp("foo", "bar", 4)]; // expected-warning {{variable length array}}<br>
   typedef int arr[3];<br>
 }<br>
<br>
<br>
diff  --git a/clang/test/SemaCXX/i-c-e-cxx.cpp b/clang/test/SemaCXX/i-c-e-cxx.cpp<br>
index 2bfb67ffdf5b..a09ff5ac8d9f 100644<br>
--- a/clang/test/SemaCXX/i-c-e-cxx.cpp<br>
+++ b/clang/test/SemaCXX/i-c-e-cxx.cpp<br>
@@ -80,7 +80,7 @@ struct PR8836 { char _; long long a; };<br>
 #endif<br>
<br>
 int PR8836test[(__typeof(sizeof(int)))&reinterpret_cast<const volatile char&>((((PR8836*)0)->a))];<br>
-// expected-warning@-1 {{folded to constant array as an extension}}<br>
+// expected-warning@-1 0-1{{C99 feature}} expected-warning@-1 {{folded to constant array as an extension}}<br>
 // expected-note@-2 {{cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression}}<br>
<br>
 const int nonconst = 1.0;<br>
@@ -89,7 +89,7 @@ const int nonconst = 1.0;<br>
 #endif<br>
 int arr[nonconst];<br>
 #if __cplusplus <= 199711L<br>
-// expected-warning@-2 {{folded to constant array as an extension}}<br>
+// expected-warning@-2 0-1{{C99 feature}} expected-warning@-2 {{folded to constant array as an extension}}<br>
 // expected-note@-3 {{initializer of 'nonconst' is not a constant expression}}<br>
 #endif<br>
<br>
<br>
diff  --git a/clang/test/SemaObjC/gcc-cast-ext.m b/clang/test/SemaObjC/gcc-cast-ext.m<br>
index 9e9186070ffe..2eb707065d9f 100644<br>
--- a/clang/test/SemaObjC/gcc-cast-ext.m<br>
+++ b/clang/test/SemaObjC/gcc-cast-ext.m<br>
@@ -11,7 +11,7 @@ @interface PBXDocBookmark<br>
<br>
 // GCC allows pointer expressions in integer constant expressions.<br>
 struct {<br>
-  char control[((int)(char *)2)];<br>
+  char control[((int)(char *)2)]; // expected-warning {{extension}}<br>
 } xx;<br>
<br>
 @implementation PBXDocBookmark // expected-warning {{method definition for 'autorelease' not found}}\<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div>