public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Docs, OpenMP: Small fixes to internal OMP_FOR doc
@ 2023-04-19 13:51 Frederik Harwath
  2023-04-19 16:05 ` Sandra Loosemore
  0 siblings, 1 reply; 2+ messages in thread
From: Frederik Harwath @ 2023-04-19 13:51 UTC (permalink / raw)
  To: Sandra Loosemore, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

Hi Sandra,
the OMP_FOR documentation says that the loop index variable
must be signed and it does not list "!=" in the allowed conditional
expressions. But there is nothing that would automatically cast an 
unsigned variable
to signed or that converts the "!=" as you can see from the dump
for this program:

int main ()
{
#pragma omp for
for (unsigned i = 0; i != 10; i++) {}
}

The 005t.gimple dump is:

int __GIMPLE ()
{
   int D_2064;

   {
     {
       unsigned int i;

       #pragma omp for private(i)
       for (i = 0u; i != 10u; i = i + 1u)
     }
   }
   D_2064 = 0;
   return D_2064;
}

(Strictly speaking, the OMP_FOR is represented as a gomp_for at this point,
but this does not really matter.)

Can I commit the patch?

Best regards,
Frederik

[-- Attachment #2: 0001-Docs-OpenMP-Small-fixes-to-internal-OMP_FOR-doc.patch --]
[-- Type: text/x-patch, Size: 2734 bytes --]

From 8af01114c295086526a67f56f6256fc945b1ccb5 Mon Sep 17 00:00:00 2001
From: Frederik Harwath <frederik@codesourcery.com>
Date: Wed, 19 Apr 2023 13:18:55 +0200
Subject: [PATCH] Docs, OpenMP: Small fixes to internal OMP_FOR doc.

gcc/ChangeLog:

	* doc/generic.texi (OpenMP): Add != to allowed
	conditions and state that vars can be unsigned.

	* tree.def (OMP_FOR): Likewise.
---
 gcc/doc/generic.texi | 4 ++--
 gcc/tree.def         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi
index 2c14b7abce2..8b2882da4fe 100644
--- a/gcc/doc/generic.texi
+++ b/gcc/doc/generic.texi
@@ -2323,7 +2323,7 @@ Operand @code{OMP_FOR_INIT} is a vector containing iteration
 variable initializations of the form @code{VAR = N1}.
 
 Operand @code{OMP_FOR_COND} is vector containing loop
-conditional expressions of the form @code{VAR @{<,>,<=,>=@} N2}.
+conditional expressions of the form @code{VAR @{<,>,<=,>=,!=@} N2}.
 
 Operand @code{OMP_FOR_INCR} is a vector containing loop index
 increment expressions of the form @code{VAR @{+=,-=@} INCR}.
@@ -2349,7 +2349,7 @@ adjust their data-sharing attributes and diagnose errors.
 @code{OMP_FOR_ORIG_DECLS} is a vector field, with each element holding
 a list of @code{VAR_DECLS} for the corresponding collapse level.
 
-The loop index variable @code{VAR} must be a signed integer variable,
+The loop index variable @code{VAR} must be an integer variable,
 which is implicitly private to each thread.  For rectangular loops,
 the bounds @code{N1} and @code{N2} and the increment expression
 @code{INCR} are required to be loop-invariant integer expressions
diff --git a/gcc/tree.def b/gcc/tree.def
index ee02754354f..90ceeec0b51 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -1159,7 +1159,7 @@ DEFTREECODE (OMP_TASK, "omp_task", tcc_statement, 2)
    variable initializations of the form VAR = N1.
 
    Operand 3: OMP_FOR_COND is vector containing loop
-   conditional expressions of the form VAR {<,>,<=,>=} N2.
+   conditional expressions of the form VAR {<,>,<=,>=,!=} N2.
 
    Operand 4: OMP_FOR_INCR is a vector containing loop index
    increment expressions of the form VAR {+=,-=} INCR.
@@ -1185,7 +1185,7 @@ DEFTREECODE (OMP_TASK, "omp_task", tcc_statement, 2)
    OMP_FOR_ORIG_DECLS is a vector field, with each element holding
    a list of VAR_DECLS for the corresponding collapse level.
 
-   The loop index variable VAR must be a signed integer variable,
+   The loop index variable VAR must be an integer variable,
    which is implicitly private to each thread.  For rectangular loops,
    the bounds N1 and N2 and the increment expression
    INCR are required to be loop-invariant integer expressions
-- 
2.36.1


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

* Re: [PATCH] Docs, OpenMP: Small fixes to internal OMP_FOR doc
  2023-04-19 13:51 [PATCH] Docs, OpenMP: Small fixes to internal OMP_FOR doc Frederik Harwath
@ 2023-04-19 16:05 ` Sandra Loosemore
  0 siblings, 0 replies; 2+ messages in thread
From: Sandra Loosemore @ 2023-04-19 16:05 UTC (permalink / raw)
  To: Frederik Harwath, gcc-patches

On 4/19/23 07:51, Frederik Harwath wrote:
> Hi Sandra,
> the OMP_FOR documentation says that the loop index variable
> must be signed and it does not list "!=" in the allowed conditional
> expressions. But there is nothing that would automatically cast an 
> unsigned variable
> to signed or that converts the "!=" as you can see from the dump
> for this program:
> 
> int main ()
> {
> #pragma omp for
> for (unsigned i = 0; i != 10; i++) {}
> }
> 
> The 005t.gimple dump is:
> 
> int __GIMPLE ()
> {
>    int D_2064;
> 
>    {
>      {
>        unsigned int i;
> 
>        #pragma omp for private(i)
>        for (i = 0u; i != 10u; i = i + 1u)
>      }
>    }
>    D_2064 = 0;
>    return D_2064;
> }
> 
> (Strictly speaking, the OMP_FOR is represented as a gomp_for at this point,
> but this does not really matter.)
> 
> Can I commit the patch?

The patch is fine for the trunk, but GCC 13 is frozen for the release 
right now and even doc fixes require RM approval.  I'd have no objection 
to putting it on the release branch too when it is unfrozen, but as this 
isn't user-facing documentation there's no particularly urgent argument 
for doing that.

-Sandra

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

end of thread, other threads:[~2023-04-19 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 13:51 [PATCH] Docs, OpenMP: Small fixes to internal OMP_FOR doc Frederik Harwath
2023-04-19 16:05 ` Sandra Loosemore

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).