https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96323

            Bug ID: 96323
           Summary: [11 Regression] ICE in lex_raw_string, at
                    libcpp/lex.c:1764
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc-11.0.0-alpha20200719 snapshot (g:2e1b25350aa96b3f5678a056d0b55bb323c452d9)
ICEs when compiling the following testcase extracted from
gcc/testsuite/gcc.dg/c11-uni-string-1.c:

const char tu[] = R"a";
const char tua[] = "(R)a";

% gcc-11.0.0 -c rozdnj5v.c -wrapper valgrind,-q
rozdnj5v.c:1:24: error: invalid new-line in raw string delimiter
    1 | const char tu[] = R"a";
      |                   ^
==2536338== Conditional jump or move depends on uninitialised value(s)
==2536338==    at 0x18ADA46: lex_raw_string (lex.c:1764)
==2536338==    by 0x18ADA46: lex_string(cpp_reader*, cpp_token*, unsigned char
const*) (lex.c:2030)
==2536338==    by 0x18AE7FE: _cpp_lex_direct (lex.c:2862)
==2536338==    by 0x18AFD48: _cpp_lex_token (lex.c:2635)
==2536338==    by 0x18B7297: cpp_get_token_1(cpp_reader*, unsigned int*)
(macro.c:2810)
==2536338==    by 0x882F90: c_lex_with_flags(tree_node**, unsigned int*,
unsigned char*, int) (c-lex.c:457)
==2536338==    by 0x80156A: c_lex_one_token(c_parser*, c_token*, bool)
(c-parser.c:278)
==2536338==    by 0x82B1B1: c_parser_peek_token (c-parser.c:482)
==2536338==    by 0x82B1B1: c_parser_declaration_or_fndef(c_parser*, bool,
bool, bool, bool, bool, tree_node**, vec<c_token, va_heap, vl_ptr>, bool,
tree_node*, oacc_routine_data*, bool*) (c-parser.c:2268)
==2536338==    by 0x834683: c_parser_external_declaration(c_parser*)
(c-parser.c:1773)
==2536338==    by 0x835199: c_parser_translation_unit (c-parser.c:1646)
==2536338==    by 0x835199: c_parse_file() (c-parser.c:21822)
==2536338==    by 0x88EFBD: c_common_parse_file() (c-opts.c:1188)
==2536338==    by 0xDC48A2: compile_file() (toplev.c:458)
==2536338==    by 0x7A79F4: do_compile (toplev.c:2307)
==2536338==    by 0x7A79F4: toplev::main(int, char**) (toplev.c:2446)
==2536338==
rozdnj5v.c:1:1: internal compiler error: in lex_raw_string, at
libcpp/lex.c:1764
    1 | const char tu[] = R"a";
      | ^~~~~% gcc-11.0.0 -c rozdnj5v.c -wrapper valgrind,-q
rozdnj5v.c:1:24: error: invalid new-line in raw string delimiter
    1 | const char tu[] = R"a";
      |                   ^
==2536338== Conditional jump or move depends on uninitialised value(s)
==2536338==    at 0x18ADA46: lex_raw_string (lex.c:1764)
==2536338==    by 0x18ADA46: lex_string(cpp_reader*, cpp_token*, unsigned char
const*) (lex.c:2030)
==2536338==    by 0x18AE7FE: _cpp_lex_direct (lex.c:2862)
==2536338==    by 0x18AFD48: _cpp_lex_token (lex.c:2635)
==2536338==    by 0x18B7297: cpp_get_token_1(cpp_reader*, unsigned int*)
(macro.c:2810)
==2536338==    by 0x882F90: c_lex_with_flags(tree_node**, unsigned int*,
unsigned char*, int) (c-lex.c:457)
==2536338==    by 0x80156A: c_lex_one_token(c_parser*, c_token*, bool)
(c-parser.c:278)
==2536338==    by 0x82B1B1: c_parser_peek_token (c-parser.c:482)
==2536338==    by 0x82B1B1: c_parser_declaration_or_fndef(c_parser*, bool,
bool, bool, bool, bool, tree_node**, vec<c_token, va_heap, vl_ptr>, bool,
tree_node*, oacc_routine_data*, bool*) (c-parser.c:2268)
==2536338==    by 0x834683: c_parser_external_declaration(c_parser*)
(c-parser.c:1773)
==2536338==    by 0x835199: c_parser_translation_unit (c-parser.c:1646)
==2536338==    by 0x835199: c_parse_file() (c-parser.c:21822)
==2536338==    by 0x88EFBD: c_common_parse_file() (c-opts.c:1188)
==2536338==    by 0xDC48A2: compile_file() (toplev.c:458)
==2536338==    by 0x7A79F4: do_compile (toplev.c:2307)
==2536338==    by 0x7A79F4: toplev::main(int, char**) (toplev.c:2446)
==2536338==
rozdnj5v.c:1:1: internal compiler error: in lex_raw_string, at
libcpp/lex.c:1764
    1 | const char tu[] = R"a";
      | ^~~~~

In my setup the ICE only shows up when initializing memory allocations w/
arbitrary values using glibc's MALLOC_PERTURB_/MALLOC_CHECK_ or running the
compiler under valgrind.

Reply via email to