Skip to content
Snippets Groups Projects
user avatar
Iain Sandoe authored
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: default avatarIain 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.
e4641191
History
Name Last commit Last update