[Bug c++/89796] Incorrect warning generated with OpenMP atomic capture

2019-03-25 Thread perard at cg dot uni-saarland.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89796

--- Comment #6 from Arsène Pérard-Gayot  ---
(In reply to Jakub Jelinek from comment #5)
> Created attachment 46018 [details]
> gcc9-pr89796.patch
> 
> Untested fix.
> 
> You could have used simpler
> #pragma omp atomic capture
> prev = c++;
> that wouldn't warn (so, if you want a workaround, use that).

Thank you for the workaround. Sadly, I cannot apply it to my problem, because
in my original code, the increment is not one. I need to do something like:

  #pragma omp atomic capture
  { prev = counter; counter += K; }

[Bug c++/89796] Incorrect warning generated with OpenMP atomic capture

2019-03-24 Thread perard at cg dot uni-saarland.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89796

--- Comment #2 from Arsène Pérard-Gayot  ---
(In reply to Nicholas Krause from comment #1)
> I just compiled this like so:
> ./bin/g++ test.cpp -fopenmp -Wall -fconcepts -o name test2.cpp 
> and got this on a build from yesterday:
> 
> g++: internal compiler error: Segmentation fault signal terminated program
> cc1plus
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See  for instructions.
> 
> This code is linked to another version of this
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88395 as it crashes before your
> warning issue. I posted to
> the list here about a possible fix yesterday for it:
> 
> https://gcc.gnu.org/ml/gcc/2019-03/msg00185.html

Could you please explain the connection with this bug? From what I see, what
you are reporting here is unrelated to the warning issue, and the segmentation
fault only occurs because of your use of the "-fconcepts" flag. Please correct
me if I am wrong.

[Bug c++/89796] New: Incorrect warning generated with OpenMP atomic capture

2019-03-22 Thread perard at cg dot uni-saarland.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89796

Bug ID: 89796
   Summary: Incorrect warning generated with OpenMP atomic capture
   Product: gcc
   Version: 8.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: perard at cg dot uni-saarland.de
  Target Milestone: ---

Created attachment 46012
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46012=edit
Sample code that reproduces the issue

Hello,

I get the warning "warning: value computed is not used [-Wunused-value]" when
compiling the attached code snippet with:

g++ test.cpp -fopenmp -Wall -o test

This warning is incorrect, as the value referred to by the warning is in fact
used. Moreover, the warning does not show up when OpenMP is disabled (by
omitting -fopenmp from the command line).