Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29281 Discussions

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

V-T
New Contributor I
933 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