|
1 | 1 | Version 7.1 |
2 | 2 |
|
| 3 | +10/29/26 [GH #405] |
| 4 | +A suppressed note of a constant-evaluation error no longer stops the front end |
| 5 | + |
| 6 | +When constant evaluation fails, the front end attaches notes to the error |
| 7 | +"expression must have a constant value": "shift count is too large" (#63), |
| 8 | +"shift count is negative" (#62), "division by zero" (#39) and "integer |
| 9 | +operation result is out of range" (#61) among them. A note takes the severity |
| 10 | +of its own error number, so when --diag_suppress or a diag_suppress pragma |
| 11 | +named the number of the note, the note had a severity that could not be |
| 12 | +displayed and the front end stopped with an internal error (in the text |
| 13 | +output; the SARIF output listed the suppressed note as a related location): |
| 14 | + |
| 15 | + constexpr int z = 1 << 32; |
| 16 | + // --diag_suppress=63: internal error: assertion failed: |
| 17 | + // determine_severity_code: bad severity |
| 18 | + |
| 19 | +A suppressed note is now left out of the diagnostic, as a suppressed |
| 20 | +diagnostic always is, in the SARIF output too. The error itself is still |
| 21 | +reported. |
| 22 | + |
| 23 | + |
| 24 | +10/29/26 [GH #174] |
| 25 | +C- and C++-generating back ends: placement of GCC loop pragmas |
| 26 | + |
| 27 | +The GCC loop pragmas "#pragma GCC unroll", "#pragma GCC ivdep", and |
| 28 | +"#pragma GCC novector" were previously recorded in the IL as pragmas of the |
| 29 | +enclosing block and so were emitted by the C-generating back end at the start |
| 30 | +of that block, rather than immediately in front of the loop to which they |
| 31 | +apply. The back-end compiler then rejected the generated code. For example: |
| 32 | + |
| 33 | + void h(); |
| 34 | + void f(char *first, char *last) { |
| 35 | + h(); |
| 36 | + #pragma GCC unroll 4 // Previously emitted in front of the call of h, |
| 37 | + while (first != last) // causing a "for, while or do statement expected" |
| 38 | + ++first; // error from the back-end compiler. |
| 39 | + } |
| 40 | + |
| 41 | +In C99 and later modes, the C++-generating back end emitted such a pragma in |
| 42 | +front of the implicit block that surrounds an iteration statement, rather than |
| 43 | +in front of the loop inside it. A loop pragma that followed an iteration or |
| 44 | +selection statement was emitted inside that statement's implicit block. In |
| 45 | +both cases, the generated code could not be compiled. |
| 46 | + |
| 47 | +When the loop has attributes (e.g., "[[likely]]"), the C++-generating back |
| 48 | +end now emits the loop pragmas after those attributes when the generated code |
| 49 | +is for GCC, which requires a loop pragma to immediately precede the loop |
| 50 | +keyword, and before them when it is for Clang, which requires that order. |
| 51 | + |
| 52 | +The argument of "#pragma GCC unroll" is now scanned and evaluated as an |
| 53 | +integral constant expression, and its value replaces the original text in the |
| 54 | +generated code. Previously, the argument was copied unchanged, so one that |
| 55 | +used C++ constructs or template parameters made the generated C code invalid. |
| 56 | +For example: |
| 57 | + |
| 58 | + template<int N> void g(int *p) { |
| 59 | + #pragma GCC unroll(N) // Now emitted as "unroll 4" in g<4>. |
| 60 | + for (int i = 0; i < N; ++i) p[i] = 0; |
| 61 | + } |
| 62 | + void h(int *p) { |
| 63 | + #pragma GCC unroll sizeof(decltype(0)) // Now emitted as "unroll 4". |
| 64 | + for (int i = 0; i < 4; ++i) p[i] = 0; |
| 65 | + g<4>(p); |
| 66 | + } |
| 67 | + |
| 68 | +An argument that is negative or not less than 65535 is now diagnosed, as GCC |
| 69 | +does. |
| 70 | + |
| 71 | + |
| 72 | +10/29/26 [GH #414] |
| 73 | +Class-type template parameter objects in function template signatures |
| 74 | + |
| 75 | +A nontype template parameter of class type denotes a template parameter |
| 76 | +object, which is a const lvalue. When such a parameter was used in the |
| 77 | +signature of a function template, substituting template arguments treated |
| 78 | +it as a prvalue instead. As a result, decltype applied to the |
| 79 | +parenthesized parameter name produced the class type rather than a const |
| 80 | +lvalue reference to it (causing a spurious "unexpected function type" |
| 81 | +error), member accesses through the parameter had the wrong value category, |
| 82 | +and taking the address of the parameter caused substitution to fail. That |
| 83 | +is now fixed. For example, with --c++20: |
| 84 | + |
| 85 | + struct A { }; |
| 86 | + template <A V> void f(decltype((V)) v) { } |
| 87 | + template <A V> auto g() -> decltype(&V); |
| 88 | + void h() { |
| 89 | + constexpr A a; |
| 90 | + f<a>(a); // Previously an "unexpected function type" error. |
| 91 | + g<a>(); // Previously, no instance of g matched. |
| 92 | + } |
| 93 | + |
| 94 | + |
| 95 | +10/29/26 [GH #397] |
| 96 | +Constant evaluation of virtual calls to an overrider in a base class |
| 97 | + |
| 98 | +During constant evaluation, a virtual function call whose final overrider is |
| 99 | +a member of an intermediate base class (rather than of the most derived |
| 100 | +class) was evaluated with the complete object as the object expression, |
| 101 | +instead of the base class subobject of which the overrider is a member. For |
| 102 | +example, with --c++20: |
| 103 | + |
| 104 | + struct A { constexpr virtual int f() const { return 1; } int a = 1; }; |
| 105 | + struct B : A { constexpr int f() const override { return a + 2; } }; |
| 106 | + struct E { int e = 0; }; |
| 107 | + struct F : E, B {}; |
| 108 | + constexpr int g() { F f; A& r = f; return r.f(); } |
| 109 | + static_assert(g() == 3); // Previously failed. |
| 110 | + |
| 111 | +This is now fixed. In addition, the adjustment of the result of a call to |
| 112 | +an overrider with a covariant return type (e.g., from a pointer to a derived |
| 113 | +class to a pointer to its base class) was computed incorrectly, and was |
| 114 | +applied even to a null pointer result (which could cause the front end to |
| 115 | +crash); this is also fixed. |
| 116 | + |
| 117 | + |
| 118 | +10/29/26 [GH #324] |
| 119 | +Implicit "this" in a default member initializer with a nested aggregate |
| 120 | + |
| 121 | +When the default member initializer of an aggregate class contained an |
| 122 | +aggregate initialization of another object of the same class, an implicit use |
| 123 | +of "this" in the elements of that nested initialization referred to the |
| 124 | +nested object instead of to the object being initialized. This affected |
| 125 | +initializations that are not folded to constants, such as those in |
| 126 | +new-expressions or return statements. For example: |
| 127 | + |
| 128 | + struct Y { unsigned k; unsigned n = Y{2, k}.n; }; |
| 129 | + Y *p = new Y{1}; // p->n is now 1 (previously 2). |
| 130 | + |
| 131 | +This is now fixed. |
| 132 | + |
| 133 | + |
| 134 | +10/29/26 [GH #412] |
| 135 | +Unrecognized attribute with a pack expansion in its arguments |
| 136 | + |
| 137 | +In a variadic template, an unrecognized attribute whose arguments referenced a |
| 138 | +parameter pack (e.g., in a pack expansion) was treated as a pack expansion of |
| 139 | +the attribute as a whole. As a result, the C++-generating back end could put |
| 140 | +out a spurious "..." after the attribute when generating a template from its |
| 141 | +IL, and instantiations could receive the wrong number of copies of the |
| 142 | +attribute (e.g., one per pack element, or none for an empty pack). For |
| 143 | +example, in Clang mode: |
| 144 | + |
| 145 | + template <class... M> struct scoped_lock { |
| 146 | + scoped_lock(M&... m) __attribute__((acquire_capability(m...))) {} |
| 147 | + }; |
| 148 | + |
| 149 | +could be generated as |
| 150 | + |
| 151 | + scoped_lock(M &...m) __attribute((acquire_capability(m ... )...)) { } |
| 152 | + |
| 153 | +That is now fixed. |
| 154 | + |
| 155 | + |
3 | 156 | 10/28/26 [GH #400] |
4 | 157 | Order of destruction of array elements in constant evaluation |
5 | 158 |
|
|
0 commit comments