[Bug c++/101731] [9/10/11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.c:4055

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 22 16:07:29 GMT 2021


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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:1aedb3920a45bfe75db4514502b4e7f83e108f63

commit r12-5451-g1aedb3920a45bfe75db4514502b4e7f83e108f63
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Nov 22 17:06:12 2021 +0100

    openacc: Fix up C++ #pragma acc routine handling [PR101731]

    The following testcase ICEs because two function declarations are nested in
    each other and the acc routine handling code isn't prepared to put the
    pragma on both.

    The fix is similar to what #pragma omp declare {simd,variant} does,
    in particular set the fndecl_seen flag already in cp_parser_late_parsing*
    when we encounter it rather than only after we finalize it.

    In cp_finalize_oacc_routine I had to move the fndecl_seen diagnostics to
    non-FUNCTION_DECL block, because for FUNCTION_DECLs the flag is already
    known to be set from cp_parser_late_parsing_oacc_routine, but can't be
    removed altogether, because that regresses quality of 2 goacc/routine-5.c
    diagnostics - we drop "a single " from the
    '#pragma acc routine' not immediately followed by a single function
declaration or definition
    diagnostic say on
     #pragma acc routine
     int foo (), b;
    if we drop it altogether.

    2021-11-22  Jakub Jelinek  <jakub@redhat.com>

            PR c++/101731
            * parser.c (cp_parser_late_parsing_oacc_routine): Set
            parser->oacc_routine->fndecl_seen here, rather than ...
            (cp_finalize_oacc_routine): ... here.  Don't error if
            parser->oacc_routine->fndecl_seen is set for FUNCTION_DECLs.

            * c-c++-common/goacc/routine-6.c: New test.


More information about the Gcc-bugs mailing list