Skip to content

Commit 5bd2b3b

Browse files
authored
Merge branch 'main' into develop
2 parents 4b38d11 + 6b364a0 commit 5bd2b3b

6 files changed

+58
-42
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# ------------------------------------------------------------------------ #
2121
cmake_minimum_required (VERSION 3.12)
2222
project (PFLOGGER
23-
VERSION 1.14.0
23+
VERSION 1.13.2
2424
LANGUAGES Fortran)
2525

2626
set (CMAKE_MODULE_PATH

ChangeLog.md

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
- Added `-quiet` flag for NAG Fortran
1515

16+
- Workaround additional polymorphic assignment bug in gfortran 13.2 (in build_locks)
17+
18+
## [1.13.2] - 2024-03-13
19+
20+
### Fixed
21+
22+
- Another fix for MockMpi layer. With the workaround for NAG in previous release, GFortran 13 detects some inconsistencies that are now resolved.
23+
1624
## [1.13.1] - 2024-03-07
1725

1826
### Fixed

src/Config.F90

+34-32
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module PFL_Config
1818
use PFL_Formatter
1919
use PFL_Filterer
2020
use PFL_FileHandler
21-
21+
2222
use gFTL2_StringUnlimitedMap
2323
use PFL_Filter
2424
use PFL_StringUtilities, only: to_lower_case
@@ -77,7 +77,7 @@ subroutine build_formatters(this, cfg, unusable, extra, rc)
7777
class(NodeIterator), allocatable :: iter
7878
class (Formatter), allocatable :: f
7979
character(:), allocatable :: formatter_name
80-
80+
8181
integer :: status
8282

8383
_ASSERT(cfg%is_mapping(), "PFL::Config::build_formatters() - input cfg not a mapping", rc)
@@ -123,7 +123,7 @@ subroutine build_formatter(fmtr, cfg, unusable, extra, global_communicator, rc)
123123
select case (class_name)
124124
case ('Formatter')
125125
call build_basic_formatter(fmtr, cfg, _RC)
126-
#ifdef _LOGGER_USE_MPI
126+
#ifdef _LOGGER_USE_MPI
127127
case ('MpiFormatter')
128128
if (present(extra)) then
129129
extra_ = extra
@@ -287,7 +287,7 @@ subroutine build_mpi_formatter(fmtr, cfg, unusable, extra, rc)
287287
_RETURN(_SUCCESS,rc)
288288
end subroutine build_mpi_formatter
289289
#endif
290-
290+
291291
subroutine build_locks(this, cfg, unusable, extra, rc)
292292
use PFL_AbstractLock
293293
#ifdef _LOGGER_USE_MPI
@@ -304,7 +304,7 @@ subroutine build_locks(this, cfg, unusable, extra, rc)
304304
character(:), allocatable :: lock_name
305305
class (AbstractLock), allocatable :: lock
306306
integer :: status
307-
307+
308308
_ASSERT(cfg%is_mapping(), "PFL::Config::build_locks() - input cfg not a mapping", rc)
309309

310310
associate (b => cfg%begin(), e => cfg%end())
@@ -313,7 +313,9 @@ subroutine build_locks(this, cfg, unusable, extra, rc)
313313

314314
lock_name = to_string(iter%first(), _RC)
315315
subcfg => iter%second()
316-
lock = build_lock(subcfg, extra=extra, _RC)
316+
!lock = build_lock(subcfg, extra=extra, _RC)
317+
allocate(lock, source=build_lock(subcfg, extra=extra, rc=status))
318+
_VERIFY(status,'',rc)
317319
call this%locks%insert(lock_name, lock)
318320
call iter%next()
319321
end do
@@ -376,7 +378,7 @@ subroutine build_filters(this, cfg, unusable, extra, rc)
376378

377379
associate (b => cfg%begin(), e => cfg%end())
378380
iter = b
379-
381+
380382
do while (iter /= e)
381383

382384
filter_name = to_string(iter%first(), _RC)
@@ -407,7 +409,7 @@ function build_filter(cfg, unusable, extra, rc) result(f)
407409

408410
character(len=:), allocatable :: class_name
409411
integer :: status
410-
412+
411413
_ASSERT(cfg%is_mapping(), "PFL::Config::build_formatter() - input cfg not a mapping", rc)
412414

413415
if (cfg%has('class')) then
@@ -420,12 +422,12 @@ function build_filter(cfg, unusable, extra, rc) result(f)
420422
case ('filter')
421423
allocate(f, source=build_basic_filter(cfg, rc=status))
422424
_VERIFY(status, '', rc)
423-
425+
424426
case ('levelfilter')
425427
allocate(f, source=build_LevelFilter(cfg, rc=status))
426428
_VERIFY(status, '', rc)
427-
428-
#ifdef _LOGGER_USE_MPI
429+
430+
#ifdef _LOGGER_USE_MPI
429431
case ('mpifilter')
430432
allocate(f, source=build_MpiFilter(cfg, extra=extra, rc=status))
431433
_VERIFY(status, '', rc)
@@ -443,7 +445,7 @@ function build_basic_filter(cfg, rc) result(f)
443445
type (Filter) :: f
444446
class(YAML_Node), intent(in) :: cfg
445447
integer, optional, intent(out) :: rc
446-
448+
447449
character(len=:), allocatable :: name
448450
integer :: status
449451

@@ -461,18 +463,18 @@ function build_LevelFilter(cfg, rc) result(f)
461463
type (LevelFilter) :: f
462464
class(YAML_Node), intent(in) :: cfg
463465
integer, optional, intent(out) :: rc
464-
466+
465467
integer :: min_level, max_level
466468
integer :: status
467469

468470
min_level = get_level('min_level', _RC)
469471
max_level = get_level('max_level', _RC)
470-
472+
471473
f = LevelFilter(min_level, max_level)
472-
474+
473475
_RETURN(_SUCCESS,rc)
474476
contains
475-
477+
476478
integer function get_level(key, rc) result(level)
477479
character(len=*), intent(in) :: key
478480
integer, optional, intent(out) :: rc
@@ -493,7 +495,7 @@ integer function get_level(key, rc) result(level)
493495

494496
_RETURN(_SUCCESS,rc)
495497
end function get_level
496-
498+
497499
end function build_LevelFilter
498500

499501
#ifdef _LOGGER_USE_MPI
@@ -504,7 +506,7 @@ function build_MpiFilter(cfg, unusable, extra, rc) result(f)
504506
class (KeywordEnforcer), optional, intent(in) :: unusable
505507
type (StringUnlimitedMap), optional, intent(in) :: extra
506508
integer, optional, intent(out) :: rc
507-
509+
508510
character(len=:), allocatable :: comm_name
509511
integer :: comm
510512
integer :: rank, root, ierror
@@ -528,7 +530,7 @@ function build_MpiFilter(cfg, unusable, extra, rc) result(f)
528530
_UNUSED_DUMMY(unusable)
529531
end function build_MpiFilter
530532
#endif
531-
533+
532534

533535
subroutine build_handlers(this, cfg, unusable, extra, rc)
534536
class (ConfigElements), intent(inout) :: this
@@ -558,7 +560,7 @@ subroutine build_handlers(this, cfg, unusable, extra, rc)
558560

559561
_RETURN(_SUCCESS,rc)
560562
end subroutine build_handlers
561-
563+
562564
subroutine build_handler(h, cfg, elements, unusable, extra, rc)
563565
class (AbstractHandler), allocatable, intent(out) :: h
564566
class(YAML_Node), intent(inout) :: cfg
@@ -568,7 +570,7 @@ subroutine build_handler(h, cfg, elements, unusable, extra, rc)
568570
integer, optional, intent(out) :: rc
569571

570572
integer :: status
571-
573+
572574
call allocate_concrete_handler(h, cfg, _RC)
573575
call set_handler_level(h, cfg, _RC)
574576
call set_handler_formatter(h, cfg, elements%formatters, _RC)
@@ -600,11 +602,11 @@ subroutine allocate_concrete_handler(h, cfg, rc)
600602
case ('filehandler')
601603
call build_filehandler(fh, cfg)
602604
allocate(h, source=fh)
603-
#ifdef _LOGGER_USE_MPI
605+
#ifdef _LOGGER_USE_MPI
604606
case ('mpifilehandler')
605607
call build_mpifilehandler(fh, cfg)
606608
allocate(h, source=fh)
607-
#endif
609+
#endif
608610
case default
609611
_ASSERT(.false., "PFL::Config::build_handler() - unsupported class: '" // class_name //"'.", rc)
610612
end select
@@ -614,7 +616,7 @@ end subroutine allocate_concrete_handler
614616
subroutine set_handler_level(h, cfg, rc)
615617
class (AbstractHandler), intent(inout) :: h
616618
class(YAML_Node), intent(in) :: cfg
617-
integer, optional, intent(out) :: rc
619+
integer, optional, intent(out) :: rc
618620

619621
character(len=:), allocatable :: level_name
620622
integer :: level
@@ -638,7 +640,7 @@ subroutine set_handler_level(h, cfg, rc)
638640

639641
_RETURN(_SUCCESS,rc)
640642
end subroutine set_handler_level
641-
643+
642644

643645
subroutine set_handler_formatter(h, cfg, formatters, rc)
644646
use PFL_Formatter
@@ -726,7 +728,7 @@ subroutine set_handler_lock(h, cfg, locks, rc)
726728
end if
727729
_RETURN(_SUCCESS,rc)
728730
end subroutine set_handler_lock
729-
731+
730732

731733
end subroutine build_handler
732734

@@ -893,8 +895,8 @@ subroutine build_mpifilehandler(h, cfg, unusable, extra, rc)
893895
end if
894896

895897
h = FileHandler(fileName, delay=delay)
896-
897-
_RETURN(_SUCCESS,rc)
898+
899+
_RETURN(_SUCCESS,rc)
898900
end subroutine build_mpifilehandler
899901
#endif
900902

@@ -990,7 +992,7 @@ subroutine set_logger_propagate(lgr, cfg, rc)
990992

991993
_RETURN(_SUCCESS,rc)
992994
end subroutine set_logger_propagate
993-
995+
994996

995997
subroutine set_logger_filters(lgr, cfg, filters, unusable, extra, rc)
996998
class (Logger), intent(inout) :: lgr
@@ -1034,15 +1036,15 @@ subroutine set_logger_handlers(lgr, cfg, handlers, unusable, extra, rc)
10341036
type (StringUnlimitedMap), optional, intent(in) :: extra
10351037
integer, optional, intent(out) :: rc
10361038

1037-
character(len=:), allocatable :: handler_name
1039+
character(len=:), allocatable :: handler_name
10381040
class(YAML_Node), pointer :: subcfg
10391041
integer :: i
10401042
integer :: status
10411043

10421044
if (cfg%has('handlers')) then
10431045
subcfg => cfg%of('handlers')
10441046
_ASSERT(cfg%has('handlers'), "PFL::Config::set_logger_handlers() - expected sequence for 'handlers' key.", rc)
1045-
1047+
10461048
do i = 1, subcfg%size()
10471049
call subcfg%get(handler_name, i, _RC)
10481050

@@ -1145,7 +1147,7 @@ subroutine set_global_communicator(this, comm)
11451147
class (ConfigElements), intent(inout) :: this
11461148
integer, optional, intent(in) :: comm
11471149

1148-
#ifdef _LOGGER_USE_MPI
1150+
#ifdef _LOGGER_USE_MPI
11491151
if (present(comm)) then
11501152
this%global_communicator = comm
11511153
else

src/MockMpi.F90

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module mpi
1919
public :: MPI_ANY_SOURCE
2020

2121
integer, parameter :: MPI_ADDRESS_KIND = INT64
22-
integer, parameter :: MPI_STATUS_SIZE = 1
23-
integer, parameter :: MPI_STATUS_IGNORE(MPI_STATUS_SIZE) = [0]
22+
integer, parameter :: MPI_STATUS_SIZE = 6
23+
integer, parameter :: MPI_STATUS_IGNORE(MPI_STATUS_SIZE) = spread(0, dim=1, ncopies=MPI_STATUS_SIZE)
2424
integer, parameter :: MPI_LOGICAL = 9
2525
integer, parameter :: MPI_SUCCESS = 0
2626
integer, parameter :: MPI_INFO_NULL = 0

tests/Test_MpiCommConfig.pf

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
module Test_MpiCommConfig
2-
use mpi
32
use funit
43
use PFL_MpiCommConfig
54
use gftl2_StringUnlimitedMap, only: StringUnlimitedMap
65
use PFL_FormatString
76
implicit none
87

9-
108
contains
119

1210
@test
1311
subroutine test_default()
12+
use mpi
1413
! use mpi_comm_world if necessary.
1514
! Note that the usage is
1615
! read-only, so does not violate encapsulation of MPI
@@ -35,7 +34,8 @@ contains
3534

3635
@test
3736
subroutine test_override_keywords()
38-
! use mpi_comm_world if necessary.
37+
use mpi
38+
! use mpi_comm_world if necessary.
3939
! Note that the usage is
4040
! read-only, so does not violate encapsulation of MPI
4141
! communicators.
@@ -58,7 +58,8 @@ contains
5858

5959
@test
6060
subroutine test_with_comm()
61-
! Note this test is a bit weak, as the mock layer does not actually
61+
use mpi
62+
! Note this test is a bit weak, as the mock layer does not actually
6263
! use comm. But it ensures the interface is in place,
6364
! and the implementation is trivial extension.
6465
character(len=:), allocatable :: s
@@ -80,6 +81,7 @@ contains
8081

8182
@test
8283
subroutine test_with_multi_comm()
84+
use mpi
8385
! Note this test is a bit weak, as the mock layer does not actually
8486
! use comm. But it ensures the interface is in place,
8587
! and the implementation is trivial extension.

tests/Test_MpiFormatter.pf

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Test_MpiFormatter
22
use funit
3-
use mpi
43
use PFL_MpiFormatter
54
use PFL_LogRecord
65
use PFL_SeverityLevels
@@ -10,6 +9,7 @@ contains
109

1110
@test
1211
subroutine test_no_reference()
12+
use mpi
1313
type (MpiFormatter) :: f
1414
type (LogRecord) :: rec
1515
integer :: comm ! not really used due to mock
@@ -24,6 +24,7 @@ contains
2424

2525
@test
2626
subroutine test_one_comm()
27+
use mpi
2728
type (MpiFormatter) :: f
2829
type (LogRecord) :: rec
2930

@@ -43,7 +44,8 @@ contains
4344

4445
@test
4546
subroutine test_multi_comm()
46-
type (MpiFormatter) :: f
47+
use mpi
48+
type (MpiFormatter) :: f
4749
type (LogRecord) :: rec
4850

4951
integer :: comm = 1 ! not really used due to mock
@@ -62,6 +64,7 @@ contains
6264

6365
@test
6466
subroutine test_multi_comm_default_fmt()
67+
use mpi
6568
type (MpiFormatter) :: f
6669
type (LogRecord) :: rec
6770

@@ -80,7 +83,8 @@ contains
8083

8184
@test
8285
subroutine test_alt_names()
83-
type (MpiFormatter) :: f
86+
use mpi
87+
type (MpiFormatter) :: f
8488
type (LogRecord) :: rec
8589

8690
character(len=:), allocatable :: fmt

0 commit comments

Comments
 (0)