This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] integer overflow checking builtins in constant expressions


On 06/07/2016 08:32 AM, Jason Merrill wrote:
On 06/06/2016 08:36 AM, Jakub Jelinek wrote:
@@ -352,6 +352,35 @@ builtin_valid_in_constant_expr_p (const_
     case BUILT_IN_FUNCTION:
     case BUILT_IN_LINE:

+      /* The following built-ins are valid in constant expressions
+     when their arguments are.  */
+    case BUILT_IN_ADD_OVERFLOW:
+    case BUILT_IN_ADD_OVERFLOW_P:
....

Why is this necessary?  builtin_valid_in_constant_expr_p is only needed
for builtins that can have constant values even if their operands are
non-constant, which doesn't apply here.

For that matter, I don't see why we needed to add _FUNCTION et al, either.

I don't remember what prompted me to change the function in either
patch.  Perhaps it was the comment above the function that says
this:

/* Test whether DECL is a builtin that may appear in a
   constant-expression. */

But removing the change doesn't seem to affect the C++ test results
for the two features so it looks like the change may not be needed.

Unless I hear otherwise I'll submit a separate patch removing
the BUILTIN_FILE, FUNCTION, and LINE labels (and adjust the
comment to more closely reflect the function's purpose).  I'll
leave it to Jakub to tweak this patch.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]