Section LOADSTORE_FIELD_AT.
Context {cs: compspecs}.

Lemma semax_store_nth_ram_field_at:
forall {Espec: OracleKind} {cs: compspecs} n Delta sh P Q R e1 e2 Pre Post
t_root gfs (p v_val: val) (v_reptype: reptype (nested_field_type t_root gfs)),
typeof e1 = nested_field_type t_root gfs ->
type_is_by_value (nested_field_type t_root gfs) = true ->
type_is_volatile (nested_field_type t_root gfs) = false ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
local (`(eq (field_address t_root gfs p)) (eval_lvalue e1)) ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
local (`(eq v_val) (eval_expr (Ecast e2 (nested_field_type t_root gfs)))) ->
JMeq v_val v_reptype ->
nth_error R n = Some Pre ->
writable_share sh ->
Pre |-- field_at_ sh t_root gfs p * (field_at sh t_root gfs v_reptype p -* Post) ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
(tc_lvalue Delta e1) && (tc_expr Delta (Ecast e2 (nested_field_type t_root gfs))) ->
semax Delta
(|> PROPx P (LOCALx Q (SEPx R)))
(Sassign e1 e2)
(normal_ret_assert
(PROPx P (LOCALx Q (SEPx (replace_nth n R Post))))).