public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101297] New: Spurious comma accepted at the end of #pragma omp atomic
@ 2021-07-02 12:22 jakub at gcc dot gnu.org
  2021-07-02 12:23 ` [Bug c/101297] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-02 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101297
           Summary: Spurious comma accepted at the end of #pragma omp
                    atomic
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

int i;

void
foo (void)
{
  #pragma omp atomic update,    /* { dg-error "expected end of line before ','
token" } */
  i++;
  #pragma omp atomic update,,   /* { dg-error "expected end of line before ','
token" } */
  i++;
}

diagnoses with -fopenmp only the second error and not the first one (seems both
clang and ICC suffer from the same bug though).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/101297] Spurious comma accepted at the end of #pragma omp atomic
  2021-07-02 12:22 [Bug c/101297] New: Spurious comma accepted at the end of #pragma omp atomic jakub at gcc dot gnu.org
@ 2021-07-02 12:23 ` jakub at gcc dot gnu.org
  2021-07-02 12:29 ` jakub at gcc dot gnu.org
  2021-07-02 19:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-02 12:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-07-02
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/101297] Spurious comma accepted at the end of #pragma omp atomic
  2021-07-02 12:22 [Bug c/101297] New: Spurious comma accepted at the end of #pragma omp atomic jakub at gcc dot gnu.org
  2021-07-02 12:23 ` [Bug c/101297] " jakub at gcc dot gnu.org
@ 2021-07-02 12:29 ` jakub at gcc dot gnu.org
  2021-07-02 19:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-02 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 51102
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51102&action=edit
gcc12-pr101297.patch

Untested fix.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/101297] Spurious comma accepted at the end of #pragma omp atomic
  2021-07-02 12:22 [Bug c/101297] New: Spurious comma accepted at the end of #pragma omp atomic jakub at gcc dot gnu.org
  2021-07-02 12:23 ` [Bug c/101297] " jakub at gcc dot gnu.org
  2021-07-02 12:29 ` jakub at gcc dot gnu.org
@ 2021-07-02 19:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-02 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:2ca89394280da4afad6074ec3cb7136b6142af7b

commit r12-1990-g2ca89394280da4afad6074ec3cb7136b6142af7b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jul 2 21:57:24 2021 +0200

    openmp: Reject #pragma omp atomic update, [PR101297]

    I've noticed that we allow a trailing comma on OpenMP atomic construct
    if there is at least one clause.  Commas should be only allowed to
    separate the clauses (or in OpenMP 5.1 to separate directive name
    from the clauses).

    2021-07-02  Jakub Jelinek  <jakub@redhat.com>

            PR c/101297
            * c-parser.c (c_parser_omp_atomic): Consume comma only if it
            appears before a CPP_NAME.

            * parser.c (cp_parser_omp_atomic): Consume comma only if it
            appears before a CPP_NAME.

            * c-c++-common/gomp/atomic-24.c: New test.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-02 19:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02 12:22 [Bug c/101297] New: Spurious comma accepted at the end of #pragma omp atomic jakub at gcc dot gnu.org
2021-07-02 12:23 ` [Bug c/101297] " jakub at gcc dot gnu.org
2021-07-02 12:29 ` jakub at gcc dot gnu.org
2021-07-02 19:58 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).