]> git.ipfire.org Git - thirdparty/gcc.git/commit
godump: Fix -fdump-go-spec= reproduceability issue [PR101407]
authorJakub Jelinek <jakub@redhat.com>
Wed, 14 Jul 2021 08:22:50 +0000 (10:22 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sun, 18 Jul 2021 10:57:24 +0000 (12:57 +0200)
commit31b76a815fc177dd579adc03b671ba9a8846ae6c
treeb8ee0b0b6c18098322dac56bd33edb412b27e88e
parent122cdd5b2153cb8d3a70d426d557fc245144223e
godump: Fix -fdump-go-spec= reproduceability issue [PR101407]

pot_dummy_types is a hash_set from whose traversal the code prints some type
lines.  hash_set normally uses default_hash_traits which for pointer types
(the hash set hashes const char *) uses pointer_hash which hashes the
addresses of the pointers except of the least significant 3 bits.
With address space randomization, that results in non-determinism in the
-fdump-go-specs= generated file, each invocation can have different order of
the lines emitted from pot_dummy_types traversal.

This patch fixes it by hashing the string contents instead to make the
hashes reproduceable.

2021-07-14  Jakub Jelinek  <jakub@redhat.com>

PR go/101407
* godump.c (godump_str_hash): New type.
(godump_container::pot_dummy_types): Use string_hash instead of
ptr_hash in the hash_set.

(cherry picked from commit 3be762c2ed79e36b9c8faaea2be04725c967a34e)
gcc/godump.c