Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28736 Discussions

Bug Report: Problem Allocating Logical from Class(*) using Source in Fortran

Lamb__Tripp
New Contributor I
650 Views

Original stack overflow question https://stackoverflow.com/questions/76766405/problem-allocating-logical-from-class-using-source-in-fortran/76773359#76773359

 

The following code produces random (though heavily biased) results.

Program LogicalAllocation
implicit none class(*), pointer :: bool allocate(bool, source=.false.) select type(bool) type is (logical) Print *, bool end select
End Program LogicalAllocation

On my intel fortran oneapi version 2023.0.0.25839 this code will print 'T' or 'F' seemingly at random. Using iFort

0 Kudos
1 Reply
martinmath
New Contributor II
623 Views

I only get F consistently with recent oneapi update, ifort (2021.10.0 20230609) and ifx(2023.2.0 20230622) .

However, checking with valgrind I see "Conditional jump or move depends on uninitialised value(s)" at the write line, probably accessing the value of bool, as valgrind further states that the "Uninitialised value was created by a heap allocation" and points at the allocate line. That looks like a bug in ifort.

With ifx the output looks clean and no errors are shown by valgrind.

 

0 Kudos
Reply