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

            Bug ID: 88258
           Summary: [9 Regression] Infinite loop emitting diagnostics in
                    the C++ front-end
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++-9.0.0-alpha20181125 snapshot (r266441) enters infinite loop when compiling
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c w/ -fopenmp:

% timeout 0.0072 g++-9.0.0-alpha20181125 -fopenmp -c
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c: In function 'void f1()':
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:8:3: error: '_Atomic' was not declared in
this scope
    8 |   _Atomic int i = 0, k[4];
      |   ^~~~~~~
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:10:3: error: 'k' was not declared in this
scope
   10 |   k[0] = 0;
      |   ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:14:37: error: 'i' has not been declared
   14 |   #pragma omp parallel reduction (+:i)  /* { dg-error "'_Atomic' 'i' in
'reduction' clause" } */
      |                                     ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:15:5: error: 'i' was not declared in this
scope
   15 |     i++;
      |     ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:16:39: error: '_Atomic' does not name a
type
   16 |   #pragma omp declare reduction (foo: _Atomic int: omp_out += omp_in)
initializer (omp_priv = omp_orig * 0) /* { dg-error "'_Atomic' qualified type
in '#pragma omp declare reduction'" } */
      |                                       ^~~~~~~
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:16:46: error: expected ':' before 'int'
   16 |   #pragma omp declare reduction (foo: _Atomic int: omp_out += omp_in)
initializer (omp_priv = omp_orig * 0) /* { dg-error "'_Atomic' qualified type
in '#pragma omp declare reduction'" } */
      |                                              ^~~~
      |                                              :
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:20:39: error: 'i' has not been declared
   20 |   #pragma omp parallel reduction (bar:i) /* { dg-error "'_Atomic' 'i'
in 'reduction' clause" } */
      |                                       ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:21:5: error: 'i' was not declared in this
scope
   21 |     i++;
      |     ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c: At global scope:
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:29:18: error: expected ',' or '...'
before 'p'
   29 | f2 (int *_Atomic p)
      |                  ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c: In function 'void f2(int*)':
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:31:29: error: 'p' has not been declared
   31 |   #pragma omp simd aligned (p : 16)  /* { dg-error "'_Atomic' 'p' in
'aligned' clause" } */
      |                             ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:33:5: error: 'p' was not declared in this
scope
   33 |     p[i]++;
      |     ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c: At global scope:
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:36:1: error: '_Atomic' does not name a
type
   36 | _Atomic int x;
      | ^~~~~~~
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:39:13: error: variable or field 'f3'
declared void
   39 | f3 (_Atomic int *p)
      |             ^~~
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:39:5: error: '_Atomic' was not declared
in this scope
   39 | f3 (_Atomic int *p)
      |     ^~~~~~~
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:42:27: error: expected unqualified-id
before end of line
   42 |   #pragma omp atomic write
      |                           ^
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:42:27: error: expected unqualified-id
before end of line
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:42:27: error: expected unqualified-id
before end of line
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:42:27: error: expected unqualified-id
before end of line
gcc/testsuite/gcc.dg/gomp/_Atomic-3.c:42:27: error: expected unqualified-id
before end of line

<…>

Program received signal SIGINT, Interrupt.
0x00007ffff7ada988 in write () from /lib64/libc.so.6
(gdb) where
#0  0x00007ffff7ada988 in write () from /lib64/libc.so.6
#1  0x00007ffff7a70d0d in _IO_file_write () from /lib64/libc.so.6
#2  0x00007ffff7a6ff83 in new_do_write () from /lib64/libc.so.6
#3  0x00007ffff7a7154e in _IO_file_xsputn () from /lib64/libc.so.6
#4  0x00007ffff7a63c15 in fputs () from /lib64/libc.so.6
#5  0x000000000183d0e4 in pp_write_text_to_stream (pp=pp@entry=0x247dbc0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/pretty-print.c:840
#6  0x000000000183d169 in pp_flush (pp=0x247dbc0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/pretty-print.c:1467
#7  pp_flush (pp=0x247dbc0) at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/pretty-print.c:1462
#8  0x0000000001829e8a in diagnostic_report_diagnostic (context=0x2438e60
<global_diagnostic_context>, diagnostic=0x7fffffffc9a0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/diagnostic.c:1020
#9  0x000000000182a1de in diagnostic_impl
(richloc=richloc@entry=0x7fffffffcba0, opt=opt@entry=-1, 
    gmsgid=gmsgid@entry=0x24cff20 "expected unqualified-id before end of line",
ap=ap@entry=0x7fffffffca20, kind=kind@entry=DK_ERROR)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/diagnostic.c:1138
#10 0x000000000182be16 in error_at (richloc=richloc@entry=0x7fffffffcba0, 
    gmsgid=gmsgid@entry=0x24cff20 "expected unqualified-id before end of line")
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/diagnostic.c:1440
#11 0x0000000000a42e04 in c_parse_error (gmsgid=<optimized out>,
token_type=<optimized out>, value=<optimized out>, 
    token_flags=<optimized out>, richloc=0x7fffffffcba0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/c-family/c-common.c:6112
#12 0x000000000091bdf4 in cp_parser_error_1 (parser=0x7ffff7fcfab0,
gmsgid=0x18c1d5b "expected unqualified-id", 
    missing_token_desc=RT_NONE, matching_location=0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:2901
#13 0x0000000000943281 in cp_parser_unqualified_id (parser=0x7ffff7fcfab0,
template_keyword_p=<optimized out>, 
    check_dependency_p=<optimized out>, declarator_p=<optimized out>,
optional_p=<optimized out>)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:6185
#14 0x000000000094022e in cp_parser_declarator_id (optional_p=false,
parser=0x7ffff7fcfab0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:21419
#15 cp_parser_direct_declarator (friend_p=<optimized out>, member_p=<optimized
out>, ctor_dtor_or_conv_p=0x7fffffffcf7c, 
    dcl_kind=CP_PARSER_DECLARATOR_NAMED, parser=0x7ffff7fcfab0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:20696
#16 cp_parser_declarator (parser=0x7ffff7fcfab0,
dcl_kind=CP_PARSER_DECLARATOR_NAMED, ctor_dtor_or_conv_p=0x7fffffffcf7c, 
    parenthesized_p=<optimized out>, member_p=false, friend_p=false)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:20366
#17 0x000000000094e24f in cp_parser_init_declarator (parser=0x7ffff7fcfab0,
decl_specifiers=0x7fffffffd060, checks=0x0, 
    function_definition_allowed_p=<optimized out>, member_p=<optimized out>,
declares_class_or_enum=0, 
    function_definition_p=0x7fffffffd050, maybe_range_for_decl=0x0,
init_loc=0x7fffffffd04c, auto_result=0x7fffffffd058)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:19881
#18 0x0000000000930f40 in cp_parser_simple_declaration (parser=0x7ffff7fcfab0,
function_definition_allowed_p=<optimized out>, 
    maybe_range_for_decl=0x0) at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:13390
#19 0x000000000095596e in cp_parser_declaration (parser=0x7ffff7fcfab0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:13087
#20 0x00000000009560ff in cp_parser_translation_unit (parser=0x7ffff7fcfab0)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:4674
#21 c_parse_file () at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/cp/parser.c:40680
#22 0x0000000000a6193c in c_common_parse_file ()
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/c-family/c-opts.c:1151
#23 0x0000000000f07f3f in compile_file () at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/toplev.c:456
#24 0x000000000081663c in do_compile () at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/toplev.c:2176
#25 toplev::main (this=this@entry=0x7fffffffd426, argc=<optimized out>,
argc@entry=15, argv=<optimized out>, argv@entry=0x7fffffffd528)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/toplev.c:2311
#26 0x0000000000819cbf in main (argc=15, argv=0x7fffffffd528)
    at
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20181125/work/gcc-9-20181125/gcc/main.c:39

Reply via email to