On Thu, 4 Apr 2024 at 17:29, Ulrich Drepper <drepper....@gmail.com> wrote: > > On Thu, Apr 4, 2024 at 5:29 PM Jonathan Wakely <jwak...@redhat.com> wrote: > > I would appreciate more eyes on this to confirm my conclusions about > > negative int_type values, and the proposed fix, make sense. > > The way something like this is handled in glibc's ctype functions is > that both branches are considered. For isXXX(c) whether c is -v or > 256-v the same value is returned (except for EOF which is -1). This > caused the least number of bad surprises. > > You could here also perform similar actions.
Yes, my first attempt to fix PR93672 did exactly that, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93672#c1 But since it doesn't work for '\xff' (because that's EOF when char is signed) it only handles 127 of the 128 possible bugs ;-) I'm also not sure it's conforming, since the standard specifies how the matching is done, and that won't match negative chars.