Code Monkey home page Code Monkey logo

Comments (2)

ahueck avatar ahueck commented on July 24, 2024
entry:
  alloca a;
  alloca b;
B1:
  start(a);
  ++stack;
  end(a);
B2:
  start(b);
  ++stack
  end(b);
fin:
  leave(stack);
  ret void;

Given a and b map to the same stack address X:

stack_vars == {X, X} with map == { X }

Can leave cause errorneous tracking?

from typeart.

ahueck avatar ahueck commented on July 24, 2024

Setting nounwind for all callbacks fails test runtime/24_threads_type_check.cpp with error free on unregistered address.
Tested for Clang-10.

Output without stack lifetime

>> Here we overwrite int32 with class.std::thread:
[Trace] Alloc 0x7fffe060c080 2 int32 4 1 (0x401891) S
[Warning]AllocationTracking.cpp:doAlloc:166:Pointer already in map 0x7fffe060c080 278 class.std::thread 8 1 (0x4018a5)
[Trace] Alloc 0x7fffe060c080 278 class.std::thread 8 1 (0x4018a5) S
<< end
>> Here we overwrite the first int32 with class.std::thread:
[Trace] Alloc 0x7fffe060c070 2 int32 4 1 (0x4018b9) S
[Trace] Alloc 0x7fffe060c064 2 int32 4 1 (0x4018cd) S
[Warning]AllocationTracking.cpp:doAlloc:166:Pointer already in map 0x7fffe060c070 278 class.std::thread 8 1 (0x4018e1)
[Trace] Alloc 0x7fffe060c070 278 class.std::thread 8 1 (0x4018e1) S
<< end

.....
[Trace] Stack after free: 11
[Trace] Freeing stack (11)  11
...
[Trace] Free 0x7fffe060c080 278 class.std::thread 8 1 (0x4018a5)
[Error]AllocationTracking.cpp:operator():214:Free on unregistered address 0x7fffe060c080 (0x401a9f)
[Trace] Free 0x7fffe060c070 278 class.std::thread 8 1 (0x4018e1)
[Trace] Free 0x7fffe060c064 2 int32 4 1 (0x4018cd)
[Error]AllocationTracking.cpp:operator():214:Free on unregistered address 0x7fffe060c070 (0x401a9f)
[Trace] Stack after free: 0

############################################
Allocation type detail (heap, stack, global)
...
2   :    0 ,  2484 ,    0 , int32 
#########################################
Free allocation type detail (heap, stack)
...
2   :    0 ,  2482 , int32   

Output with stack lifetime

[Trace] Alloc 0x7ffecda47888 2 int32 4 1 (0x401902) S
....
[Warning]AllocationTracking.cpp:doAlloc:166:Pointer already in map 0x7ffecda47888 278 class.std::thread 8 1 (0x401936)
[Trace] Alloc 0x7ffecda47888 278 class.std::thread 8 1 (0x401936) S


[Trace] Alloc 0x7ffecda47878 2 int32 4 1 (0x40194d) S
...
[Warning]AllocationTracking.cpp:doAlloc:166:Pointer already in map 0x7ffecda47878 278 class.std::thread 8 1 (0x401986)
[Trace] Free 0x7f6bfc579d1c 2 int32 4 1 (0x401311)
[Trace] Alloc 0x7ffecda47878 278 class.std::thread 8 1 (0x401986) S

.....

[Trace] Stack after free: 11
[Trace] Freeing stack (11)  11
[Trace] Free 0x7ffecda47888 278 class.std::thread 8 1 (0x401936)
[Error]AllocationTracking.cpp:operator():214:Free on unregistered address 0x7ffecda47888 (0x401aaf)
[Trace] Free 0x7ffecda47878 278 class.std::thread 8 1 (0x401986)
[Error]AllocationTracking.cpp:operator():214:Free on unregistered address 0x7ffecda47878 (0x401aaf)
[Trace] Stack after free: 0

from typeart.

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.