diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-06 18:06:30 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-06 18:06:30 +0000 |
commit | 67376ed127cf14f2d6851b324b4f965bae441087 (patch) | |
tree | c0caa06ec8575f87392744b9a05b0b8aed5dddfc /libcpp | |
parent | 0762a4fcdc2e42e13dfcd0e7900dfbb5db763f94 (diff) | |
download | gcc-67376ed127cf14f2d6851b324b4f965bae441087.tar.gz |
Fix crash in selftest::test_lexer_string_locations_ucn4 (PR bootstrap/72823)
libcpp/ChangeLog:
PR bootstrap/72823
* charset.c (_cpp_valid_ucn): Replace overzealous assert with one
that allows for char_range to be non-NULL when loc_reader is NULL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239211 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/charset.c | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 3a530b7133a..f7cc1c410fa 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2016-08-06 David Malcolm <dmalcolm@redhat.com> + + PR bootstrap/72823 + * charset.c (_cpp_valid_ucn): Replace overzealous assert with one + that allows for char_range to be non-NULL when loc_reader is NULL. + 2016-08-05 David Malcolm <dmalcolm@redhat.com> * charset.c (cpp_substring_ranges::cpp_substring_ranges): New diff --git a/libcpp/charset.c b/libcpp/charset.c index 3739d6ca034..6a92ade272a 100644 --- a/libcpp/charset.c +++ b/libcpp/charset.c @@ -1027,7 +1027,7 @@ ucn_valid_in_identifier (cpp_reader *pfile, cppchar_t c, IDENTIFIER_POS is 0 when not in an identifier, 1 for the start of an identifier, or 2 otherwise. - If CHAR_RANGE and LOC_READER are non-NULL, then position information is + If LOC_READER is non-NULL, then position information is read from *LOC_READER and CHAR_RANGE->m_finish is updated accordingly. */ bool @@ -1042,10 +1042,6 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, const uchar *str = *pstr; const uchar *base = str - 2; - /* char_range and loc_reader must either be both NULL, or both be - non-NULL. */ - gcc_assert ((char_range != NULL) == (loc_reader != NULL)); - if (!CPP_OPTION (pfile, cplusplus) && !CPP_OPTION (pfile, c99)) cpp_error (pfile, CPP_DL_WARNING, "universal character names are only valid in C++ and C99"); @@ -1076,7 +1072,10 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, break; str++; if (loc_reader) - char_range->m_finish = loc_reader->get_next ().m_finish; + { + gcc_assert (char_range); + char_range->m_finish = loc_reader->get_next ().m_finish; + } result = (result << 4) + hex_value (c); } while (--length && str < limit); |