]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Handle unsigned constants for module I/O.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 16 Nov 2024 13:49:25 +0000 (14:49 +0100)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 16 Nov 2024 13:51:14 +0000 (14:51 +0100)
gcc/fortran/ChangeLog:

* module.cc (mio_expr): Handle BT_UNSIGNED.

gcc/testsuite/ChangeLog:

* gfortran.dg/unsigned_42.f90: New test.

gcc/fortran/module.cc
gcc/testsuite/gfortran.dg/unsigned_42.f90 [new file with mode: 0644]

index 9ab4d2bf1ea3b597c0626cd7260172a7306084c5..d184dbc661fc36730036511f61eb62d4d428bb8e 100644 (file)
@@ -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 (file)
index 0000000..e9a7238
--- /dev/null
@@ -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