diff --git a/src/gray_errors.f90 b/src/gray_errors.f90 index 8c1f2a8..0aa795b 100644 --- a/src/gray_errors.f90 +++ b/src/gray_errors.f90 @@ -142,8 +142,11 @@ contains integer, intent(in), optional :: subcase integer(kind=gray_error) :: raise_error - raise_error = ibset(error, spec%offset & - + merge(subcase, 0, present(subcase))) + if (present(subcase)) then + raise_error = ibset(error, spec%offset + subcase) + else + raise_error = ibset(error, spec%offset) + end if end function raise_error