Hello world,

Steve found a test case where unsigned constants were not handled
in a module. Single-line patch committed as obvious and simple,
r15-5341-g66096151afc6631f8f2a3458b154c5daa822b963 .

Best regards

        Thomas

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 --git a/gcc/fortran/module.cc b/gcc/fortran/module.cc
index 9ab4d2bf1ea..d184dbc661f 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 00000000000..e9a723863c6
--- /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