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

            Bug ID: 91192
           Summary: [9 regression] non-deterministic ICE on invalid
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimhen at gmail dot com
  Target Milestone: ---

gcc -fpreprocessed -c x.i can
-- report error
-- ICE in linemap_macro_map_lookup, at libcpp/line-map.c:1003
-- crash_signal in get_location_from_adhoc_loc libcpp/line-map.c:257

r266365 PASS (?)
r266815 FAIL
r273505 FAIL

$ cat x.i
a() {
   b; 0( sizeof

$ /usr/local/gcc_current/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc_current/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: /home/dimhen/src/gcc_current/configure
--prefix=/usr/local/gcc_current --enable-checking=yes,df,fold,rtl,extra
--enable-languages=c,c++,lto --disable-multilib --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --with-tune=native
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.0 20190716 (experimental) [trunk revision 273505] (GCC) 


$ /usr/local/gcc_current/bin/gcc -fpreprocessed -c x.i
x.i:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    1 | a() {
      | ^
x.i: In function ‘a’:
x.i:2:4: error: ‘b’ undeclared (first use in this function)
    2 |    b; 0( sizeof
      |    ^
x.i:2:4: note: each undeclared identifier is reported only once for each
function it appears in
x.i:2:4: error: expected expression at end of input
x.i:2:7: error: called object is not a function or function pointer
    2 |    b; 0( sizeof
      |       ^
x.i:2:4: error: expected declaration or statement at end of input
    2 |    b; 0( sizeof
      |    ^


$ /usr/local/gcc_current/bin/gcc -fpreprocessed -c x.i
x.i:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    1 | a() {
      | ^
x.i: In function ‘a’:
x.i:2:4: error: ‘b’ undeclared (first use in this function)
    2 |    b; 0( sizeof
      |    ^
x.i:2:4: note: each undeclared identifier is reported only once for each
function it appears in
x.i:2:4: error: expected expression at end of input
x.i:2:4: internal compiler error: in linemap_macro_map_lookup, at
libcpp/line-map.c:1003
0x1a996ac linemap_macro_map_lookup
        /home/dimhen/src/gcc_current/libcpp/line-map.c:1003
0x1a996ac linemap_lookup(line_maps*, unsigned int)
        /home/dimhen/src/gcc_current/libcpp/line-map.c:937
0x1a9a29b get_pure_location(line_maps*, unsigned int)
        /home/dimhen/src/gcc_current/libcpp/line-map.c:331
0x1a7b43d get_pure_location
        /home/dimhen/src/gcc_current/gcc/input.h:147
0x1a7b43d make_location(unsigned int, unsigned int, unsigned int)
        /home/dimhen/src/gcc_current/gcc/input.c:891
0xa7c5b1 c_expr::get_location() const
        /home/dimhen/src/gcc_current/gcc/c/c-tree.h:159
0xa7c5b1 c_parser_expr_list
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9854
0xa7d03c c_parser_postfix_expression_after_primary
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9588
0xa6e5e1 c_parser_postfix_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9293
0xa782df c_parser_unary_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:7403
0xa79a6f c_parser_cast_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:7245
0xa79ce3 c_parser_binary_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:7048
0xa7ac15 c_parser_conditional_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:6782
0xa7b250 c_parser_expr_no_commas
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:6699
0xa7b4b1 c_parser_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9754
0xa7bbd7 c_parser_expression_conv
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9787
0xa8b3c3 c_parser_statement_after_labels
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:5616
0xa8d481 c_parser_compound_statement_nostart
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:5154
0xa8da18 c_parser_compound_statement
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:4988
0xa8f33e c_parser_declaration_or_fndef
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:2360
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.


[dimhen:dim E1]$ /usr/local/gcc_current/bin/gcc -fpreprocessed -c x.i
x.i:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    1 | a() {
      | ^
x.i: In function ‘a’:
x.i:2:4: error: ‘b’ undeclared (first use in this function)
    2 |    b; 0( sizeof
      |    ^
x.i:2:4: note: each undeclared identifier is reported only once for each
function it appears in
x.i:2:4: error: expected expression at end of input
x.i:2:4: internal compiler error: Segmentation fault
0xff774f crash_signal
        /home/dimhen/src/gcc_current/gcc/toplev.c:326
0x1a9a26c get_location_from_adhoc_loc(line_maps const*, unsigned int)
        /home/dimhen/src/gcc_current/libcpp/line-map.c:257
0x1a9a26c get_pure_location(line_maps*, unsigned int)
        /home/dimhen/src/gcc_current/libcpp/line-map.c:323
0x1a7b43d get_pure_location
        /home/dimhen/src/gcc_current/gcc/input.h:147
0x1a7b43d make_location(unsigned int, unsigned int, unsigned int)
        /home/dimhen/src/gcc_current/gcc/input.c:891
0xa7c5b1 c_expr::get_location() const
        /home/dimhen/src/gcc_current/gcc/c/c-tree.h:159
0xa7c5b1 c_parser_expr_list
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9854
0xa7d03c c_parser_postfix_expression_after_primary
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9588
0xa6e5e1 c_parser_postfix_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9293
0xa782df c_parser_unary_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:7403
0xa79a6f c_parser_cast_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:7245
0xa79ce3 c_parser_binary_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:7048
0xa7ac15 c_parser_conditional_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:6782
0xa7b250 c_parser_expr_no_commas
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:6699
0xa7b4b1 c_parser_expression
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9754
0xa7bbd7 c_parser_expression_conv
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:9787
0xa8b3c3 c_parser_statement_after_labels
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:5616
0xa8d481 c_parser_compound_statement_nostart
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:5154
0xa8da18 c_parser_compound_statement
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:4988
0xa8f33e c_parser_declaration_or_fndef
        /home/dimhen/src/gcc_current/gcc/c/c-parser.c:2360
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

Reply via email to