On 11/16/18 3:43 AM, Jakub Jelinek wrote:
Hi!
Both C and C++ FE diagnose arrays larger than half of the address space:
/tmp/1.c:1:6: error: size of array ‘a’ is too large
char a[__SIZE_MAX__ / 2 + 1];
^
because one can't do pointer arithmetics on them. But we don't have
anything similar for string literals. As internally we use host int
as TREE_STRING_LENGTH, this is relevant to targets that have < 32-bit
size_t only.
The following patch adds that diagnostics and truncates the string literals.
Ok by me.
nathan
--
Nathan Sidwell