On Fri, 16 Nov 2018, 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. > > Bootstrapped/regtested on x86_64-linux and i686-linux and tested with > a cross to avr. I'll defer adjusting testcases to the maintainers of 16-bit > ports. From the PR it seems gcc.dg/concat2.c, g++.dg/parse/concat1.C and > pr46534.c tests are affected. > > Ok for trunk?
OK with me. I'd hope at least one test (existing or new) would actually test the new diagnostic on 16-bit systems, rather than just those tests being disabled for affected platforms. -- Joseph S. Myers jos...@codesourcery.com