# 'use-of-uninitialized-value' warning with '-check all' option of 'ifx'

**URL:** <https://fortran-lang.discourse.group/t/use-of-uninitialized-value-warning-with-check-all-option-of-ifx/6823>\
**Category:** Uncategorized\
**Created:** [November 19, 2023, 8:12am UTC](https://fortran-lang.discourse.group/t/use-of-uninitialized-value-warning-with-check-all-option-of-ifx/6823 "2023-11-19T08:12:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ali/32/751_2.png) [@Ali](https://fortran-lang.discourse.group/u/Ali)\
**Post date:** [November 19, 2023, 8:12am UTC](https://fortran-lang.discourse.group/t/use-of-uninitialized-value-warning-with-check-all-option-of-ifx/6823/1 "2023-11-19T08:12:45Z")

</div>

Why does the `check all` option of `ifx` show a `use-of-uninitialized-value` warning for `print` and `write` commands?

```Fortran
program test
   implicit none
   print*, "Hello World!"
end program test

```

```shell
ifx test.f90 -g -traceback -O0 -check all

```

```shell
ifx (IFX) 2023.2.0 20230622

```

```shell
Uninitialized bytes in __interceptor_write at offset 0 inside [0x725000000000, 14)
==715395==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x4a8847 in for__write_output (/pvt/prj/test/a.out+0x4a8847) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #1 0x4a95be in for__put_sf (/pvt/prj/test/a.out+0x4a95be) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #2 0x4936d1 in for_write_seq_lis_xmit (/pvt/prj/test/a.out+0x4936d1) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #3 0x48f8f2 in for_write_seq_lis (/pvt/prj/test/a.out+0x48f8f2) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #4 0x488ba4 in MAIN__ /pvt/prj/test/test.f90:3:4
    #5 0x40a578 in main (/pvt/prj/test/a.out+0x40a578) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #6 0x7f0cde648d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #7 0x7f0cde648e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #8 0x40a444 in _start (/pvt/prj/test/a.out+0x40a444) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)

  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 0x48d472 in for__get_vm (/pvt/prj/test/a.out+0x48d472) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #2 0x4b8349 in for__open_proc (/pvt/prj/test/a.out+0x4b8349) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #3 0x4a6d4a in for__open_default (/pvt/prj/test/a.out+0x4a6d4a) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #4 0x48f3a3 in for_write_seq_lis (/pvt/prj/test/a.out+0x48f3a3) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #5 0x488ba4 in MAIN__ /pvt/prj/test/test.f90:3:4
    #6 0x40a578 in main (/pvt/prj/test/a.out+0x40a578) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b)
    #7 0x7f0cde648d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/pvt/prj/test/a.out+0x4a8847) (BuildId: 651c59f3a6ec2721360a931dfb6fe92bf178ca5b) in for__write_output
Exiting

```

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [November 19, 2023, 3:46pm UTC](https://fortran-lang.discourse.group/t/use-of-uninitialized-value-warning-with-check-all-option-of-ifx/6823/2 "2023-11-19T15:46:14Z")

</div>

The output you show looks like a report from valgrind. These could very well be messages coming from system or runtime libraries, not so much from the program itself.

---

<div class="post-metadata">

**Author:** ![alirezagh76](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@alirezagh76](https://fortran-lang.discourse.group/u/alirezagh76)\
**Post date:** [November 19, 2023, 4:03pm UTC](https://fortran-lang.discourse.group/t/use-of-uninitialized-value-warning-with-check-all-option-of-ifx/6823/3 "2023-11-19T16:03:58Z")

</div>

Intel LLVM compiler, ifx, provides a new feature called memory sanitizer. It was explained in the event shared by @shahmoradi:

> [@Aug 30th (Wednesday) Townhall with the Intel® Fortran Compiler Developers](https://fortran-lang.discourse.group/t/aug-30th-wednesday-townhall-with-the-intel-fortran-compiler-developers/6402/4):
>
> For all interested, the webinar recording is [available here](https://www.intel.com/content/www/us/en/developer/videos/townhall-with-intel-fortran-compiler-developers.html#gs.4ope0q).

At that time, it seemed to have some problems or at least inconvenient to use because of its output.  
Unless it is intentionally planned to use the new feature, it is better to disable “uninit”, otherwise it is enabled by “-check all”. In the video, it was explained how to disable it.

---

<div class="post-metadata">

**Author:** ![Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ali/32/751_2.png) [@Ali](https://fortran-lang.discourse.group/u/Ali)\
**Post date:** [November 19, 2023, 5:03pm UTC](https://fortran-lang.discourse.group/t/use-of-uninitialized-value-warning-with-check-all-option-of-ifx/6823/4 "2023-11-19T17:03:33Z")

</div>

> [@Arjen](#):
>
> The output you show looks like a report from valgrind.

Yes, indeed. It seems that ifx makes use of Valgrind.

> [@alirezagh76](#):
>
> it is better to disable “uninit”

Using `-check nouninit` can now be considered.

I hope that this issue will be resolved in the near future because it’s causing problems when using fpm with a debug profile. Perhaps it would be better to include this flag for ifx in the debug profile of fpm at this moment.

---

<div class="post-metadata">

**Author:** ![greenrongreen](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/greenrongreen/32/1249_2.png) [@greenrongreen](https://fortran-lang.discourse.group/u/greenrongreen)\
**Post date:** [November 20, 2023, 10:30pm UTC](https://fortran-lang.discourse.group/t/use-of-uninitialized-value-warning-with-check-all-option-of-ifx/6823/5 "2023-11-20T22:30:24Z")

</div>

It’s the LLVM Sanitizers being used by IFX. There is a bug with this initial release in the msan libs. We’ll fix that in 2024.1 Update release. For now, yes, simply replace  
-check all  
or  
-check uninit  
with  
-check all,nouninit  
or  
-check nouninit

OR you can unset the env var LIBRARY\_PATH or remove the path in this variable to /2024.0.0/compiler/2024.0/lib

---

<div class="post-metadata">

**Author:** ![Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ali/32/751_2.png) [@Ali](https://fortran-lang.discourse.group/u/Ali)\
**Post date:** [November 21, 2023, 5:26am UTC](https://fortran-lang.discourse.group/t/use-of-uninitialized-value-warning-with-check-all-option-of-ifx/6823/6 "2023-11-21T05:26:54Z")

</div>

Thanks @greenrongreen. looking forward to the 2024.1 Update release.
