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

            Bug ID: 91279
           Summary: [10 Regression] gcc ICE on invalid code on
                    x86_64-linux-gnu in "linemap_ordinary_map_lookup"
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shuo.d at outlook dot com
  Target Milestone: ---

The following invalid code causes an ICE when compiled with the current gcc
trunk on x86_64-linux-gnu. I think it's a problem with the C compiler front
end, but I'm not sure.

gcc-9 works fine, so it appears to be a 10 regression.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.0 20190727 (experimental) [trunk revision 273844] (GCC) 


$ gcc-trunk src.c 
src.c:1:35: error: expected expression before ‘a’
    1 | typedef char a ; f ( ) [ * sizeof a ] { }
      |                                   ^
src.c:1:35: internal compiler error: in linemap_ordinary_map_lookup, at
libcpp/line-map.c:985
0x178b153 linemap_ordinary_map_lookup
        ../../gcc/libcpp/line-map.c:985
0x178b696 get_range_from_loc(line_maps*, unsigned int)
        ../../gcc/libcpp/line-map.c:284
0x178b696 get_range_from_loc(line_maps*, unsigned int)
        ../../gcc/libcpp/line-map.c:273
0x176d310 get_finish
        ../../gcc/gcc/input.h:163
0x176d310 make_location(unsigned int, unsigned int, unsigned int)
        ../../gcc/gcc/input.c:894
0x89104e c_parser_unary_expression
        ../../gcc/gcc/c/c-parser.c:7320
0x89255f c_parser_cast_expression
        ../../gcc/gcc/c/c-parser.c:7245
0x8927d6 c_parser_binary_expression
        ../../gcc/gcc/c/c-parser.c:7048
0x893825 c_parser_conditional_expression
        ../../gcc/gcc/c/c-parser.c:6782
0x893e60 c_parser_expr_no_commas
        ../../gcc/gcc/c/c-parser.c:6699
0x89050e c_parser_direct_declarator_inner
        ../../gcc/gcc/c/c-parser.c:3850
0x8a6eb5 c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.c:2004
0x8af54f c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.c:1658
0x8aff71 c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.c:1539
0x8aff71 c_parse_file()
        ../../gcc/gcc/c/c-parser.c:20147
0x905f5b c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1160
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.



$ cat src.c 
typedef char a ; f ( ) [ * sizeof a ] { }

Reply via email to