[PATCH v5] newlib: libc: Fix crash on fprintf to a wide-oriented stream.
Christophe Lyon
christophe.lyon@linaro.org
Fri Nov 10 13:33:57 GMT 2023
On Fri, 10 Nov 2023 at 12:34, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
>
> On Fri, 10 Nov 2023 11:18:57 +0100
> Christophe Lyon wrote:
> > Hi!
> >
> > On Thu, 9 Nov 2023 at 16:36, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
> > >
> > > On Thu, 9 Nov 2023 13:49:41 +0100
> > > Corinna Vinschen wrote:
> > > > On Nov 9 19:26, Takashi Yano wrote:
> > > > > On Thu, 9 Nov 2023 11:08:03 +0100
> > > > > Corinna Vinschen wrote:
> > > > > > Looks good, please push.
> > > > >
> > > > > Thanks. Should this also be applied to cygwin-3_4-branch?
> > > >
> > > > Tricky question. It's a bugfix, yeah, but a bugfix for an undefined
> > > > situation. And it's also a behavioral change. So, from my POV we
> > > > shouldn't backport it.
> > >
> > > I see. I'll push it only for master branch.
> > >
> > > > But if you have another POV, we can discuss it. It occured to me that
> > > > you didn't mention where the testcase is coming from. Was that a
> > > > real-world problem? If so, where and in which circumstances?
> > >
> > > No. It was discovered by an accidental mistake while writing
> > > a test case for another problem.
> > >
> >
> > After this patch, our automated CI has detected regressions on arm-none-eabi
> > with GCC configured with:
> > --disable-multilib --with-mode=thumb --with-cpu=cortex-m33 --with-float=hard
> > (all these options are probably not mandatory, we have other
> > configurations pending in the build queue)
> >
> > The regressions appear in the libstdc++ tests:
> > Running libstdc++:libstdc++-dg/conformance.exp ...
> > FAIL: 27_io/objects/wchar_t/12048-1.cc -std=gnu++17 execution test
> > FAIL: 27_io/objects/wchar_t/12048-2.cc -std=gnu++17 execution test
> > FAIL: 27_io/objects/wchar_t/12048-3.cc -std=gnu++17 execution test
> > FAIL: 27_io/objects/wchar_t/12048-4.cc -std=gnu++17 execution test
> > XPASS: 27_io/objects/wchar_t/12048-5.cc -std=gnu++17 execution test
> > FAIL: ext/stdio_sync_filebuf/wchar_t/1.cc -std=gnu++17 execution test
> > FAIL: ext/stdio_sync_filebuf/wchar_t/12948-1.cc -std=gnu++17 execution test
> > FAIL: ext/stdio_sync_filebuf/wchar_t/12948-2.cc -std=gnu++17 execution test
> > FAIL: ext/stdio_sync_filebuf/wchar_t/12948-3.cc -std=gnu++17 execution test
> > FAIL: ext/stdio_sync_filebuf/wchar_t/12948-4.cc -std=gnu++17 execution test
> >
> > the logs show:
> > /libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc:37: void
> > test01(): Assertion 'std::wcin.good()' failed.
> > FAIL: 27_io/objects/wchar_t/12048-1.cc -std=gnu++17 execution test
> > /libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc:34: void
> > test01(): Assertion 'std::wcin.good()' failed.
> > FAIL: 27_io/objects/wchar_t/12048-2.cc -std=gnu++17 execution test
> > /libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc:34: void
> > test01(): Assertion 'std::wcin.rdbuf()->sgetn(buf, 2) == 2' failed.
> > FAIL: 27_io/objects/wchar_t/12048-3.cc -std=gnu++17 execution test
> > /libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc:31: void
> > test01(): Assertion 'std::wcin.rdbuf()->sgetn(buf, 2) == 2' failed.
> > FAIL: 27_io/objects/wchar_t/12048-4.cc -std=gnu++17 execution test
> > /libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc:43: void
> > test01(): Assertion 'traits_type::to_char_type(wsbuf.sgetc()) ==
> > w_lit[0]' failed.
> > FAIL: ext/stdio_sync_filebuf/wchar_t/1.cc -std=gnu++17 execution test
> > /libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-1.cc:31:
> > void test02(): Assertion 'c1 != WEOF' failed.
> > FAIL: ext/stdio_sync_filebuf/wchar_t/12948-1.cc -std=gnu++17 execution test
> > /libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-2.cc:31:
> > void test03(): Assertion 'c1 != WEOF' failed.
> > FAIL: ext/stdio_sync_filebuf/wchar_t/12948-2.cc -std=gnu++17 execution test
> > /libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-3.cc:31:
> > void test04(): Assertion 'sbuf.sgetn(buf, 2) == 2' failed.
> > FAIL: ext/stdio_sync_filebuf/wchar_t/12948-3.cc -std=gnu++17 execution test
> > /libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-4.cc:31:
> > void test05(): Assertion 'sbuf.sgetn(buf, 2) == 2' failed.
> > FAIL: ext/stdio_sync_filebuf/wchar_t/12948-4.cc -std=gnu++17 execution test
> >
> > I haven't dug further yet, does that ring a bell?
>
> Thanks for the report. Are these all of the additional failure?
Yes.
> I checked the previous patch and found the cause. I'll submit
> a patch to fix this.
>
> I confirmed the above errors are resolved with the new patch.
Great! Nice that you could reproduce and fix the problem so quickly!
Christophe
>
> --
> Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Newlib
mailing list