On Tue, Nov 10, 2015 at 06:38:31PM +0100, Paolo Carlini wrote:
>  Hi,
> 
> On 11/10/2015 05:36 PM, Marek Polacek wrote:
> >+
> >+            /* Did array size calculations overflow or does the array
> >+               cover more than half of the address-space?  */
> >+            if (COMPLETE_TYPE_P (type)
> >+                && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
> >+                && !valid_constant_size_p (TYPE_SIZE_UNIT (type)))
> >+              {
> >+                if (name)
> >+                  error_at (loc, "size of array %qE is too large", name);
> >+                else
> >+                  error_at (loc, "size of unnamed array is too large");
> >+                type = error_mark_node;
> >+              }
> >           }
> Obviously "the issue" predates your proposed change, but I don't understand
> why the code implementing the check can't be shared by the front-ends via a
> small function in c-family...

Certainly I'm in favor of sharing code between C and C++ FEs, though in
this case it didn't seem too important/obvious, because of the extra !=
error_mark_node check + I don't really like the new function getting *type
and setting it there.

But I'll submit another version of the patch with a common function.

        Marek

Reply via email to