json_parse_number broken by compiler optimization

Josef 'Jeff' Sipek jeff.sipek at open-xchange.com
Wed Mar 31 18:26:14 EEST 2021


On Wed, Mar 31, 2021 at 09:07:28 +0200, Christian Ehrhardt wrote:
> On Wed, Mar 31, 2021 at 8:46 AM Christian Ehrhardt <christian.ehrhardt at canonical.com> wrote:
> > On Tue, Mar 30, 2021 at 9:21 PM Josef 'Jeff' Sipek <jeff.sipek at open-xchange.com> wrote:
...
> > > The culprit seems to be LTO.  If you disable LTO, everything should work
> > > just fine.
> >
> > I've had LTO disabled and it has still shown the same effect (with my
> > gcc 10.2.0-1).
> > I'll give it a non-LTO retry and double check if it really changed the
> > compile options accordingly.
> > I'll let you know about that later on.
> 
> Indeed, I wonder what I tried yesterday in regard to LTO then .. :-/
> I can confirm that disabling LTO fixes the issue for me as well and
> for now that should be a good mitigation until the root cause is found
> and fixed.

Sounds good.  Thanks for the confirmation.

> Since it might help debugging the underlying problem with LTO here is
> another data point.
> With LTO enabled (and skipping the json-parser issues with my
> optimization trick) there is another testcase later that fails (but
> works with LTO disabled):
> 
> test-istream-attachment.c:354: Assert failed: memcmp(data +
> sizeof(BINARY_TEXT_LONG)-1, BINARY_TEXT_SHORT,
> strlen(BINARY_TEXT_SHORT)) == 0
> istream attachment ................................................... : FAILED

Yep, fails here as well.

...
> > >  So, I think that'll be the "official" workaround - and a much
> > > better one than disabling optimization completely.
> >
> > Well, "completely" is a bit hard, as I only disabled it on a single
> > function and not the full build :-)

Agreed ;)

Jeff.


More information about the dovecot mailing list