Giter Site home page Giter Site logo

Hashtable write error on exit about stdlib HOT 7 CLOSED

chuckyvt avatar chuckyvt commented on September 21, 2024
Hashtable write error on exit

from stdlib.

Comments (7)

chuckyvt avatar chuckyvt commented on September 21, 2024

recursive subroutine free_map_entry_pool(pool) seems to be the free memory routine that is causing the error.

from stdlib.

jvdp1 avatar jvdp1 commented on September 21, 2024

Thank you @chuckyvt for reporting the issue.

I used ifx 2024.0.2 and I could not run even the following simple program:

program main

use stdlib_hashmaps, only: chaining_hashmap_type
use stdlib_hashmap_wrappers, only: fnv_1_hasher
    
implicit none
 
call hash_test

contains

subroutine hash_test
    
    type(chaining_hashmap_type) :: map
    
    call map%init(fnv_1_hasher)
    
end subroutine hash_test

end program main

I got the following error on my Fedora computer:

$ fpm run
Project is up to date
==226944==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x4aaed7 in stdlib_hashmaps_MP_init_chaining_map_ /home/jvandenp/test_hash/build/dependencies/stdlib/src/stdlib_hashmap_chaining.f90:472:9
    #1 0x48b0c3 in main_IP_hash_test_ /home/jvandenp/test_hash/app/main.f90:16:10
    #2 0x489cf3 in MAIN__ /home/jvandenp/test_hash/app/main.f90:8:6
    #3 0x40a5c8 in main (/home/jvandenp/test_hash/build/ifx_22B6DB2C5432A52F/app/test_hash+0x40a5c8) (BuildId: e27a311375dcefa55955a7499cd17857dcbbaed4)
    #4 0x7ffa4822950f in __libc_start_call_main (/lib64/libc.so.6+0x2950f) (BuildId: 8257ee907646e9b057197533d1e4ac8ede7a9c5c)
    #5 0x7ffa482295c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x295c8) (BuildId: 8257ee907646e9b057197533d1e4ac8ede7a9c5c)
    #6 0x40a494 in _start (/home/jvandenp/test_hash/build/ifx_22B6DB2C5432A52F/app/test_hash+0x40a494) (BuildId: e27a311375dcefa55955a7499cd17857dcbbaed4)

  Uninitialized value was created by an allocation of 'var$66' in the stack frame
    #0 0x4a6ccb in stdlib_hashmaps_MP_init_chaining_map_ /home/jvandenp/test_hash/build/dependencies/stdlib/src/stdlib_hashmap_chaining.f90:417:42

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/jvandenp/test_hash/build/dependencies/stdlib/src/stdlib_hashmap_chaining.f90:472:9 in stdlib_hashmaps_MP_init_chaining_map_
Exiting
<ERROR> Execution for object " test_hash " returned exit code  1
<ERROR> *cmd_run*:stopping due to failed executions
STOP 1

Could you test it on your computer, please?
I am wondering if it is not a bug of the compiler itself.

from stdlib.

jvdp1 avatar jvdp1 commented on September 21, 2024

Update: it seems to be a more general issue: see here for more details.

from stdlib.

chuckyvt avatar chuckyvt commented on September 21, 2024

Interesting. I'm on Windows, and I believe IFX for Linux has more detailed memory sanitizer features, so I am not seeing this. I will say I have tested the posted code snippet with IFX, IFort, and GFortran 13.2 and see the same behavior for all. So at this point, it doesn't seem to be compiler specific.

from stdlib.

jvdp1 avatar jvdp1 commented on September 21, 2024

Strange. I can compile and run the posted code snippet with GCC 12.2.1. on my Fedora computer.

Do you have similar problems with the stdlib tests or examples? All of them are tested with GCC 13 in the CI (Linux and Windows).

from stdlib.

chuckyvt avatar chuckyvt commented on September 21, 2024

Ok, so I think I have this run to ground. Long story short, the failure is due to a stack overflow as best I can tell, though the program doesn't say that. (Just returns a memory access error vs a specific stack overflow message I'm used to). This would explain the different behavior between Linux and Windows. I have increased the stack size and now runs ok.

As a side note, since on the stdlib test cases the hashtable is at the main program level, the final procedure is never called in the checks I put together. Structuring a test case so that the hastable is in a subroutine or similar may be a decent idea to include at some point.

from stdlib.

jvdp1 avatar jvdp1 commented on September 21, 2024

Thank you @chuckyvt for clarifying and closing the issue.

As a side note, since on the stdlib test cases the hashtable is at the main program level, the final procedure is never called in the checks I put together. Structuring a test case so that the hastable is in a subroutine or similar may be a decent idea to include at some point.

Good point. Don't hesitate to submit a PR with such a test. Otherwise I'll try to do it.

from stdlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.