https://gcc.gnu.org/g:66096151afc6631f8f2a3458b154c5daa822b963

commit r15-5341-g66096151afc6631f8f2a3458b154c5daa822b963
Author: Thomas Koenig <tkoe...@gcc.gnu.org>
Date:   Sat Nov 16 14:49:25 2024 +0100

    Handle unsigned constants for module I/O.
    
    gcc/fortran/ChangeLog:
    
            * module.cc (mio_expr): Handle BT_UNSIGNED.
    
    gcc/testsuite/ChangeLog:
    
            * gfortran.dg/unsigned_42.f90: New test.

Diff:
---
 gcc/fortran/module.cc                     |  1 +
 gcc/testsuite/gfortran.dg/unsigned_42.f90 | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/gcc/fortran/module.cc b/gcc/fortran/module.cc
index 9ab4d2bf1ea3..d184dbc661fc 100644
--- a/gcc/fortran/module.cc
+++ b/gcc/fortran/module.cc
@@ -3925,6 +3925,7 @@ mio_expr (gfc_expr **ep)
       switch (e->ts.type)
        {
        case BT_INTEGER:
+       case BT_UNSIGNED:
          mio_gmp_integer (&e->value.integer);
          break;
 
diff --git a/gcc/testsuite/gfortran.dg/unsigned_42.f90 
b/gcc/testsuite/gfortran.dg/unsigned_42.f90
new file mode 100644
index 000000000000..e9a723863c6b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unsigned_42.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-funsigned" }
+module mytype
+  integer, parameter :: uk = selected_unsigned_kind(12)
+end module mytype
+
+module foo
+  use mytype
+  implicit none
+  unsigned(uk), parameter :: seed0 = 1u_uk
+  unsigned(uk), protected :: x_ = seed0
+end module foo

Reply via email to