On 9/25/24 3:18 AM, Andre Vehreschild wrote:
Hi all,

I finally managed to apply the fixed patch. It still had some stray line break
so check_GNU_style.py wouldn't succeed. But with that fixed I agree to have
only some nonsense bickering of the script.

As to the patch (I have stripped large parts.):

diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 36ed8eeac2d..c6aefb81a73 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -3042,6 +3042,16 @@ enum gfc_exec_op
    EXEC_OMP_ERROR, EXEC_OMP_ALLOCATE, EXEC_OMP_ALLOCATORS
  };

+/* Enum Definition for locality types.  */
+enum locality_type
+{
+  LOCALITY_LOCAL = 0,
+  LOCALITY_LOCAL_INIT,
+  LOCALITY_SHARED,
+  LOCALITY_REDUCE,
+  LOCALITY_NUM
+};
+
  typedef struct gfc_code
  {
    gfc_exec_op op;
@@ -3089,7 +3099,15 @@ typedef struct gfc_code
      gfc_inquire *inquire;
      gfc_wait *wait;
      gfc_dt *dt;
-    gfc_forall_iterator *forall_iterator;
+
+    struct
+    {
+      gfc_forall_iterator *forall_iterator;
+      gfc_expr_list *locality[LOCALITY_NUM];
+      bool default_none;
+    }
+    concur;

I am more than unhappy about that construct. Because every concurrent loop has
a forall_iterator, but not every forall_iterator is a concurrent loop. I
therefore propose to move the forall_iterator out of the struct and only have
the concurrent specific elements in the struct. This would also reduce the
changes significantly.


Interestingly, simply moving the gfc_forall_iterator back to where it was before and changing all references to it to point to it I get a clean build of gfortran, but several of the testcases now fail with a segfault.

For example:

$ gfc -fcoarray=single do_concurrent_constraints.f90
f951: internal compiler error: Segmentation fault
0x22b9041 internal_error(char const*, ...)
        ../../trunk/gcc/diagnostic-global-context.cc:517
0xde4d6f crash_signal
        ../../trunk/gcc/toplev.cc:322
0x7053db parse_do_block
        ../../trunk/gcc/fortran/parse.cc:5414
0x7033c4 parse_executable
        ../../trunk/gcc/fortran/parse.cc:6396
0x7047ae parse_progunit
        ../../trunk/gcc/fortran/parse.cc:6803
0x704b58 parse_contained
        ../../trunk/gcc/fortran/parse.cc:6678
0x705b5c parse_module
        ../../trunk/gcc/fortran/parse.cc:7049
0x705f8c gfc_parse_file()
        ../../trunk/gcc/fortran/parse.cc:7351
0x75f69f gfc_be_parse_file
        ../../trunk/gcc/fortran/f95-lang.cc:241

In gdb it looks like the 'next' field in the iterator is pointing to garbage when it ought to be NULL. I am looking around to see why that is not getting initialized correctly or maybe this has uncovered something more nasty.

Jerry

Reply via email to