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

--- Comment #9 from Benjamin Schulz <schulz.benjamin at googlemail dot com> ---
What irritates me, for example, if one changes in parser.cc
####################################
--- a/gcc/cp/parser.cc  2026-01-15 19:10:30.235680363 +0100
+++ b/gcc/co/parser.cc  2026-01-16 00:23:53.143544724 +0100
@@ -50060,6 +50060,24 @@
            break;
          }

+  if (processing_template_decl
+        && (code == OMP_DISTRIBUTE
+        || code == OMP_TASKLOOP
+        || code == OMP_LOOP))
+      {
+        keep_next_level (true);
+
+        for (unsigned int i = 0; i < count; ++i)
+          if (data.body_blockv[i]
+            && TREE_CODE (data.body_blockv[i]) != BIND_EXPR)
+          {
+            tree sb = begin_omp_structured_block ();
+            tree body = data.body_blockv[i];
+            add_stmt (body);
+            data.body_blockv[i] = finish_omp_structured_block (sb);
+          }
+      }
+

   /* Do the substitution from the inside out.  */
   for (unsigned int i = count - 1; i > 0; i--)
     if (data.init_placeholderv[i])

#################################
attempts like this:
#####################
--- a/gcc/cp/parser.cc  2026-01-15 19:10:30.235680363 +0100
+++ b/gcc/cp/parser.cc  2026-01-16 01:34:40.350379311 +0100
@@ -50060,6 +50060,25 @@
            break;
          }

+         if (processing_template_decl
+        && (code == OMP_DISTRIBUTE
+        || code == OMP_TASKLOOP
+        || code == OMP_LOOP))
+      {
+        for (unsigned int i = 0; i < count; ++i)
+          if (data.body_blockv[i]
+            && TREE_CODE (data.body_blockv[i]) != BIND_EXPR)
+          {
+            data.body_blockv[i]
+            = build3 (BIND_EXPR, void_type_node,
+                      NULL_TREE,               /* vars */
+                      data.body_blockv[i],     /* body */
+                      NULL_TREE);              /* block */
+            TREE_SIDE_EFFECTS (data.body_blockv[i]) = 1;
+          }
+      }
+
+
   /* Do the substitution from the inside out.  */
   for (unsigned int i = count - 1; i > 0; i--)
     if (data.init_placeholderv[i])

########################
also have no successs.

I do not know much about gcc. 

Perhaps somebody understands this better than me and can explain why these
attempts would not have the desired effect.

Would this mean that the fix has to be in pt/cc? Or have I made something
wrong? I don't understand much about gcc's source yet.. I'm sorry...

Reply via email to