diff options
Diffstat (limited to '')
-rw-r--r-- | src/lj_cconv.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lj_cconv.c b/src/lj_cconv.c index f33ed56d..b81b4e90 100644 --- a/src/lj_cconv.c +++ b/src/lj_cconv.c | |||
@@ -718,12 +718,14 @@ static void cconv_struct_init(CTState *cts, CType *d, CTSize sz, uint8_t *dp, | |||
718 | ** This is true if an aggregate is to be initialized with a value. | 718 | ** This is true if an aggregate is to be initialized with a value. |
719 | ** Valarrays are treated as values here so ct_tv handles (V|C, I|F). | 719 | ** Valarrays are treated as values here so ct_tv handles (V|C, I|F). |
720 | */ | 720 | */ |
721 | int lj_cconv_multi_init(CType *d, TValue *o) | 721 | int lj_cconv_multi_init(CTState *cts, CType *d, TValue *o) |
722 | { | 722 | { |
723 | if (!(ctype_isrefarray(d->info) || ctype_isstruct(d->info))) | 723 | if (!(ctype_isrefarray(d->info) || ctype_isstruct(d->info))) |
724 | return 0; /* Destination is not an aggregate. */ | 724 | return 0; /* Destination is not an aggregate. */ |
725 | if (tvistab(o) || (tvisstr(o) && !ctype_isstruct(d->info))) | 725 | if (tvistab(o) || (tvisstr(o) && !ctype_isstruct(d->info))) |
726 | return 0; /* Initializer is not a value. */ | 726 | return 0; /* Initializer is not a value. */ |
727 | if (tviscdata(o) && lj_ctype_rawref(cts, cdataV(o)->ctypeid) == d) | ||
728 | return 0; /* Source and destination are identical aggregates. */ | ||
727 | return 1; /* Otherwise the initializer is a value. */ | 729 | return 1; /* Otherwise the initializer is a value. */ |
728 | } | 730 | } |
729 | 731 | ||
@@ -733,7 +735,7 @@ void lj_cconv_ct_init(CTState *cts, CType *d, CTSize sz, | |||
733 | { | 735 | { |
734 | if (len == 0) | 736 | if (len == 0) |
735 | memset(dp, 0, sz); | 737 | memset(dp, 0, sz); |
736 | else if (len == 1 && !lj_cconv_multi_init(d, o)) | 738 | else if (len == 1 && !lj_cconv_multi_init(cts, d, o)) |
737 | lj_cconv_ct_tv(cts, d, dp, o, 0); | 739 | lj_cconv_ct_tv(cts, d, dp, o, 0); |
738 | else if (ctype_isarray(d->info)) /* Also handles valarray init with len>1. */ | 740 | else if (ctype_isarray(d->info)) /* Also handles valarray init with len>1. */ |
739 | cconv_array_init(cts, d, sz, dp, o, len); | 741 | cconv_array_init(cts, d, sz, dp, o, len); |