about summary refs log tree commit diff
path: root/src/liballoc_jemalloc
diff options
context:
space:
mode:
authorAlexey Tarasov <tarasov@dodologics.com>2017-08-12 18:42:44 +1000
committerAlexey Tarasov <tarasov@dodologics.com>2017-08-12 18:42:44 +1000
commit0cd358742dfcf3fa6b0d8a318cfb5cc748dc905d (patch)
tree944cf6399d0b2ed24f9703afc71133b70b810659 /src/liballoc_jemalloc
parent2fa5340318111d562af2ef4897c75916731d55a2 (diff)
downloadrust-0cd358742dfcf3fa6b0d8a318cfb5cc748dc905d.tar.gz
rust-0cd358742dfcf3fa6b0d8a318cfb5cc748dc905d.zip
Fixes issue 39827: ICE in volatile_store intrinsic
- adds handling of zero-sized types for volatile_store.
- adds type size checks and warnigns for other volatile intrinsics.
- adds a test to check warnings emitting.

Cause of the issue

While preparing for trans_intrinsic_call() invoke arguments are
processed with trans_argument() method which excludes zero-sized types
from argument list (to be more correct - all arguments for which
ArgKind is Ignore are filtered out). As result volatile_store() intrinsic
gets one argument instead of expected address and value.

How it is fixed

Modification of the trans_argument() method may cause side effects,
therefore change was implemented in volatile_store() intrinsic building
code itself. Now it checks function signature and if it was specialised
with zero-sized type, then emits C_nil() instead of accessing
non-existing second argument.

Additionally warnings are added for all volatile operations which are
specialised with zero-sized arguments. In fact, those operations are omitted
in LLVM backend if no memory affected at all, e.g. number of elements
is zero or type is zero-sized. This was not explicitly documented before
and could lead to potential issues if developer expects volatile behaviour,
but type has degraded to zero-sized.
Diffstat (limited to 'src/liballoc_jemalloc')
0 files changed, 0 insertions, 0 deletions