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

Using a Tree Structure

everythingfunctional
3,214 Views

I use polymorphic tree structures a lot in my libraries, and am having trouble getting them to work with the Intel compiler. I've got this (relatively) simple example application that can be found here:

https://gitlab.com/everythingfunctional/binary_tree

It is just a binary tree of integers that can then format itself in a "pretty" way, but it's implemented using polymorphism. When I compile and run the application with gfortran it works fine, i.e.

 

$ fpm run
Project is up to date
    ------------
    |          |
  -------  -------
  |     |  |     |
 ----- 567 89  -----
 |   |         |   |
---  4        1234 56
| |
1 23

 

 but trying to use the intel compiler it crashes with:

 

$ fpm run --compiler ifx
Project is up to date
==98196==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x496428 in node_m_MP_to_string_ /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/././src/node_m.f90:43:9
    #1 0x4968e9 in node_m_MP_to_string_ /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/././src/node_m.f90:43:9
    #2 0x4928aa in MAIN__ /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/app/main.f90:24:19
    #3 0x40adb8 in main (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x40adb8) (BuildId: 23be80717f69625b736f03c05320b9eccd6c428c)
    #4 0x7f67c5185ccf  (/usr/lib/libc.so.6+0x27ccf) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
    #5 0x7f67c5185d89 in __libc_start_main (/usr/lib/libc.so.6+0x27d89) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
    #6 0x40ac84 in _start (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x40ac84) (BuildId: 23be80717f69625b736f03c05320b9eccd6c428c)

  Uninitialized value was created by a heap allocation
    #0 0x417576 in __interceptor_malloc /netbatch/donb00013_00/dir/workspace/NIT/xmain-rel/LX/xmainefi2linux_release/ws/icsws/llvm/compiler-rt/lib/msan/msan_interceptors.cpp:933:3
    #1 0x676274 in _mm_malloc (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x676274) (BuildId: 23be80717f69625b736f03c05320b9eccd6c428c)
    #2 0x609dff in do_alloc_copy for_alloc_copy.c
    #3 0x60aa04 in do_alloc_copy for_alloc_copy.c
    #4 0x60b5d6 in do_alloc_assign for_alloc_copy.c
    #5 0x60b67e in for_alloc_assign_v2 (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x60b67e) (BuildId: 23be80717f69625b736f03c05320b9eccd6c428c)
    #6 0x490e0a in MAIN__ /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/app/main.f90:10:5
    #7 0x40adb8 in main (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x40adb8) (BuildId: 23be80717f69625b736f03c05320b9eccd6c428c)
    #8 0x7f67c5185ccf  (/usr/lib/libc.so.6+0x27ccf) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/././src/node_m.f90:43:9 in node_m_MP_to_string_
Exiting
<ERROR> Execution for object " binary_tree " returned exit code  1
<ERROR> *cmd_run*:stopping due to failed executions
STOP 1

 

Any help would be greatly appreciated as this is basically a show stopper for pretty much all my projects to work with the Intel compiler.

Labels (2)
0 Kudos
26 Replies
everythingfunctional
2,586 Views

Ok, if I don't turn on the address sanitizer it does work. So I guess this specific thing is not as urgent as I initially thought. It does indicate a memory leak though, and valgrind confirms that.

0 Kudos
FortranFan
Honored Contributor III
2,569 Views

You may help the Intel team by sharing your observations using IFORT, especially re: any memory leaks if present or absent with IFORT.  That might provide pointers as to the source of the issue, whether there is anything in the frontend or on the LLVM side once the instructions are lowered there. 

0 Kudos
everythingfunctional
2,567 Views

Good idea. The output from valgrind is (nearly) identical.

$ fpm run --compiler ifx --flag -g --runner valgrind
Project is up to date
==123826== Memcheck, a memory error detector
==123826== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==123826== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==123826== Command: build/ifx_45AE5EB34B9F9B4B/app/binary_tree
==123826== 
==123826== Conditional jump or move depends on uninitialised value(s)
==123826==    at 0x43FBAF: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x438632: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x439C06: do_alloc_assign (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x439CAE: for_alloc_assign_v2 (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x42E899: strff_mp_split_at_cc_ (strff.f90:500)
==123826==    by 0x42F73D: strff_mp_split_at_sc_ (strff.f90:517)
==123826==    by 0x409291: node_m_mp_max_width_ (node_m.f90:62)
==123826==    by 0x407ABB: node_m_mp_to_string_ (node_m.f90:44)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x406C37: MAIN__ (main.f90:24)
==123826== 
==123826== Conditional jump or move depends on uninitialised value(s)
==123826==    at 0x43FBAF: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x438A93: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x439C06: do_alloc_assign (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x439CAE: for_alloc_assign_v2 (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x42E899: strff_mp_split_at_cc_ (strff.f90:500)
==123826==    by 0x42F73D: strff_mp_split_at_sc_ (strff.f90:517)
==123826==    by 0x409291: node_m_mp_max_width_ (node_m.f90:62)
==123826==    by 0x407ABB: node_m_mp_to_string_ (node_m.f90:44)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x406C37: MAIN__ (main.f90:24)
==123826== 
==123826== Conditional jump or move depends on uninitialised value(s)
==123826==    at 0x43FBAF: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x438632: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x436A0D: do_for_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x42F95D: strff_mp_split_at_sc_ (strff.f90:517)
==123826==    by 0x409291: node_m_mp_max_width_ (node_m.f90:62)
==123826==    by 0x407ABB: node_m_mp_to_string_ (node_m.f90:44)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x406C37: MAIN__ (main.f90:24)
==123826==    by 0x4051CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826== 
==123826== Conditional jump or move depends on uninitialised value(s)
==123826==    at 0x43FBAF: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x438A93: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x436A0D: do_for_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x42F95D: strff_mp_split_at_sc_ (strff.f90:517)
==123826==    by 0x409291: node_m_mp_max_width_ (node_m.f90:62)
==123826==    by 0x407ABB: node_m_mp_to_string_ (node_m.f90:44)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x406C37: MAIN__ (main.f90:24)
==123826==    by 0x4051CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826== 
==123826== Conditional jump or move depends on uninitialised value(s)
==123826==    at 0x43A629: do_deallocate_all (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x43B67D: process_allocation_records_deallocate (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x43A8B0: do_deallocate_all (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826==    by 0x40A5E8: node_m_mp_pad_to_ (node_m.f90:81)
==123826==    by 0x4084A2: node_m_mp_to_string_ (node_m.f90:48)
==123826==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==123826==    by 0x406C37: MAIN__ (main.f90:24)
==123826==    by 0x4051CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_45AE5EB34B9F9B4B/app/binary_tree)
==123826== 
    ------------
    |          |
  -------  -------
  |     |  |     |
 ----- 567 89  -----
 |   |         |   |
---  4        1234 56
| |
1 23
==123826== 
==123826== HEAP SUMMARY:
==123826==     in use at exit: 5,211 bytes in 59 blocks
==123826==   total heap usage: 1,793 allocs, 1,734 frees, 105,041 bytes allocated
==123826== 
==123826== LEAK SUMMARY:
==123826==    definitely lost: 2,240 bytes in 26 blocks
==123826==    indirectly lost: 943 bytes in 20 blocks
==123826==      possibly lost: 1,788 bytes in 12 blocks
==123826==    still reachable: 240 bytes in 1 blocks
==123826==         suppressed: 0 bytes in 0 blocks
==123826== Rerun with --leak-check=full to see details of leaked memory
==123826== 
==123826== Use --track-origins=yes to see where uninitialised values come from
==123826== For lists of detected and suppressed errors, rerun with: -s
==123826== ERROR SUMMARY: 151 errors from 5 contexts (suppressed: 0 from 0)

 

$ fpm run --compiler ifort --flag -g --runner valgrind
exceptional_numbers.f90                done.
iso_varying_string.f90                 done.
strff.f90                              done.
tree_m.f90                             done.
node_m.f90                             done.
leaf_m.f90                             done.
libbinary_tree.a                       done.
main.f90                               done.
binary_tree                            done.
[100%] Project compiled successfully.
==123935== Memcheck, a memory error detector
==123935== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==123935== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==123935== Command: build/ifort_45AE5EB34B9F9B4B/app/binary_tree
==123935== 
==123935== Conditional jump or move depends on uninitialised value(s)
==123935==    at 0x447B6F: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x4405F2: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x441BC6: do_alloc_assign (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x441C6E: for_alloc_assign_v2 (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x4366C3: strff_mp_split_at_cc_ (strff.f90:500)
==123935==    by 0x43749A: strff_mp_split_at_sc_ (strff.f90:517)
==123935==    by 0x4084F4: node_m_mp_max_width_ (node_m.f90:62)
==123935==    by 0x406A61: node_m_mp_to_string_ (node_m.f90:44)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x405ABD: MAIN__ (main.f90:24)
==123935== 
==123935== Conditional jump or move depends on uninitialised value(s)
==123935==    at 0x447B6F: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x440A53: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x441BC6: do_alloc_assign (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x441C6E: for_alloc_assign_v2 (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x4366C3: strff_mp_split_at_cc_ (strff.f90:500)
==123935==    by 0x43749A: strff_mp_split_at_sc_ (strff.f90:517)
==123935==    by 0x4084F4: node_m_mp_max_width_ (node_m.f90:62)
==123935==    by 0x406A61: node_m_mp_to_string_ (node_m.f90:44)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x405ABD: MAIN__ (main.f90:24)
==123935== 
==123935== Conditional jump or move depends on uninitialised value(s)
==123935==    at 0x447B6F: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x4405F2: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x43E9CD: do_for_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x437639: strff_mp_split_at_sc_ (strff.f90:517)
==123935==    by 0x4084F4: node_m_mp_max_width_ (node_m.f90:62)
==123935==    by 0x406A61: node_m_mp_to_string_ (node_m.f90:44)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x405ABD: MAIN__ (main.f90:24)
==123935==    by 0x4041CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935== 
==123935== Conditional jump or move depends on uninitialised value(s)
==123935==    at 0x447B6F: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x440A53: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x43E9CD: do_for_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x437639: strff_mp_split_at_sc_ (strff.f90:517)
==123935==    by 0x4084F4: node_m_mp_max_width_ (node_m.f90:62)
==123935==    by 0x406A61: node_m_mp_to_string_ (node_m.f90:44)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x405ABD: MAIN__ (main.f90:24)
==123935==    by 0x4041CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935== 
==123935== Conditional jump or move depends on uninitialised value(s)
==123935==    at 0x4425E9: do_deallocate_all (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x44363D: process_allocation_records_deallocate (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x442870: do_deallocate_all (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935==    by 0x409CCB: node_m_mp_pad_to_ (node_m.f90:81)
==123935==    by 0x407653: node_m_mp_to_string_ (node_m.f90:48)
==123935==    by 0x406384: node_m_mp_to_string_ (node_m.f90:43)
==123935==    by 0x405ABD: MAIN__ (main.f90:24)
==123935==    by 0x4041CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifort_45AE5EB34B9F9B4B/app/binary_tree)
==123935== 
    ------------
    |          |
  -------  -------
  |     |  |     |
 ----- 567 89  -----
 |   |         |   |
---  4        1234 56
| |
1 23
==123935== 
==123935== HEAP SUMMARY:
==123935==     in use at exit: 5,211 bytes in 59 blocks
==123935==   total heap usage: 1,793 allocs, 1,734 frees, 105,041 bytes allocated
==123935== 
==123935== LEAK SUMMARY:
==123935==    definitely lost: 2,240 bytes in 26 blocks
==123935==    indirectly lost: 943 bytes in 20 blocks
==123935==      possibly lost: 1,788 bytes in 12 blocks
==123935==    still reachable: 240 bytes in 1 blocks
==123935==         suppressed: 0 bytes in 0 blocks
==123935== Rerun with --leak-check=full to see details of leaked memory
==123935== 
==123935== Use --track-origins=yes to see where uninitialised values come from
==123935== For lists of detected and suppressed errors, rerun with: -s
==123935== ERROR SUMMARY: 151 errors from 5 contexts (suppressed: 0 from 0)

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
2,552 Views

FWIW

Conditional jump or move depends on uninitialised value(s)

this is likely caused by a piece of code, optimized, that looks like this

if(expression) then ! expression == .true.
  X=Y   ! Y defined
else
  X=Z   ! Z not defined
endif

Where the compiler generates (pseudo code)

   {expression into flags}

  mov reg, dword ptr [Z]  (will not be used as it is in the .false. branch)

  cmov reg, dword ptr [Y]  (conditionally moves Y to result register)

 

This is not to say that this is the root of your problems.

 

Try a build with optimizations disabled (not certain that this eliminates cmov instructions)

Note, in your production code, only the sensitive source file need be compiled with optimizations disabled. This file (tree management) has trivial code and un-optimized code will likely run as fast as optimized code.

 

Jim Dempsey

 

 

0 Kudos
everythingfunctional
2,468 Views

Thanks for the suggestion, but my initial report did have optimisations turned off, and it does not change the behavior. See the below terminal output. Besides, that's a pretty dramatic proposition, "Code that conditionally accesses entities that may not be defined cannot be optimised". That's what a huge swath of the Fortran code out there does. Also, that is not what is being done on the lines identified in the error messages.

My guess is this is code (inserted by the compiler) checking the size of an unallocated variable when trying to decide whether to do (re)allocation on assignment. I.e.

integer, allocatable :: x(:)
x = [1]

It looks to see if x is already the right size before reallocating it, but it needs to check if it's allocated at all first. I'll see if I can write a little reproducer to confirm.

$ fpm run --compiler ifx --verbose
 <INFO> BUILD_NAME: build/ifx
 <INFO> COMPILER:  ifx
 <INFO> C COMPILER:  icx
 <INFO> CXX COMPILER: icpx
 <INFO> COMPILER OPTIONS:   -warn all -check all -error-limit 1 -O0 -g -assume byterecl -standard-semantics -traceback
 <INFO> C COMPILER OPTIONS:  
 <INFO> CXX COMPILER OPTIONS: 
 <INFO> LINKER OPTIONS:  
 <INFO> INCLUDE DIRECTORIES:  []
[100%] Project compiled successfully.
 + build/ifx_22B6DB2C5432A52F/app/binary_tree 
==179884==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x496428 in node_m_MP_to_string_ /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/././src/node_m.f90:43:9
    #1 0x4968e9 in node_m_MP_to_string_ /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/././src/node_m.f90:43:9
    #2 0x4928aa in MAIN__ /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/app/main.f90:24:19
    #3 0x40adb8 in main (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x40adb8) (BuildId: b7cebaed7a5a9c39f641ab4f778abae3276d1f44)
    #4 0x7feff27a4ccf  (/usr/lib/libc.so.6+0x27ccf) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
    #5 0x7feff27a4d89 in __libc_start_main (/usr/lib/libc.so.6+0x27d89) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
    #6 0x40ac84 in _start (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x40ac84) (BuildId: b7cebaed7a5a9c39f641ab4f778abae3276d1f44)

  Uninitialized value was created by a heap allocation
    #0 0x417576 in __interceptor_malloc /netbatch/donb00013_00/dir/workspace/NIT/xmain-rel/LX/xmainefi2linux_release/ws/icsws/llvm/compiler-rt/lib/msan/msan_interceptors.cpp:933:3
    #1 0x676224 in _mm_malloc (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x676224) (BuildId: b7cebaed7a5a9c39f641ab4f778abae3276d1f44)
    #2 0x609daf in do_alloc_copy for_alloc_copy.c
    #3 0x60a9b4 in do_alloc_copy for_alloc_copy.c
    #4 0x60b586 in do_alloc_assign for_alloc_copy.c
    #5 0x60b62e in for_alloc_assign_v2 (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x60b62e) (BuildId: b7cebaed7a5a9c39f641ab4f778abae3276d1f44)
    #6 0x490e0a in MAIN__ /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/app/main.f90:10:5
    #7 0x40adb8 in main (/home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_22B6DB2C5432A52F/app/binary_tree+0x40adb8) (BuildId: b7cebaed7a5a9c39f641ab4f778abae3276d1f44)
    #8 0x7feff27a4ccf  (/usr/lib/libc.so.6+0x27ccf) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/././src/node_m.f90:43:9 in node_m_MP_to_string_
Exiting
<ERROR> Execution for object " binary_tree " returned exit code  1
<ERROR> *cmd_run*:stopping due to failed executions
STOP 1
fpm run --compiler ifx --verbose --flag "-g -O0" --runner valgrind
 <INFO> BUILD_NAME: build/ifx
 <INFO> COMPILER:  ifx
 <INFO> C COMPILER:  icx
 <INFO> CXX COMPILER: icpx
 <INFO> COMPILER OPTIONS:   -g -O0
 <INFO> C COMPILER OPTIONS:  
 <INFO> CXX COMPILER OPTIONS: 
 <INFO> LINKER OPTIONS:  
 <INFO> INCLUDE DIRECTORIES:  []
 + mkdir -p build/ifx_D38A712DDFFE76F1
 + mkdir -p build/ifx_8EEB471E2F74F3E0
 + mkdir -p build/ifx_559123E203C2FC23
[  0%]         iso_varying_string.f90
[  0%]        exceptional_numbers.f90
 + mkdir -p build/ifx_8EEB471E2F74F3E0/binary_tree/
 + ifx -c build/dependencies/exceptional_numbers/src/exceptional_numbers.f90   -g -O0 -free -module build/ifx_8EEB471E2F74F3E0 -Ibuild/ifx_8EEB471E2F74F3E0 -o build/ifx_8EEB471E2F74F3E0/binary_tree/build_dependencies_exceptional_numbers_src_exceptional_numbers.f90.o
 + ifx -c build/dependencies/iso_varying_string/src/iso_varying_string.f90   -g -O0 -free -module build/ifx_8EEB471E2F74F3E0 -Ibuild/ifx_8EEB471E2F74F3E0 -o build/ifx_8EEB471E2F74F3E0/binary_tree/build_dependencies_iso_varying_string_src_iso_varying_string.f90.o
[ 11%]        exceptional_numbers.f90  done.
build/dependencies/iso_varying_string/src/iso_varying_string.f90(2522): warning #5462: Global name too long, shortened from: iso_varying_stringreplace_target_character_with_character_in_character_mp_GET_NUM_TARGETS to: g_stringreplace_target_character_with_character_in_character_mp_GET_NUM_TARGETS
        pure function get_num_targets(string_, target_, back__) result(num_targets_)
----------------------^
build/dependencies/iso_varying_string/src/iso_varying_string.f90(2563): warning #5462: Global name too long, shortened from: iso_varying_stringreplace_target_character_with_character_in_character_mp_GET_POSITIONS to: ing_stringreplace_target_character_with_character_in_character_mp_GET_POSITIONS
        pure subroutine get_positions( &
------------------------^
[ 22%]         iso_varying_string.f90  done.
[ 22%]                     tree_m.f90
 + ifx -c ././src/tree_m.f90   -g -O0 -free -module build/ifx_8EEB471E2F74F3E0 -Ibuild/ifx_8EEB471E2F74F3E0 -o build/ifx_8EEB471E2F74F3E0/binary_tree/src_tree_m.f90.o
[ 22%]                      strff.f90
 + ifx -c build/dependencies/strff/src/strff.f90   -g -O0 -free -module build/ifx_8EEB471E2F74F3E0 -Ibuild/ifx_8EEB471E2F74F3E0 -o build/ifx_8EEB471E2F74F3E0/binary_tree/build_dependencies_strff_src_strff.f90.o
[ 33%]                     tree_m.f90  done.
[ 44%]                      strff.f90  done.
[ 44%]                     leaf_m.f90
[ 44%]                     node_m.f90
 + ifx -c ././src/node_m.f90   -g -O0 -free -module build/ifx_8EEB471E2F74F3E0 -Ibuild/ifx_8EEB471E2F74F3E0 -o build/ifx_8EEB471E2F74F3E0/binary_tree/src_node_m.f90.o
 + ifx -c ././src/leaf_m.f90   -g -O0 -free -module build/ifx_8EEB471E2F74F3E0 -Ibuild/ifx_8EEB471E2F74F3E0 -o build/ifx_8EEB471E2F74F3E0/binary_tree/src_leaf_m.f90.o
[ 55%]                     leaf_m.f90  done.
[ 66%]                     node_m.f90  done.
[ 66%]               libbinary_tree.a
[ 66%]                       main.f90
 + ifx -c app/main.f90   -g -O0 -free -module build/ifx_8EEB471E2F74F3E0 -Ibuild/ifx_8EEB471E2F74F3E0 -o build/ifx_8EEB471E2F74F3E0/binary_tree/app_main.f90.o
 + mkdir -p build/ifx_D38A712DDFFE76F1/binary_tree/
 + ar -rs build/ifx_D38A712DDFFE76F1/binary_tree/libbinary_tree.a build/ifx_8EEB471E2F74F3E0/binary_tree/src_tree_m.f90.o build/ifx_8EEB471E2F74F3E0/binary_tree/src_node_m.f90.o build/ifx_8EEB471E2F74F3E0/binary_tree/src_leaf_m.f90.o build/ifx_8EEB471E2F74F3E0/binary_tree/build_dependencies_iso_varying_string_src_iso_varying_string.f90.o build/ifx_8EEB471E2F74F3E0/binary_tree/build_dependencies_strff_src_strff.f90.o build/ifx_8EEB471E2F74F3E0/binary_tree/build_dependencies_exceptional_numbers_src_exceptional_numbers.f90.o
ar: creating build/ifx_D38A712DDFFE76F1/binary_tree/libbinary_tree.a
[ 77%]               libbinary_tree.a  done.
[ 88%]                       main.f90  done.
[ 88%]                    binary_tree
 + mkdir -p build/ifx_559123E203C2FC23/app/
 + ifx    -g -O0  build/ifx_8EEB471E2F74F3E0/binary_tree/app_main.f90.o build/ifx_D38A712DDFFE76F1/binary_tree/libbinary_tree.a -o build/ifx_559123E203C2FC23/app/binary_tree
[100%]                    binary_tree  done.
[100%] Project compiled successfully.
 + valgrind build/ifx_559123E203C2FC23/app/binary_tree 
==179996== Memcheck, a memory error detector
==179996== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==179996== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==179996== Command: build/ifx_559123E203C2FC23/app/binary_tree
==179996== 
==179996== Conditional jump or move depends on uninitialised value(s)
==179996==    at 0x43FBAF: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x438632: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x439C06: do_alloc_assign (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x439CAE: for_alloc_assign_v2 (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x42E899: strff_mp_split_at_cc_ (strff.f90:500)
==179996==    by 0x42F73D: strff_mp_split_at_sc_ (strff.f90:517)
==179996==    by 0x409291: node_m_mp_max_width_ (node_m.f90:62)
==179996==    by 0x407ABB: node_m_mp_to_string_ (node_m.f90:44)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x406C37: MAIN__ (main.f90:24)
==179996== 
==179996== Conditional jump or move depends on uninitialised value(s)
==179996==    at 0x43FBAF: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x438A93: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x439C06: do_alloc_assign (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x439CAE: for_alloc_assign_v2 (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x42E899: strff_mp_split_at_cc_ (strff.f90:500)
==179996==    by 0x42F73D: strff_mp_split_at_sc_ (strff.f90:517)
==179996==    by 0x409291: node_m_mp_max_width_ (node_m.f90:62)
==179996==    by 0x407ABB: node_m_mp_to_string_ (node_m.f90:44)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x406C37: MAIN__ (main.f90:24)
==179996== 
==179996== Conditional jump or move depends on uninitialised value(s)
==179996==    at 0x43FBAF: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x438632: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x436A0D: do_for_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x42F95D: strff_mp_split_at_sc_ (strff.f90:517)
==179996==    by 0x409291: node_m_mp_max_width_ (node_m.f90:62)
==179996==    by 0x407ABB: node_m_mp_to_string_ (node_m.f90:44)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x406C37: MAIN__ (main.f90:24)
==179996==    by 0x4051CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996== 
==179996== Conditional jump or move depends on uninitialised value(s)
==179996==    at 0x43FBAF: for__set_indices_routine (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x438A93: do_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x436A0D: do_for_alloc_copy (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x42F95D: strff_mp_split_at_sc_ (strff.f90:517)
==179996==    by 0x409291: node_m_mp_max_width_ (node_m.f90:62)
==179996==    by 0x407ABB: node_m_mp_to_string_ (node_m.f90:44)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x406C37: MAIN__ (main.f90:24)
==179996==    by 0x4051CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996== 
==179996== Conditional jump or move depends on uninitialised value(s)
==179996==    at 0x43A629: do_deallocate_all (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x43B67D: process_allocation_records_deallocate (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x43A8B0: do_deallocate_all (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996==    by 0x40A5E8: node_m_mp_pad_to_ (node_m.f90:81)
==179996==    by 0x4084A2: node_m_mp_to_string_ (node_m.f90:48)
==179996==    by 0x40754B: node_m_mp_to_string_ (node_m.f90:43)
==179996==    by 0x406C37: MAIN__ (main.f90:24)
==179996==    by 0x4051CC: main (in /home/brad/Repositories/GitLab/everythingfunctional/binary_tree/build/ifx_559123E203C2FC23/app/binary_tree)
==179996== 
    ------------
    |          |
  -------  -------
  |     |  |     |
 ----- 567 89  -----
 |   |         |   |
---  4        1234 56
| |
1 23
==179996== 
==179996== HEAP SUMMARY:
==179996==     in use at exit: 5,211 bytes in 59 blocks
==179996==   total heap usage: 1,793 allocs, 1,734 frees, 105,041 bytes allocated
==179996== 
==179996== LEAK SUMMARY:
==179996==    definitely lost: 2,240 bytes in 26 blocks
==179996==    indirectly lost: 943 bytes in 20 blocks
==179996==      possibly lost: 1,788 bytes in 12 blocks
==179996==    still reachable: 240 bytes in 1 blocks
==179996==         suppressed: 0 bytes in 0 blocks
==179996== Rerun with --leak-check=full to see details of leaked memory
==179996== 
==179996== Use --track-origins=yes to see where uninitialised values come from
==179996== For lists of detected and suppressed errors, rerun with: -s
==179996== ERROR SUMMARY: 151 errors from 5 contexts (suppressed: 0 from 0)

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
2,439 Views

>>that's a pretty dramatic proposition, "Code that conditionally accesses entities that may not be defined cannot be optimised". 

This was not my intention to say that all conditional moves have issues. In properly generated code for conditional moves, the two candidates are located in registers. The "bad" example had the two candidates located in memory. Therefore, should the case be that the error is due to a conditional move with the two candidates located in memory, then this would indicate a compiler optimization error.

So, were you able to determine if the problem code was a conditional move or not?

 

FWIW

Have you checked your code for a false assumption that Fortran condition expression calculations "shortcuts" as does C/C++?

   if(LogicalExpression .and. OtherLogicalExpression) ...

Fortram may evaluate the expressions in either order as well as evaluate both expressions before determining if the whole of the if(...) is true or not.

Whereas C/C++ will shortcut the evaluation of OtherLogicalExpression should LogicalExpression be false.

This will get you in problems where the 1st expression determines if the second expression is valid (e.g. index in bound or pointer is valid).

 

Jim Dempsey

0 Kudos
everythingfunctional
2,419 Views

I have so far been unable to pinpoint exactly what the problem is other than to say it is almost certainly a compiler bug.

I'm well aware of the non-short-circuiting behavior of Fortran logical expressions, and have double checked the relevant code to ensure I did not mistakenly do something that would be invalid.

If I were going to take a guess, it's an invalid use of a part of the descriptor for an allocatable variable in the code generated for cleanup of temporaries or on procedure exit. I have no way to confirm or rule out that guess though.

0 Kudos
everythingfunctional
2,462 Views

I went through the process of trying to narrow this down and ... I have no words.

https://github.com/HPC-Bugs/reproducers/pull/7 

0 Kudos
jimdempseyatthecove
Honored Contributor III
2,440 Views

RE: memory leaks.

 

There may (had been in the past) issues where the Fortran initialization code (runtime setup) allocates memory before you enter the PROGRAM, and fails to return the allocations upon termination of the program.

You can check for this by placing a

   STOP("Remove this line")

at the beginning of the program, and then checking if Leaks are reported and match those of your program (without the STOP). If this be the cause of the "leak" then you can safely ignore the message (as the heap is returned upon process termination).

 

Jim Dempsey

0 Kudos
everythingfunctional
2,427 Views

I appreciate the suggestion, but I'm not really worried about the memory leak (yet). I'm concerned about the fact that a program as simple as this accesses uninitialised data.

program example
    integer, allocatable :: x
    allocate(x, source = 1)
    print *, x
end program
$ ifx -check uninit -g -O0 example.f90
$ ./a.out
           1
Uninitialized bytes in __interceptor_write at offset 0 inside [0x725000000000, 13)
==230187==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x4a8a17 in for__write_output (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x4a8a17) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #1 0x4a978e in for__put_sf (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x4a978e) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #2 0x4938a1 in for_write_seq_lis_xmit (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x4938a1) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #3 0x48fac2 in for_write_seq_lis (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x48fac2) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #4 0x488d6b in MAIN__ /home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/example.f90:4:5
    #5 0x40a578 in main (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x40a578) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #6 0x7fd9162f3ccf  (/usr/lib/libc.so.6+0x27ccf) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
    #7 0x7fd9162f3d89 in __libc_start_main (/usr/lib/libc.so.6+0x27d89) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
    #8 0x40a444 in _start (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x40a444) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)

  Uninitialized value was created by a heap allocation
    #0 0x416d36 in __interceptor_malloc /netbatch/donb00013_00/dir/workspace/NIT/xmain-rel/LX/xmainefi2linux_release/ws/icsws/llvm/compiler-rt/lib/msan/msan_interceptors.cpp:933:3
    #1 0x48d642 in for__get_vm (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x48d642) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #2 0x4b8519 in for__open_proc (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x4b8519) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #3 0x4a6f1a in for__open_default (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x4a6f1a) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #4 0x48f573 in for_write_seq_lis (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x48f573) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #5 0x488d6b in MAIN__ /home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/example.f90:4:5
    #6 0x40a578 in main (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x40a578) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace)
    #7 0x7fd9162f3ccf  (/usr/lib/libc.so.6+0x27ccf) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/brad/Repositories/GitHub/BerkeleyLab/reproducers/compiler/Fortran/ifx/allocatable/a.out+0x4a8a17) (BuildId: 1227e2809778df724044ad166721b7de6a9e7ace) in for__write_output
Exiting

 

0 Kudos
Barbara_P_Intel
Employee
2,407 Views

Today there are false positives from some external libraries until they are built with -fsanitize=memory which is what -check uninit translates to. Maybe we should have named this a preview feature. 

The info you reported certainly looks like an external Fortran runtime library and not your code.

hmmm... I can't reproduce the uninitialized variable from your example. What OS are you using?

$ ifx --version
ifx (IFX) 2023.2.0 20230622
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

$ ifx -check uninit -g -O0 example.f90
$ a.out
           1

 

0 Kudos
everythingfunctional
2,395 Views
0 Kudos
everythingfunctional
2,394 Views

I also don't see the behavior on Perlmutter which has 2023.1.0, so maybe I'm just special and shouldn't be testing things on my local machine.

0 Kudos
Barbara_P_Intel
Employee
2,373 Views

Arch Linux is not supported. See the Fortran System Requirements

Also, -check uninit for ifx was first enabled with version 2023.2.0. In prior versions of ifx it was quietly ignored.

 

0 Kudos
everythingfunctional
2,366 Views

I see. Aside from this, it seems to work fine on Arch, and with Perlmutter on a version that doesn't have that feature, maybe it would be present there. I'll try it out on my Pop!OS laptop and see how that goes.

0 Kudos
everythingfunctional
2,315 Views

I tried it on my Pop!OS laptop. I did a full purge of oneAPI, and reinstalled it via the official method using apt and I get the same error from MemorySanitizer.

 

Today there are false positives from some external libraries until they are built with -fsanitize=memory which is what -check uninit translates to. Maybe we should have named this a preview feature. 

Or maybe not turned it on with `-check all`?

0 Kudos
JohnNichols
Valued Contributor III
2,299 Views

I downloaded the tree program from Github, here is a VS Windows solution, it will not compile as it wants isovarying string. 

Any ideas where I find it?  I find a lot of chatter on this forum, but no code?

 

0 Kudos
everythingfunctional
2,298 Views

You need to use `fpm` to compile and run it. I.e. `fpm run --compiler ifx`, it will automatically download the dependencies for you.

0 Kudos
everythingfunctional
2,298 Views

Otherwise, the dependencies and their locations are listed in the `fpm.toml` file if you want to do all the work manually.

0 Kudos
JohnNichols
Valued Contributor III
2,285 Views

Ok I added the files and now I get 69 errors that are beyond my stretch of time.  

Your program does not like Windows VS and Intel Fortran. 

 

0 Kudos
Reply