gcc/libcpp
David Malcolm 41fbacdd10 diagnostics: fix ICE on fix-it hints on very long lines [PR99323]
PR c/99323 describes an ICE due to a failed assertion deep inside the
fix-it printing machinery, where the fix-it hints on one line have not
been properly sorted in layout's constructor.

The underlying issue occurs when multiple fix-it hints affect a line
wider that LINE_MAP_MAX_COLUMN_NUMBER, where the location_t values for
characters after that threshold fall back to having column zero.

It's not meaningful to try to handle fix-it hints without column
information, so this patch rejects them as they are added to the
rich_location, falling back to the "no fix-it hints on this diagnostic"
case, fixing the crash.

gcc/ChangeLog:
	PR c/99323
	* diagnostic-show-locus.c
	(selftest::test_one_liner_many_fixits_2): Fix accidental usage of
	column 0.

gcc/testsuite/ChangeLog:
	PR c/99323
	* gcc.dg/pr99323-1.c: New test.
	* gcc.dg/pr99323-2.c: New test.

libcpp/ChangeLog:
	PR c/99323
	* line-map.c (rich_location::maybe_add_fixit): Reject fix-it hints
	at column 0.
2021-03-02 15:46:06 -05:00
..
include c++: Macro location fixes [PR 98718] 2021-02-24 12:46:09 -08:00
po Daily bump. 2021-02-20 00:16:26 +00:00
ChangeLog Daily bump. 2021-02-25 00:16:29 +00:00
ChangeLog.jit
Makefile.in Update copyright years. 2021-01-04 10:26:59 +01:00
aclocal.m4 libcpp: Enable Intel CET on Intel CET enabled host for jit 2020-05-12 09:17:45 -07:00
charset.c Update copyright years. 2021-01-04 10:26:59 +01:00
config.in
configure Require CET support only for the final GCC build 2020-07-30 05:36:24 -07:00
configure.ac libcpp, libdecnumber: configure and substitute AR 2020-05-23 21:59:02 +00:00
directives.c Update copyright years. 2021-01-04 10:26:59 +01:00
errors.c Update copyright years. 2021-01-04 10:26:59 +01:00
expr.c c++, libcpp: Use make_signed_t<size_t> in the 1z diagnostics 2021-02-04 18:30:45 +01:00
files.c c++: header-unit build capability [PR 99023] 2021-02-18 13:22:48 -08:00
generated_cpp_wcwidth.h libcpp: Update cpp_wcwidth() to Unicode 13.0.0 2020-11-07 09:36:43 -05:00
identifiers.c Update copyright years. 2021-01-04 10:26:59 +01:00
init.c c++: modules & -fpreprocessed [PR 99072] 2021-02-24 09:14:34 -08:00
internal.h c++: header-unit build capability [PR 99023] 2021-02-18 13:22:48 -08:00
lex.c libcpp: Fix up -fdirectives-only preprocessing [PR98882] 2021-02-03 23:18:05 +01:00
line-map.c diagnostics: fix ICE on fix-it hints on very long lines [PR99323] 2021-03-02 15:46:06 -05:00
location-example.txt
macro.c c++: header-unit build capability [PR 99023] 2021-02-18 13:22:48 -08:00
makeucnid.c Update copyright years. 2021-01-04 10:26:59 +01:00
mkdeps.c preprocessor: Make quoting : [PR 95253] 2021-01-15 08:56:20 -08:00
pch.c Update copyright years. 2021-01-04 10:26:59 +01:00
symtab.c Update copyright years. 2021-01-04 10:26:59 +01:00
system.h Update copyright years. 2021-01-04 10:26:59 +01:00
traditional.c Update copyright years. 2021-01-04 10:26:59 +01:00
ucnid.h Update copyright years. 2021-01-04 10:26:59 +01:00
ucnid.tab Update copyright years. 2021-01-04 10:26:59 +01:00