aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-11-13 12:26:16 +0000
committerIain Sandoe <iain@sandoe.co.uk>2021-11-16 19:42:35 +0000
commite4641191287ca613529d78a906afe4f029c1c3cd (patch)
tree36b948e20a0b63f8c27845aa38866e73534dd0ec /gcc/fortran/resolve.c
parent4cdf7db9a39d18bd536d816a5751d4d3cf23808b (diff)
downloadgcc-e4641191287ca613529d78a906afe4f029c1c3cd.zip
gcc-e4641191287ca613529d78a906afe4f029c1c3cd.tar.gz
gcc-e4641191287ca613529d78a906afe4f029c1c3cd.tar.bz2
PCH: Make the save and restore diagnostics more robust.
When saving, if we cannot obtain a suitable memory segment there is no point in continuing, so exit with an error. When reading in the PCH, we have a situation that the read-in data will replace the line tables used by the diagnostics output. However, the state of the read-oin line tables is indeterminate at some points where diagnostics might be needed. To make this more robust, we save the existing line tables at the start and, once we have read in the pointer to the new one, put that to one side and restore the original table. This avoids compiler hangs if the read or memory acquisition code issues an assert, fatal_error, segv etc. Once the read is complete, we swap in the new line table that came from the PCH. If the read-in PCH is corrupted then we still have a broken compilation w.r.t any future diagnostics - but there is little that can be done about that without more careful validation of the file. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * ggc-common.c (gt_pch_save): If we cannot find a suitable memory segment for save, then error-out, do not try to continue. (gt_pch_restore): Save the existing line table, and when the replacement is being read, use that when constructing diagnostics.
Diffstat (limited to 'gcc/fortran/resolve.c')
0 files changed, 0 insertions, 0 deletions