public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libcpp: Make static checkers happy about makeuname2c [PR106778]
@ 2022-08-31  8:49 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-08-31  8:49 UTC (permalink / raw)
  To: gcc-patches

Hi!

The assertion ensures that we point within the image and at a byte
we haven't touched yet (or at least that it isn't the first byte
of an already stored tree), some static checker was unhappy about
first checking that it is zero and only afterwards checking that it
is within bounds.

Obviously nothing changes on the generated uname2c.h and while I've
bootstrapped/regtested it on x86_64-linux and i686-linux, the generator
is only used when built and run by hand (note, when updating to a newer
Unicode it won't be just a matter of rerunning it against newer files,
but one needs to update the generated_ranges according to Table 4-8
in the sources too).

Committed to trunk as obvious.

2022-08-31  Jakub Jelinek  <jakub@redhat.com>

	PR preprocessor/106778
	* makeuname2c.cc (write_nodes): Reverse order of && operands in
	assert.

--- libcpp/makeuname2c.cc.jj	2022-08-26 09:24:12.122615517 +0200
+++ libcpp/makeuname2c.cc	2022-08-30 17:28:20.171052344 +0200
@@ -451,7 +451,7 @@ write_nodes (struct node *n, size_t off)
 {
   for (; n; n = n->sibling)
     {
-      assert (tree[off] == 0 && off < tree_size);
+      assert (off < tree_size && tree[off] == 0);
       if (n->key_len > 1)
 	{
 	  assert (n->key_len < 64);

	Jakub


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-31  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31  8:49 [committed] libcpp: Make static checkers happy about makeuname2c [PR106778] Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).