Hello world,

I have just committed the patch below as obvious and simple.

Best regards

        Thomas

Show details of attr->allocated with -fdump-fortran-original.

This simple and obvious patch adds output for the var_allocated enum,
to make the status of where the gfortran thinks a potential allocation
came from more clear.

Instead of (example from warn_unused_but_set_variable_4.f90)

attributes: (VARIABLE ALLOCATABLE DIMENSION REFERENCED VALUE-SET(INTENT-OUT) ALLOCATED)

this now displays

attributes: (VARIABLE ALLOCATABLE DIMENSION REFERENCED VALUE-SET(INTENT-OUT) ALLOCATED(ARG))

No user impact (unless the user is exceptionally curious) and no test
case.

gcc/fortran/ChangeLog:

        PR fortran/126058
        * dump-parse-tree.cc (show_attr): Show details of
        attr->allocated.
diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 19dffe38aed..eaf6565d0e0 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -1058,8 +1058,20 @@ show_attr (symbol_attribute *attr, const char * module)
       gfc_internal_error ("Wrong value for value_set");
     }
 
-  if (attr->allocated)
-    fputs (" ALLOCATED", dumpfile);
+  switch (attr->allocated)
+    {
+    case ALLOCATED_ARG:
+      fputs (" ALLOCATED(ARG)", dumpfile);
+      break;
+    case ALLOCATED_ALLOCATE_STMT:
+      fputs(" ALLOCATED(ALLOCATE-STMT)", dumpfile);
+      break;
+    case ALLOCATED_ASSIGNMENT:
+      fputs (" ALLOCATED(ASSIGNMENT)", dumpfile);
+      break;
+    default:
+      break;
+    }
 
   switch (attr->value_used)
     {

Reply via email to