public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109999] New: [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause
@ 2023-05-26 19:35 burnus at gcc dot gnu.org
  2023-05-26 19:53 ` [Bug c/109999] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-05-26 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109999
           Summary: [OpenMP] Bogus error message: talks about '"#pragma
                    omp" clause' instead of '"target" clause
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: diagnostic, openmp
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

I just spotted with gcc and g++; IMHO the error message is
misleading/wrong/odd, however, it does not seem to be a regression.

Namely I get:

tests/5.0/allocate/test_allocate_on_device.c:27:43:
error: expected ‘#pragma omp’ clause before ‘uses_allocators’
   27 | #pragma omp target map(tofrom: errors, A)
uses_allocators(omp_default_mem_alloc)
      |                                           ^~~~~~~~~~~~~~~


EXPECTED: instead of "expected '#pragma omp' clause"
it should be show:   "expected 'target' clause".

Found when compiling:
g++ --free-line-length-none -fopenmp -I ompvv
tests/5.0/allocate/test_allocate_on_device.c

which is part of https://github.com/SOLLVE/sollve_vv

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

* [Bug c/109999] [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause
  2023-05-26 19:35 [Bug c/109999] New: [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause burnus at gcc dot gnu.org
@ 2023-05-26 19:53 ` pinskia at gcc dot gnu.org
  2023-05-29 18:05 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
<source>: In function 'test_allocate_on_device':
<source>:27:43: error: expected '#pragma omp' clause before 'uses_allocators'
   27 | #pragma omp target map(tofrom: errors, A)
uses_allocators(omp_default_mem_alloc)
      |                                           ^~~~~~~~~~~~~~~


It is because uses_allocators is not implemented yet.

If you do this:
```
int test_allocate_on_device() {
#pragma omp target hhh
  for(int i = 0;i < 10;i++);
}
```
GCC will produce a similar error message.
If you replace hhh with simd, it will work.

I suspect the error message is correct in the sense an omp clause there is
still valid too. it does not know if it will be either a target or a normal
clause .

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

* [Bug c/109999] [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause
  2023-05-26 19:35 [Bug c/109999] New: [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause burnus at gcc dot gnu.org
  2023-05-26 19:53 ` [Bug c/109999] " pinskia at gcc dot gnu.org
@ 2023-05-29 18:05 ` burnus at gcc dot gnu.org
  2023-05-30 10:58 ` cvs-commit at gcc dot gnu.org
  2023-05-30 11:10 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-05-29 18:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 55188
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55188&action=edit
Patch implementing the wording change "'#pragma omp/acc' clause" → "an
OpenMP/ACC clause" (untested)

I think the following wording is clearer, i.e.
- instead of:
  error: expected ‘#pragma omp’ clause before ‘uses_allocators’
+ now:
  error: expected an OpenMP clause before ‘uses_allocators’

(I could imagine even a more helpful wording in this case, but I think that
change is sufficient; The "before ..." (here: "before %qE") is appended via
c_parser_error → c_parser_error_richloc → c_parse_error.)

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

* [Bug c/109999] [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause
  2023-05-26 19:35 [Bug c/109999] New: [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause burnus at gcc dot gnu.org
  2023-05-26 19:53 ` [Bug c/109999] " pinskia at gcc dot gnu.org
  2023-05-29 18:05 ` burnus at gcc dot gnu.org
@ 2023-05-30 10:58 ` cvs-commit at gcc dot gnu.org
  2023-05-30 11:10 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-30 10:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:a899401404186843f38462c8fc9de733f19ce864

commit r14-1404-ga899401404186843f38462c8fc9de733f19ce864
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue May 30 12:49:09 2023 +0200

    OpenMP: Improve C/C++ parsing error message [PR109999]

    Replace
      error: expected '#pragma omp' clause before ...
    by the the more readable/clearer
      error: expected an OpenMP clause before ...

    (And likewise for '#pragma acc' and OpenACC.)

            PR c/109999

    gcc/c/ChangeLog:

            * c-parser.cc (c_parser_oacc_all_clauses,
            c_parser_omp_all_clauses): Improve error wording.

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_oacc_all_clauses,
            cp_parser_omp_all_clauses): Improve error wording.

    gcc/testsuite/ChangeLog:

            * c-c++-common/goacc/asyncwait-1.c: Update dg-error.
            * c-c++-common/goacc/clauses-fail.c: Likewise.
            * c-c++-common/goacc/data-2.c: Likewise.
            * c-c++-common/gomp/declare-target-2.c: Likewise.
            * c-c++-common/gomp/directive-1.c: Likewise.
            * g++.dg/goacc/data-1.C: Likewise.

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

* [Bug c/109999] [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause
  2023-05-26 19:35 [Bug c/109999] New: [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-05-30 10:58 ` cvs-commit at gcc dot gnu.org
@ 2023-05-30 11:10 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-05-30 11:10 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED for mainline/GCC 14.

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

end of thread, other threads:[~2023-05-30 11:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 19:35 [Bug c/109999] New: [OpenMP] Bogus error message: talks about '"#pragma omp" clause' instead of '"target" clause burnus at gcc dot gnu.org
2023-05-26 19:53 ` [Bug c/109999] " pinskia at gcc dot gnu.org
2023-05-29 18:05 ` burnus at gcc dot gnu.org
2023-05-30 10:58 ` cvs-commit at gcc dot gnu.org
2023-05-30 11:10 ` burnus 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).