From: Thomas Koenig Date: Sat, 16 Nov 2024 13:49:25 +0000 (+0100) Subject: Handle unsigned constants for module I/O. X-Git-Tag: basepoints/gcc-16~4212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66096151afc6631f8f2a3458b154c5daa822b963;p=thirdparty%2Fgcc.git 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 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