Skip to content

Commit db30463

Browse files
committed
Add support for GNU Fortran 15.1. Fix unsigned functions.
1 parent 8b8c3fa commit db30463

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# fortran-unix
22

3-
[![Build](https://github.com/interkosmos/fortran-unix/actions/workflows/build.yml/badge.svg)](https://github.com/interkosmos/fortran-unix/actions/workflows/build.yml)
3+
![Language](https://img.shields.io/badge/-Fortran-734f96?logo=fortran&logoColor=white)
4+
![License](https://img.shields.io/github/license/dabamos/dmpack?color=blue)
5+
![Build](https://github.com/interkosmos/fortran-unix/actions/workflows/build.yml/badge.svg)
46

57
A work-in-progress collection of Fortran 2008 ISO C binding interfaces to
68
selected POSIX and SysV types, functions, and routines on 64-bit Unix-like

src/unix.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pure elemental function c_uint16_to_int32(u) result(s)
9595
integer(kind=c_uint16_t), intent(in) :: u !! Unsigned integer.
9696
integer(kind=c_int32_t) :: s !! Signed integer.
9797

98-
if (u > 0) then
98+
if (u >= 0) then
9999
s = int(u, kind=c_int32_t)
100100
else
101101
s = 65536_c_int32_t + int(u, kind=c_int32_t)
@@ -107,7 +107,7 @@ pure elemental function c_uint32_to_int64(u) result(s)
107107
integer(kind=c_uint32_t), intent(in) :: u !! Unsigned integer.
108108
integer(kind=c_int64_t) :: s !! Signed integer.
109109

110-
if (u > 0) then
110+
if (u >= 0) then
111111
s = int(u, kind=c_int64_t)
112112
else
113113
s = 4294967296_c_int64_t + int(u, kind=c_int64_t)

src/unix_types.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module unix_types
77
implicit none
88
private
99

10-
#if defined (__flang__)
10+
#if defined (__flang__) || (defined (__GFORTRAN__) && __GNUC__ >= 15 && __GNUC_MINOR__ >= 1)
1111

1212
public :: c_uint16_t
1313
public :: c_uint32_t

0 commit comments

Comments
 (0)