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

Possible false positive of MemorySanitizer: use-of-uninitialized-value

V-T
New Contributor I
217 Views

Consider the following minimal working example:

 

program p
    character(len=:),allocatable::c
    c='t'
    print*,f(c)
contains
    logical function f(c)  ! works for `integer` and numerical value of `c`
        character(len=*),intent(in)::c
        read(c,*)f
    end
end

 

The code was compiled with `ifx 2024.2.1` and flags `-O2 -g -fsanitize=memory`. The executable exits with an error `MemorySanitizer: use-of-uninitialized-value for_rint_lis.c in ri_find_field` and an info `Uninitialized value was created by a heap allocation` pointing to line 3 before that. I suppose, it is a false positive, because replacing `logical` with `integer` in line 6 and changing the value of `c` to a numerical value fixes the issue.

Labels (2)
0 Kudos
0 Replies
Reply