middle-end/101292 - invalid memory access with warning control
authorRichard Biener <rguenther@suse.de>
Mon, 17 Jan 2022 14:22:11 +0000 (15:22 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 17 Jan 2022 15:16:49 +0000 (16:16 +0100)
commit1374d4b963a6ac2e0ec1645c09e5162e68b009d6
treec2742e65d590c4e12476f9b29a9d53aa0be1ba41
parentdeb9f18f67788c36f4652bca101d93faf07ecf39
middle-end/101292 - invalid memory access with warning control

The warning control falls into the C++ trap of using a reference
to old hashtable contents for a put operation which can end up
re-allocating that before reading from the old freed referenced to
source.  Fixed by introducing a temporary.

2022-01-17  Richard Biener  <rguenther@suse.de>

PR middle-end/101292
* diagnostic-spec.c (copy_warning): Make sure to not
reference old hashtable content on possible resize.
* warning-control.cc (copy_warning): Likewise.
gcc/diagnostic-spec.c
gcc/warning-control.cc