https://gcc.gnu.org/g:0fa9f02c4c309dd6a94e11bcdb24454f1bd73ea3

commit 0fa9f02c4c309dd6a94e11bcdb24454f1bd73ea3
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Thu May 8 11:10:01 2025 +0200

    Ajout warnings supplémentaires array-with-dt-4

Diff:
---
 gcc/fortran/trans-array.cc                          | 3 +++
 gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90 | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 5827362cbd5a..ddf5fbccec1e 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3670,6 +3670,9 @@ array_ref_safe_p (tree array, tree *elt_size)
        return false;
     }
 
+  if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (array)))
+    return false;
+
   tree elt_type = gfc_get_element_type (TREE_TYPE (array));
   if (TYPE_SIZE_UNIT (elt_type) == NULL_TREE
       || !INTEGER_CST_P (TYPE_SIZE_UNIT (elt_type)))
diff --git a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90 
b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90
index ac005356ed62..d2abe6d01a6f 100644
--- a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90
@@ -15,9 +15,13 @@ end type t
 
 type(t), allocatable :: c(:)
 ! { dg-note {'c' declared here} {} { target *-*-* } .-1 }
+! { dg-note {'c.offset' was declared here} {} { target *-*-* } .-2 }
+! { dg-note {'c.span' was declared here} {} { target *-*-* } .-3 }
 
 !$acc enter data copyin(c(5)%foo(4)%bar(3)%qux(2)%quux(:))
 ! { dg-warning {'c\.offset' is used uninitialized} {} { target *-*-* } .-1 }
+! { dg-warning {'c\.span' is used uninitialized} {} { target *-*-* } .-2 }
 !$acc exit data delete(c(5)%foo(4)%bar(3)%qux(2)%quux(:))
 ! { dg-warning {'c\.offset' is used uninitialized} {} { target *-*-* } .-1 }
+! { dg-warning {'c\.span' is used uninitialized} {} { target *-*-* } .-2 }
 end

Reply via email to