From ffd798c75cde5aba15f0ae08e2e4644bba7b8770 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 19 Feb 2019 22:35:12 +0000 Subject: [PATCH] [LangRef] add to description of alloca instruction As mentioned in D58359, we can explicitly state that the memory allocated is uninitialized and reading that memory produces undef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354394 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.rst | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/LangRef.rst b/docs/LangRef.rst index 044f3521ce6..8483d74dd4f 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -8364,15 +8364,16 @@ boundary compatible with the type. Semantics: """""""""" -Memory is allocated; a pointer is returned. The operation is undefined -if there is insufficient stack space for the allocation. '``alloca``'d -memory is automatically released when the function returns. The -'``alloca``' instruction is commonly used to represent automatic -variables that must have an address available. When the function returns -(either with the ``ret`` or ``resume`` instructions), the memory is -reclaimed. Allocating zero bytes is legal, but the returned pointer may not -be unique. The order in which memory is allocated (ie., which way the stack -grows) is not specified. +Memory is allocated; a pointer is returned. The allocated memory is +uninitialized, and loading from uninitialized memory produces an undefined +value. The operation itself is undefined if there is insufficient stack +space for the allocation.'``alloca``'d memory is automatically released +when the function returns. The '``alloca``' instruction is commonly used +to represent automatic variables that must have an address available. When +the function returns (either with the ``ret`` or ``resume`` instructions), +the memory is reclaimed. Allocating zero bytes is legal, but the returned +pointer may not be unique. The order in which memory is allocated (ie., +which way the stack grows) is not specified. Example: """""""" -- 2.40.0