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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 62681
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62681&action=edit
Draft patch, lightly tested

It also seems to handle the following fine:

    3 | 1345 format("The count is ", g0)
      |    1
......
    9 |   1345 print *, 'hello'
      |      2
Error: Duplicate statement label 1345 at (1) and (2)


implicit none
integer :: cnt
1345 format("The count is ", g0)

cnt = 0
write(*,1345) cnt

!$omp begin metadirective when(user={condition(cnt > 0)} : parallel)
  1345 print *, 'hello'
  write(*,1345) cnt
!$omp end metadirective
end

* * *

I wonder whether we need something similar for C/C++. There it is rather for
diagnosting invalid code properly like:

some_label:
   ...
omp metadirective (...
   some_label:  // invalid – as scope is the function.

But still, it would be useful to be able to diagnose this as well.
(Note: Still needs to handle __local__ labels correctly.)

Reply via email to