> Looks ok. I wonder if you want to explicitely document that max_size < size > doesn't have any effect on actual code generation and is not checked for.
Documentation amended to that effect: -- Built-in Function: void *__builtin_alloca_with_align_and_max (size_t size, size_t alignment, size_t max_size) Similar to `__builtin_alloca_with_align' but takes an extra argument specifying an upper bound for SIZE in case its value cannot be computed at compile time, for use by `-fstack-usage', `-Wstack-usage' and `-Walloca-larger-than' computations. MAX_SIZE has no effect on code generation and no attempt is made to check its compatibility with SIZE. > Also it seems that __builtin_alloca_with_align (20, 8, 16) will still > account 20 as the size and not 16 compared to 20 arriving in a variable > which is when 16 will be used. So at least for accounting always use MIN > (size, max_size)? The implementation is in keeping with the above documentation, i.e. SIZE will prevail if its value can be computed at compile time. -- Eric Botcazou