]> git.ipfire.org Git - thirdparty/gcc.git/commit
libcpp: Fix makeucnid bug with combining values [PR100977]
authorJakub Jelinek <jakub@redhat.com>
Thu, 5 Aug 2021 15:34:16 +0000 (17:34 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 5 Aug 2021 15:34:16 +0000 (17:34 +0200)
commit4805b92a32637b987f924463d6af9dcf95b21f63
tree87e01b489349f56524c1835a42e023174278e7b0
parent02e5ffd5db0e27f4113d25ab28afa27e4e32c79e
libcpp: Fix makeucnid bug with combining values [PR100977]

I've noticed in ucnid.h two adjacent lines that had all flags and combine
values identical and as such were supposed to be merged.

This is due to a bug in makeucnid.c, which records last_flag,
last_combine and really_safe of what has just been printed, but
because of a typo mishandles it for last_combine, always compares against
the combining_value[0] which is 0.

This has two effects on the table, one is that often the table is
unnecessarily large, as for non-zero .combine every character has its own
record instead of adjacent characters with the same flags and combine
being merged.  This means larger tables.
The other is that sometimes the last char that has combine set doesn't
actually have it in the tables, because the code is printing entries only
upon seeing the next character and if that character does have
combining_value of 0 and flags are otherwise the same as previously printed,
it will not print anything.

The following patch fixes that, for clarity what exactly it affects
I've regenerated with the same Unicode files as last time it has
been regenerated.

2021-08-05  Jakub Jelinek  <jakub@redhat.com>

PR c++/100977
* makeucnid.c (write_table): Fix computation of last_combine.
* ucnid.h: Regenerated using Unicode 6.3.0 files.
libcpp/makeucnid.c
libcpp/ucnid.h