Oliver Schneider
b8bd42e8d4
Merge pull request #234 from RalfJung/reallocate
...
Make Reallocate & Deallocate less permissive
2017-07-05 19:54:54 +02:00
Ralf Jung
4165051073
refine comment explaining the order of checks on deallocate
2017-07-05 10:26:15 -07:00
Oliver Schneider
9a04be974c
Merge pull request #232 from oli-obk/master
...
Only check pointers when dereferencing
2017-07-04 09:50:54 +02:00
Oliver Schneider
10ec543b9e
Merge pull request #235 from RalfJung/intrinsics
...
Implement some missing intrinsics
2017-07-04 08:38:22 +02:00
Ralf Jung
30f92f8a27
catch overflows that are hidden by first casting the RHS to u32
2017-07-03 20:50:19 -07:00
Ralf Jung
ffd482e2f5
check the assumptions made by the unchecked_ and copy_nonoverlapping intrinsics
2017-07-03 20:37:38 -07:00
Ralf Jung
f118ff43e7
implement the unchecked_ intrinsics; add all the doctests from one of the integer modules
2017-07-03 20:37:33 -07:00
Ralf Jung
440c4778fa
validate size and alignment on reallocate and deallocate
2017-07-03 16:47:58 -07:00
Ralf Jung
dc9f5a205f
properly check for: double-free, use-after-reallocate
2017-07-03 16:12:11 -07:00
Ralf Jung
030166757c
Fix transmute on ByValPair
...
Fixes #227
2017-07-03 13:58:50 -07:00
Oliver Schneider
823b952ef2
Only check pointers when dereferencing
...
Before we also checked whether pointers had alloc_ids when we created rvalue references
2017-07-03 14:16:11 +02:00
David Renshaw
e3fa4fb849
get cargo-miri to work
2017-06-29 13:06:36 -04:00
Oliver Schneider
8722ce8d4b
Merge pull request #223 from oli-obk/lvalue_read
...
Reinstate `eval_and_read_lvalue` optimizations
2017-06-29 15:40:06 +02:00
David Renshaw
73ab5c77c2
normalize signature before passing to check_sig_compat
2017-06-29 07:58:22 -04:00
David Renshaw
32e7dcb6fb
update for upstream changes to TyFnDef
2017-06-28 22:00:17 -04:00
Oliver Schneider
695f9723d2
Merge pull request #222 from oli-obk/const_eval_checks
...
Address comments to previous PR
2017-06-28 23:08:58 +02:00
Ralf Jung
51b43215a4
cast -> transmute
2017-06-28 11:37:15 -07:00
Oliver Schneider
917c89e697
Optimize lvalue reads from Value::ByVal and Value::ByValPair
2017-06-28 13:37:23 +02:00
Oliver Schneider
91409f1d76
Code nits
2017-06-28 13:10:50 +02:00
Oliver Schneider
c8079c652c
Address comments
2017-06-28 10:17:14 +02:00
Oliver Schneider
a724a39323
Reword comments
2017-06-28 09:46:41 +02:00
Oliver Schneider
5dfaacf310
Simplify all the code
2017-06-27 13:36:41 +02:00
Oliver Schneider
ab400f3eea
Initial work towards checking const eval rules in miri
2017-06-26 17:58:47 +02:00
Ralf Jung
76a1d66e77
fix build after rebase
2017-06-24 11:05:53 -07:00
Ralf Jung
38d03392fa
Clarify pattern matching
2017-06-24 11:05:13 -07:00
Ralf Jung
b1acc130bb
check alignment of pointers on Ref
2017-06-24 11:05:13 -07:00
Ralf Jung
f0c8df2291
handle ptr-int casts explicitly in cast.rs
2017-06-24 11:05:13 -07:00
Oliver Schneider
eca9e3429a
PrimVal used to allow comparing Undef
2017-06-23 16:12:03 +02:00
Oliver Schneider
5ee4fdcd15
fetch_tls_dtor "read" an Undef
as nonzero
2017-06-23 13:31:00 +02:00
Oliver Schneider
c4fc6c677d
Typo
2017-06-23 13:30:31 +02:00
Oliver Schneider
9be3e9185b
Remove the zst allocation
2017-06-23 12:55:49 +02:00
Ralf Jung
d5c031640f
use PrimVal::to_bool rather than bytes_to_bool
2017-06-22 20:20:26 -07:00
Ralf Jung
14cb31fb88
permit bit-anding in pointer values below the alignment
...
This makes HashMap work!
2017-06-22 14:46:53 -07:00
Ralf Jung
269667e152
implement _nonzero intrinsics
2017-06-22 14:46:53 -07:00
Ralf Jung
c1a6df941e
permit all kinds of 0-offsets on ZSTs
2017-06-22 14:26:17 -07:00
Ralf Jung
2f61356858
permit offsetting a NULL-ptr by 0, to fix hashmap test
2017-06-22 13:41:13 -07:00
Ralf Jung
57391bab10
fix unused variable warning
2017-06-22 11:33:39 -07:00
Ralf Jung
6512fa7be8
use PrimVal::is_null
2017-06-22 11:33:31 -07:00
Ralf Jung
3637aa86c8
allow any offset on integer pointers
2017-06-22 11:28:00 -07:00
Oliver Schneider
8de111018d
Merge pull request #201 from oli-obk/test_suite_fails
...
"Support" more libc functions
2017-06-22 14:16:45 +02:00
Oliver Schneider
8733bd0e7c
Update mod.rs
2017-06-22 11:40:06 +02:00
Oliver Schneider
a805606d45
malloc should return null for zst allocs
2017-06-22 08:52:53 +02:00
Ralf Jung
7b2b0dd56c
test HashMap creation in libstd-MIR, and make it work again
2017-06-21 23:09:34 -07:00
Ralf Jung
894306e47d
refactor pointer arithmetic handling
2017-06-21 22:59:47 -07:00
Ralf Jung
78aa93fa10
correctly reject functions pointers that had arithmetic done to them
2017-06-21 21:45:51 -07:00
Ralf Jung
7b1582b383
permit integer addition and subtraction on ptr-integers
2017-06-21 21:38:43 -07:00
Ralf Jung
b8c5e7fd0e
refactor pointer handling in binops
2017-06-21 21:02:11 -07:00
Ralf Jung
184d3b3bad
expand thread-local storage tests to cover dtor order and re-running dtors
2017-06-21 20:17:07 -07:00
Oliver Schneider
a630677b01
Report better errors on random numbers and threads
2017-06-21 16:34:40 +02:00
Oliver Schneider
ecc44fec7e
Implement malloc
and free
2017-06-21 15:51:42 +02:00
Oliver Schneider
f22c7e43df
Store env vars where necessary
2017-06-21 15:46:30 +02:00
Oliver Schneider
5414825f09
Simplify numeric intrinsics
2017-06-21 15:08:19 +02:00
Oliver Schneider
a82fe9ae0c
Enable more zst writes and reads
2017-06-20 16:26:53 +02:00
Oliver Schneider
ea6f6079ca
Use PrimVal instead of Pointer where applicable
2017-06-20 14:28:19 +02:00
Oliver Schneider
a6734cd890
Fix unions
2017-06-20 14:28:18 +02:00
Oliver Schneider
75fddee700
Simplify the return lvalue
2017-06-20 14:28:18 +02:00
Oliver Schneider
a2baeb516c
Run the tls destructors in the correct order
2017-06-20 14:28:18 +02:00
Oliver Schneider
43afa20dc7
Add pthread docs
2017-06-20 14:28:18 +02:00
Oliver Schneider
fcf495821e
Get rid of the integer allocation
2017-06-20 14:28:18 +02:00
Oliver Schneider
f5ca91e812
Update to latest nightly
2017-06-20 14:28:18 +02:00
David Renshaw
f14ebd1142
handle EndRegion as no-op
2017-06-20 19:35:46 +09:00
Oliver Schneider
03577a905a
Fix some clippy warnings
2017-06-12 13:56:29 +02:00
David Renshaw
f174cc8a4c
tcx.infer_ctxt() no longer takes an argument
2017-06-10 20:39:48 -04:00
Ralf Jung
e0559a6b24
typos
2017-06-08 10:56:49 -07:00
Ralf Jung
3e1596d8c9
Error out when "primitive MIR math" (as opposed to unchecked intrinsics) overflows
...
Fixes #178
2017-06-07 15:39:44 -07:00
Ralf Jung
e1562fbe71
comments
2017-06-06 10:15:54 -07:00
David Renshaw
49fb43f293
use type_align() and type_size() instaed of size_and_align_of_dst()
2017-06-06 10:29:53 -04:00
David Renshaw
c8be312933
fix issue 184 by marking the destination as a packed struct
2017-06-06 09:49:34 -04:00
Ralf Jung
91b93bc701
less strict kind test for pointer operations
2017-06-05 18:23:25 -07:00
Ralf Jung
684de68d6c
properly wrap pointer offsets at pointer size
2017-06-05 18:07:26 -07:00
Ralf Jung
7bfda59fe2
don't bother inserting integer relocations into the relocation table
2017-06-05 17:17:16 -07:00
Ralf Jung
36505c7b40
fix bitops being accidentally allowed on pointers from the same allocation
2017-06-05 17:17:16 -07:00
Ralf Jung
a291153414
Permit ptr->int->ptr roundtrip
2017-06-05 15:18:40 -07:00
Ralf Jung
2a231d66fc
check bounds when using offset intrinsic or MIR op
2017-06-05 14:27:26 -07:00
Ralf Jung
f39e015163
check for overflow when doing pointer arithmetic
2017-06-05 14:23:35 -07:00
Ralf Jung
70227c87bf
fix arith_offset not taking the size of the type into account; test for offset
2017-06-05 14:23:35 -07:00
Ralf Jung
6197f4fac9
Permit int->ptr->int roundtrip
2017-06-05 14:23:35 -07:00
Ralf Jung
cfff91ba3e
write_bytes intrinsic: if the write count is 0, the pointer does not have to be valid
2017-06-05 14:23:34 -07:00
Ralf Jung
1b5f77e4c1
Implement Offset like the other binary operators, share code with the intrinsic
...
Also improve drop glue tests
2017-06-05 14:19:10 -07:00
Ralf Jung
31cf66d0e8
remove our array drop glue and use rustc's instead; implement the new Offset and SizeOf operators
2017-06-05 10:06:40 -07:00
David Renshaw
ca8347a1ff
update for upstream ParamEnv changes
2017-06-02 21:00:35 -04:00
Oliver Schneider
ec7f1d5248
Fix typo
2017-06-02 06:53:52 +02:00
Ralf Jung
dd7735b722
make StorageLive kill the current value of the local
2017-06-01 17:59:00 -07:00
Ralf Jung
db6ce463fe
fix some nits
2017-06-01 11:01:55 -07:00
Ralf Jung
e6eaf2083a
interpret StorageLive & StorageDead, and check dead stack slots are not used
2017-05-31 17:41:33 -07:00
Ralf Jung
44a45f7c34
run test suite also against libstd with full MIR
2017-05-31 13:39:40 -07:00
Ralf Jung
6619ed89ba
bin/miri.rs looks for RUST_SYSROOT, so should bin/cargo-miri.rs
2017-05-31 11:17:33 -07:00
David Renshaw
fbc46276ff
prevent 'attempt to shift left with overflow' panic on platforms where pthread_key_t is 64 bits
2017-05-31 10:43:36 -04:00
Ralf Jung
2b37d500f1
simplify determining size and alignment of a pointer
2017-05-30 17:03:45 -07:00
Ralf Jung
b44babf230
allocate return pointer only when we start the program via the start lang item
2017-05-30 15:40:26 -07:00
Ralf Jung
dad95474cb
test thread-local key with no dtor
2017-05-30 10:41:38 -07:00
Ralf Jung
24a9a14dfa
fix various small nits
2017-05-30 10:41:38 -07:00
Ralf Jung
1241938f97
test suite now also passes on MIR-libstd
...
Also enable some tests that were disabled for no apparant reason.
(The comment in zst.rs was wrong, the test was disabled also for miri execution.)
Delete env_args test as the args can actually be queried with MIR-libstd (currently, they are always empty)
2017-05-30 10:41:38 -07:00
Ralf Jung
99433a1ffd
improve fn pointer signature check to allow some casts that should be permitted
...
Also properly check the "non-capturing Fn to fn" case
2017-05-30 10:41:38 -07:00
Ralf Jung
cd6e3e6431
If a "start" lang item incl. MIR is present, run that instead of running main directly
...
This fixes the memory leaks when running a simple "Hello World" with MIR-libstd
2017-05-30 10:41:38 -07:00
Ralf Jung
720c5f874e
implement __rust_maybe_catch_panic
2017-05-30 10:41:38 -07:00
Ralf Jung
55438fe5bf
unify the way we intercept missing MIR and C ABI calls; only intercept C ABI calls if MIR is missing
2017-05-30 10:41:38 -07:00
Ralf Jung
14b16dcf45
use proper span for TLS dtors; fix some nits
2017-05-30 10:41:38 -07:00
Ralf Jung
a66f359d91
support TLS destructors
2017-05-30 10:41:38 -07:00
Ralf Jung
238211e1b3
implement TLS
2017-05-30 10:41:38 -07:00
Ralf Jung
452cc9b396
handle statics with linkage: initialize them with NULL
2017-05-30 10:41:38 -07:00
Ralf Jung
33d42f4b82
also support writing to stderr
2017-05-30 10:41:38 -07:00
Ralf Jung
ab90500d8c
Make println!("String") work
...
miri complains about a memory leak when the program terminates. This may be related to thread-local dtors not running.
2017-05-30 10:41:38 -07:00
David Renshaw
c384f9568d
Rvalue::Box -> Rvalue::NullaryOp
2017-05-30 09:27:08 -04:00
David Renshaw
48662d5199
update for upstream changes with ty::ParamEnv
2017-05-23 23:40:39 -04:00
David Renshaw
0641e932bc
implement __rust_allocate_zeroed C ABI function
2017-05-21 15:48:31 -04:00
David Renshaw
2b84e176fb
update for new boxier mir
2017-05-13 07:09:57 -04:00
Oliver Schneider
5f67ba76f5
Removed unused crate imports
2017-05-05 10:37:04 +02:00
Oliver Schneider
da3860a293
Address things complained about by clippy
2017-05-05 10:34:38 +02:00
Oliver Schneider
07229d6305
Rustup to rustc 1.19.0-nightly ( 2d4ed8e0c
2017-05-03)
2017-05-04 17:42:43 +02:00
Oliver Schneider
671ccca891
Update to rustc 1.19.0-nightly ( 777ee2079
2017-05-01)
2017-05-02 10:44:35 +02:00
Oliver Schneider
488fc53db9
Update to the latest rustc version
2017-04-27 13:48:47 +02:00
Oliver Schneider
538c271e05
Address clippy lints
2017-04-26 12:15:42 +02:00
Oliver Schneider
76768479b5
Update for latest rustc changes
2017-04-25 16:51:58 +02:00
David Renshaw
d666bd7e62
update for latest rustc nightly: type_needs_drop_given_env() and type_contents() are gone
2017-04-23 13:45:04 -04:00
Eduard-Mihai Burtescu
b9bd747b6c
Import EvalError in lvalue.
2017-04-21 14:02:12 +03:00
Eduard-Mihai Burtescu
738c7d262a
Handle Use of ! as Unreachable is not emitted nowadays.
2017-04-21 13:56:44 +03:00
Eduard-Mihai Burtescu
cb3799b44b
Update for changes in LocalDecl on nightly.
2017-04-21 13:27:09 +03:00
Oliver Schneider
fdeee8fb59
Cleanup the diff
2017-03-29 09:10:05 +02:00
Oliver Schneider
065e9593b4
Rustup to rustc 1.17.0-nightly (
7846dbe0c
2017-03-26)
2017-03-27 10:13:21 +02:00
Oliver Schneider
bbeb7216e0
Thinify the fat pointer on virtual function calls
2017-03-23 18:32:57 +01:00
Oliver Schneider
cb867d250a
Fix casting generic functions to concrete function pointers
2017-03-23 17:57:40 +01:00
Oliver Schneider
f4ed482c4d
print
doesn't add a stack frame, so don't write arguments
2017-03-23 17:36:10 +01:00
Oliver Schneider
fb7cc3c164
Fix single field by val tuples
2017-03-23 16:09:36 +01:00
Oliver Schneider
eecc727e87
Reduce noisyness
2017-03-23 15:52:02 +01:00
Oliver Schneider
1263d56eb0
Merge branch 'master' of https://github.com/tsion/miri
2017-03-23 15:40:47 +01:00
Oliver Schneider
1c9f5ac669
Skip the transmute checks for closure glue
2017-03-23 15:23:53 +01:00
Oliver Schneider
1391c5a10a
Reintroduce fn ptr transmute check
2017-03-23 15:17:02 +01:00
Oliver Schneider
4e83659b1d
Fix manual rust-call impls
2017-03-23 15:07:33 +01:00
Oliver Schneider
d71f24c00f
Fix virtual function calls
2017-03-23 14:57:11 +01:00
Oliver Schneider
ad4f6b920a
Fix virtual function calls
2017-03-23 14:24:02 +01:00
Oliver Schneider
d70b79c778
Refactor function calls
2017-03-23 13:36:13 +01:00
Oliver Schneider
70ea218d2b
Reuse more rustc code instead of copying it into miri
2017-03-23 13:35:19 +01:00
Oliver Schneider
0255a51468
Fix function pointer calls
2017-03-23 10:04:08 +01:00
David Renshaw
f0bca59ad0
remove feature opt-ins that are no longer needed
2017-03-22 18:59:26 -04:00
Oliver Schneider
caed365dbe
Refactor drop into its own module and fix Vec
2017-03-22 18:31:41 +01:00
Oliver Schneider
3ef0b0de2c
Dropping slices works again
2017-03-22 17:51:43 +01:00
Oliver Schneider
c409079442
Dropping trait objects works again
2017-03-22 17:48:16 +01:00
Oliver Schneider
9e4e6cdb5c
Dropping arrays works again
2017-03-22 17:32:20 +01:00
Oliver Schneider
7c12ebc78d
Roll our own MIR for dropping arrays.
2017-03-22 16:16:23 +01:00
Oliver Schneider
030f00a8a1
Fix drop terminator
2017-03-22 14:19:29 +01:00
Oliver Schneider
26c3335dbf
Closures work again
2017-03-22 13:13:52 +01:00
David Renshaw
3612d826e7
ast::Attribute no longer has a 'value' field
2017-03-21 11:04:49 -04:00
Oliver Schneider
dc1b0fb436
Compiles again
2017-03-21 13:53:55 +01:00
Oliver Schneider
c6a18cead8
Rustup to rustc 1.17.0-nightly ( 134c4a0f0
2017-03-20)
2017-03-21 09:21:51 +01:00
Scott Olson
a82924b3e2
Merge pull request #152 from oli-obk/intrinsics
...
Intrinsics and overflow
2017-03-14 13:35:51 -07:00
Scott Olson
0ca0676abd
Merge pull request #146 from oli-obk/peephole1
...
[Peephole Optimization 1/n] Don't allocate for structs with a single primval field
2017-03-14 09:57:02 -07:00
Scott Olson
6ee8595375
Merge pull request #147 from oli-obk/rustup
...
rustup to rustc 1.17.0-nightly (60a0edc6c
2017-02-26)
2017-03-14 09:49:40 -07:00
Oliver Schneider
257ac5803f
Don't unconditionally mask bitshift rhs
2017-03-14 14:24:16 +01:00
Oliver Schneider
bb33830c60
Implement more atomic intrinsics
2017-03-14 13:05:51 +01:00