This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix the damage done by my other patch from yesterday to strlenopt-49.c
- From: Richard Biener <rguenther at suse dot de>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, Jeff Law <law at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Martin Sebor <msebor at gmail dot com>
- Date: Mon, 30 Jul 2018 15:03:20 +0200 (CEST)
- Subject: Re: [PATCH] Fix the damage done by my other patch from yesterday to strlenopt-49.c
- References: <AM5PR0701MB26577C800216899DCF6647E6E42F0@AM5PR0701MB2657.eurprd07.prod.outlook.com>
On Mon, 30 Jul 2018, Bernd Edlinger wrote:
> Hi,
>
> this is how I would like to handle the over length strings issue in the C FE.
> If the string constant is exactly the right length and ends in one explicit
> NUL character, shorten it by one character.
>
> I thought Martin would be working on it, but as this is a really simple fix,
> I would dare to send it to gcc-patches anyway, hope you don't mind...
>
> The patch is relative to the other patch here: https://gcc.gnu.org/ml/gcc-patches/2018-07/msg01800.html
>
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
I'll leave this to FE maintainers but can I ask you to verify the
(other) FEs do not leak this kind of invalid initializers to the
middle-end? I suggest to put this verification in
output_constructor which otherwise happily truncates initializers
with excess size. There's also gimplification which might elide
a = { "abcd", "cdse" }; to a.x = "abcd"; a.y = "cdse"; but
hopefully there the GIMPLE verifier (verify_gimple_assign_single)
verifies this - well, it only dispatches to useless_type_conversion_p
(lhs_type, rhs1_type) for this case, but non-flexarrays should be
handled fine there.
Richard.