[clang] 76cf890 - Add some more C11 DR tests and update the status page

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 28 05:17:14 PDT 2022


Author: Aaron Ballman
Date: 2022-10-28T08:17:03-04:00
New Revision: 76cf890984bf091bfd9efd6dc7bf0ef96b8b9f45

URL: https://github.com/llvm/llvm-project/commit/76cf890984bf091bfd9efd6dc7bf0ef96b8b9f45
DIFF: https://github.com/llvm/llvm-project/commit/76cf890984bf091bfd9efd6dc7bf0ef96b8b9f45.diff

LOG: Add some more C11 DR tests and update the status page

Added: 
    

Modified: 
    clang/test/C/drs/dr4xx.c
    clang/www/c_dr_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/C/drs/dr4xx.c b/clang/test/C/drs/dr4xx.c
index c1e55f5153d12..e2cf2499d7f4f 100644
--- a/clang/test/C/drs/dr4xx.c
+++ b/clang/test/C/drs/dr4xx.c
@@ -48,6 +48,18 @@
  * diagnostic behavior, not runtime behavior. Also, both are a matter of QoI as
  * to what they optimize/diagnose. But if someone thinks of a way to test this,
  * we can add a test case for it then.
+ *
+ * WG14 DR448: yes
+ * What are the semantics of a # non-directive?
+ *
+ * WG14 DR454: yes
+ * ATOMIC_VAR_INIT (issues 3 and 4)
+ *
+ * WG14 DR455: yes
+ * ATOMIC_VAR_INIT issue 5
+ *
+ * WG14 DR459: yes
+ * atomic_load missing const qualifier
  */
 
 /* WG14 DR412: yes
@@ -162,3 +174,40 @@ void dr444(void) {
    */
   _Alignas(int) _Alignas(double) int k;
 }
+
+/* WG14 DR447: yes
+ * Boolean from complex
+ *
+ * Ensure that the imaginary part contributes to the conversion to bool, not
+ * just the real part.
+ */
+_Static_assert((_Bool)0.0 + 3.0 * (__extension__ 1.0iF), "");  /* c89only-warning {{'_Bool' is a C99 extension}}
+                                                                  expected-warning {{expression is not an integer constant expression; folding it to a constant is a GNU extension}}
+                                                                */
+_Static_assert(!(_Bool)0.0 + 0.0 * (__extension__ 1.0iF), ""); /* c89only-warning {{'_Bool' is a C99 extension}}
+                                                                  expected-warning {{expression is not an integer constant expression; folding it to a constant is a GNU extension}}
+                                                               */
+
+/* WG14 DR463: yes
+ * Left-shifting into the sign bit
+ *
+ * This DR was NAD and leaves shifting a bit into the high bit of a signed
+ * integer type undefined behavior, unlike in C++. Note, the diagnostic is also
+ * issued in C++ for shifting into that bit despite being well-defined because
+ * the code is questionable and should be validated by the programmer.
+ */
+void dr463(void) {
+  (void)(1 << (__CHAR_BIT__ * sizeof(int))); /* expected-warning {{shift count >= width of type}} */
+  (void)(1 << ((__CHAR_BIT__ * sizeof(int)) - 1));
+}
+
+/* WG14 DR464: yes
+ * Clarifying the Behavior of the #line Directive
+ *
+ * Note: the behavior described by this DR allows for two 
diff erent
+ * interpretations, but WG14 N2322 (adopted for C2x) adds a recommended
+ * practice which is what we're testing our interpretation against.
+ */
+#line 10000
+_Static_assert(__LI\
+NE__ == 10000, "");

diff  --git a/clang/www/c_dr_status.html b/clang/www/c_dr_status.html
index b0a54cf0b934c..ff5646de6b261 100644
--- a/clang/www/c_dr_status.html
+++ b/clang/www/c_dr_status.html
@@ -2327,7 +2327,7 @@ <h2 id="cdr">C defect report implementation status</h2>
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_447">447</a></td>
     <td>C11</td>
     <td>Boolean from complex</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="448">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_448">448</a></td>
@@ -2381,7 +2381,7 @@ <h2 id="cdr">C defect report implementation status</h2>
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_456">456</a></td>
     <td>Dup</td>
     <td>Compile time definition of UINTN_C(value)</td>
-    <td class="na" align="center">Duplicate of <a href="#209">209</a></td>
+    <td class="partial" align="center">Duplicate of <a href="#209">209</a></td>
   </tr>
   <tr id="457">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_457">457</a></td>
@@ -2399,7 +2399,7 @@ <h2 id="cdr">C defect report implementation status</h2>
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_459">459</a></td>
     <td>C11</td>
     <td>atomic_load missing const qualifier</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="460">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_460">460</a></td>
@@ -2423,13 +2423,13 @@ <h2 id="cdr">C defect report implementation status</h2>
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_463">463</a></td>
     <td>NAD</td>
     <td>Left-shifting into the sign bit</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="464">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_464">464</a></td>
     <td>C11</td>
     <td>Clarifying the Behavior of the #line Directive</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="465">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_465">465</a></td>


        


More information about the cfe-commits mailing list