On 08/31/2018 12:47 AM, Bernd Edlinger wrote: > On 08/30/18 09:07, Bernd Edlinger wrote: >> On 08/30/18 06:34, Jason Merrill wrote: >>> On 08/24/2018 03:52 PM, Bernd Edlinger wrote: >>>> this updated patch fixes one regression with current trunk due >>>> to a new test case. Sorry for the confusion. >>>> >>>> The change to the previous version is: >>>> 1) the check to avoid folding on empty char arrays is restored. >>>> 2) A null-termination character is added except when the string is full >>>> length. >>>> - && TYPE_STRING_FLAG (TREE_TYPE (valtype))) >>>> + tree typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (type)); >>>> + if (typ1 == char_type_node >>>> + || typ1 == signed_char_type_node >>>> + || typ1 == unsigned_char_type_node) >>> >>> Why stop using TYPE_STRING_FLAG? >>> >> No longer sure, I will try it with TYPE_STRING_FLAG. >> > This is an update that uses TYPE_STRING_FLAG. > It does not seem to make any difference, though. > > Bootstrapped and reg-tested on x86_64-pc-linux-gnu. > > > Is it OK for trunk? > > > Thanks > Bernd. > > > patch-bracedstr-v2.diff > > > c-family: > 2018-08-24 Bernd Edlinger <bernd.edlin...@hotmail.de> > > * c-common.c (braced_list_to_string): Remove eval parameter. > Add some more checks. Always create zero-terminated STRING_CST. > * c-common.h (braced_list_to_string): Adjust prototype. > > c: > 2018-08-24 Bernd Edlinger <bernd.edlin...@hotmail.de> > > * c-decl.c (finish_decl): Call braced_list_to_string here ... > * c-parser.c (c_parser_declaration_or_fndef): ... instead of here. > > > cp: > 2018-08-24 Bernd Edlinger <bernd.edlin...@hotmail.de> > > * decl.c (eval_check_narrowing): Remove. > (check_initializer): Move call to braced_list_to_string from here ... > * typeck2.c (store_init_value): ... to here. > (digest_init_r): Remove handing of signed/unsigned char strings. > > testsuite: > 2018-08-24 Bernd Edlinger <bernd.edlin...@hotmail.de> > > * c-c++-common/array-init.c: New test. > * g++.dg/init/string2.C: Remove xfail.
Thanks. Committed. Jeff