Ping 2 of the following patch:
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg00013.html
On 05/09/2016 10:38 AM, Martin Sebor wrote:
Pinging the following patch:
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg00013.html
On 05/01/2016 10:39 AM, Martin Sebor wrote:
c/68120 - can't easily deal with integer overflow at compile time,
is an enhancement request to make the integer overflow intrinsics
usable in constant expressions in C (in addition to letting them
be invoked with just two arguments).
The inability to use the built-ins in constant expressions also
limited to non-constexpr the contexts in which the patch for c++/
69517 - SEGV on a VLA with excess initializer elements, was able
to prevent the SEGV. This limitation is noted in c++/70507 -
integer overflow builtins not constant expressions.
The attached patch implements the request in c/68120 for both
the C and C++ front-ends. It stops short of providing the new
__builtin_add_wrapv function requested in c/68120. It doesn't
seem necessary since the same functionality is available with
the patch via the existing built-ins.
With this enhancement in place it will be possible to add the
C++ VLA checking to constexpr functions and fully resolve c++/
69517 (which I plan to do next).
While testing the patch, I also noticed an minor inconsistency
in the text of the diagnostic GCC issues for invalid calls to
the built-ins with insufficient numbers of arguments: for one
set of built-ins the error says: "not enough arguments," while
for another it says: "too few arguments." I raised PR c/70883
- inconsistent error message for calls to __builtin_add_overflow
with too few arguments, for this and include a fix in this patch
as well.
Martin
PS The enhancement to call the type-generic built-ins with a null
pointer is not available in C++ 98 mode because GCC doesn't allow
null pointers in constant expressions. Since C and later versions
of C++ do, it seems that it might be worthwhile to relax the rules
and accept them in C++ 98 as well so that the built-ins can be used
portably across all versions of C++.