This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix undefined behavior on g++.dg/pr77550.C (PR 77748)
- 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>
- Date: Wed, 28 Sep 2016 12:34:17 +0200 (CEST)
- Subject: Re: [PATCH] Fix undefined behavior on g++.dg/pr77550.C (PR 77748)
- Authentication-results: sourceware.org; auth=none
- References: <AM4PR0701MB21627C6F0B47BB949EA48570E4CF0@AM4PR0701MB2162.eurprd07.prod.outlook.com>
On Wed, 28 Sep 2016, Bernd Edlinger wrote:
> Hi,
>
> in this test case, c-reduce had created various forms of undefined
> behaviour, which did only show up on m68k and arm-none-eabi.
>
> Most notably the original problem did only happen when
> 512/sizeof(basic_string) = 7, but with a non-zero remainder.
> In the way that c-reduce used to reduce that structure
> there is an array of enum as a place holder.
> But that depends on sizeof(enum) to be 4, which is
> not the case on arm-none-eabi.
>
> Other problems come from a not-initialized _M_string_length
> which ends up in a memcmp crash.
>
> And the _Alloc_hider constructor, which is linked to
> libstdc++, but that works only as long as the signature
> of that function is not changed, so it turned out
> the test case would not link with gcc-6 for instance.
>
> I found no way how to write that template specialization
> without breaking the purpose of reproducing the
> original PR, because __attribute((noinline, noclone))
> seems to be completely ignored in this case.
>
> I made sure that PR 77550 can still be reproduced
> with this test case both on gcc-6 and trunk.
>
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
Yes.
Thanks,
Richard.
>
> Thanks
> Bernd.
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)