* [Bug string/29265] mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1)
2022-06-20 14:01 [Bug string/29265] New: mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1) goldstein.w.n at gmail dot com
@ 2022-06-21 2:37 ` siddhesh at sourceware dot org
2022-06-21 2:44 ` goldstein.w.n at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: siddhesh at sourceware dot org @ 2022-06-21 2:37 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29265
Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |siddhesh at sourceware dot org
Last reconfirmed| |2022-06-21
--- Comment #1 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
Agreed, the __attr_access ((__write_only__, 1, 3)) is incorrect for mbstowcs,
the former requires the size argument to accurately reflect the object argument
(i.e. 0 for a NULL pointer) whereas the mbstowcs implementation is expected to
ignore the size argument if the first argument is NULL. Would you like to
write a patch to fix this up?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug string/29265] mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1)
2022-06-20 14:01 [Bug string/29265] New: mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1) goldstein.w.n at gmail dot com
2022-06-21 2:37 ` [Bug string/29265] " siddhesh at sourceware dot org
@ 2022-06-21 2:44 ` goldstein.w.n at gmail dot com
2022-06-21 3:30 ` goldstein.w.n at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: goldstein.w.n at gmail dot com @ 2022-06-21 2:44 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29265
--- Comment #2 from Noah Goldstein <goldstein.w.n at gmail dot com> ---
Sure(In reply to Siddhesh Poyarekar from comment #1)
> Agreed, the __attr_access ((__write_only__, 1, 3)) is incorrect for
> mbstowcs, the former requires the size argument to accurately reflect the
> object argument (i.e. 0 for a NULL pointer) whereas the mbstowcs
> implementation is expected to ignore the size argument if the first argument
> is NULL. Would you like to write a patch to fix this up?
Sure.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug string/29265] mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1)
2022-06-20 14:01 [Bug string/29265] New: mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1) goldstein.w.n at gmail dot com
2022-06-21 2:37 ` [Bug string/29265] " siddhesh at sourceware dot org
2022-06-21 2:44 ` goldstein.w.n at gmail dot com
@ 2022-06-21 3:30 ` goldstein.w.n at gmail dot com
2022-06-21 3:46 ` siddhesh at sourceware dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: goldstein.w.n at gmail dot com @ 2022-06-21 3:30 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29265
--- Comment #3 from Noah Goldstein <goldstein.w.n at gmail dot com> ---
Created attachment 14157
--> https://sourceware.org/bugzilla/attachment.cgi?id=14157&action=edit
Potential Patch
Not able to reproduce the issue in glibc test suite so not fully confident in
this change.
Siddhesh, any ideas for how to get this error to throw in testmb.c?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug string/29265] mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1)
2022-06-20 14:01 [Bug string/29265] New: mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1) goldstein.w.n at gmail dot com
` (2 preceding siblings ...)
2022-06-21 3:30 ` goldstein.w.n at gmail dot com
@ 2022-06-21 3:46 ` siddhesh at sourceware dot org
2022-06-21 4:26 ` goldstein.w.n at gmail dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: siddhesh at sourceware dot org @ 2022-06-21 3:46 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29265
--- Comment #4 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
I'm not very picky about having a test for this FWIW, this seems very sensitive
to optimizations and may not survive gcc updates.
As for the fix, just remove the __attr_access ((__write_only__, 1, 3)), it's
incorrect in the context of mbstowcs definition.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug string/29265] mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1)
2022-06-20 14:01 [Bug string/29265] New: mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1) goldstein.w.n at gmail dot com
` (3 preceding siblings ...)
2022-06-21 3:46 ` siddhesh at sourceware dot org
@ 2022-06-21 4:26 ` goldstein.w.n at gmail dot com
2022-06-21 4:45 ` siddhesh at sourceware dot org
2022-08-06 9:16 ` vincent.vsmeets at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: goldstein.w.n at gmail dot com @ 2022-06-21 4:26 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29265
--- Comment #5 from Noah Goldstein <goldstein.w.n at gmail dot com> ---
(In reply to Siddhesh Poyarekar from comment #4)
> I'm not very picky about having a test for this FWIW, this seems very
> sensitive to optimizations and may not survive gcc updates.
>
> As for the fix, just remove the __attr_access ((__write_only__, 1, 3)),
> it's incorrect in the context of mbstowcs definition.
You don't think its worth preserving if dst is non-null? In that case it is
meaningful no?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug string/29265] mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1)
2022-06-20 14:01 [Bug string/29265] New: mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1) goldstein.w.n at gmail dot com
` (4 preceding siblings ...)
2022-06-21 4:26 ` goldstein.w.n at gmail dot com
@ 2022-06-21 4:45 ` siddhesh at sourceware dot org
2022-08-06 9:16 ` vincent.vsmeets at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: siddhesh at sourceware dot org @ 2022-06-21 4:45 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29265
--- Comment #6 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
(In reply to Noah Goldstein from comment #5)
> (In reply to Siddhesh Poyarekar from comment #4)
> > I'm not very picky about having a test for this FWIW, this seems very
> > sensitive to optimizations and may not survive gcc updates.
> >
> > As for the fix, just remove the __attr_access ((__write_only__, 1, 3)),
> > it's incorrect in the context of mbstowcs definition.
>
> You don't think its worth preserving if dst is non-null? In that case it is
> meaningful no?
It is meaningful, just that the check may trigger if the dest pointer has not
yet been simplified to a const. Although, maybe I'm overthinking it. Lets go
with what you have.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug string/29265] mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1)
2022-06-20 14:01 [Bug string/29265] New: mbstowcs with NULL dst throws an incorrect warning (glibc == 2.35, gcc=12.0.1) goldstein.w.n at gmail dot com
` (5 preceding siblings ...)
2022-06-21 4:45 ` siddhesh at sourceware dot org
@ 2022-08-06 9:16 ` vincent.vsmeets at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: vincent.vsmeets at gmail dot com @ 2022-08-06 9:16 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=29265
Vincent Smeets <vincent.vsmeets at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vincent.vsmeets at gmail dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread