Comments (5)
The current LLVM memory model doesn't allow changing the size of objects in place.
Thanks! That's what we wanted to find out. Is this written down anywhere?
I don't recall, but I don't think so. But I can guarantee you that optimizations follow that semantics. And Alive2 too, and these days it is kind of the oracle.
from alive2.
The current LLVM memory model doesn't allow changing the size of objects in place.
So, either bar
does realloc
on the pointer, which is equivalent to freeing it, and thus the load would be UB. Or it doesn't touch the pointer and the load is all fine.
C and C++ don't have object resizing. Or at least not to a point where we may need to model in the IR.
If Rust needs something along these lines, then we need to change LLVM IR's semantics and its optimizations. LLVM is not correct per the semantics you want.
The easiest way would be for Rust to hide the resizing in some function that returns a new pointer, so LLVM can think it's a new object. If that isn't viable (for some reason), then there's a ton of work to be done on LLVM. The Alive2 side is easy FWIW.
from alive2.
The current LLVM memory model doesn't allow changing the size of objects in place.
Thanks! That's what we wanted to find out. Is this written down anywhere?
The easiest way would be for Rust to hide the resizing in some function that returns a new pointer, so LLVM can think it's a new object
That doesn't work, since the entire point of this is to allow old pointers to still be used with the resized allocation. Otherwise we could just use realloc
.
from alive2.
What about the other question -- isn't the example an Alive bug since bar
might initialize mem[0]
to some value and then the source would return that value, but the target would return poison/undef since memory is uninit?
from alive2.
What about the other question -- isn't the example an Alive bug since
bar
might initializemem[0]
to some value and then the source would return that value, but the target would return poison/undef since memory is uninit?
It's a bug, yes.
It's a know problem: Alive2 doesn't havoc local memory blocks on function calls. This requires aligning the allocations in the src & tgt programs, and that stuff isn't implemented yet.
from alive2.
Related Issues (20)
- confusing CEX HOT 1
- make undef inputs default to off
- Incorrect bit layout for vectors of overaligned elements
- optimize indirect fn calls
- possible false alarm HOT 3
- load widening not working? HOT 1
- False positive when devirtualizing call with memory attributes
- unexpected memcmp() behavior HOT 3
- Inconsistent phi value after select based on undef value HOT 7
- Source and Target Example Values Diverge Before Source Code Does HOT 3
- unexpected result when tgt is asm
- Implicit conversion and static analysis warnings HOT 1
- arm-tv bug that won't repro in alive-tv HOT 2
- issue with returned arguments in asm memory mode HOT 4
- issue with aligned pointers
- Source function always being UB warning may be missing HOT 3
- undesirable poison in return value HOT 1
- target-side padding for non-byte-sized loads/stores HOT 1
- missed alarm? HOT 2
- add support for range attribute in args and ret val
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alive2.