diff options
| author | Yong He <yonghe@outlook.com> | 2025-10-07 08:53:36 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-07 15:53:36 +0000 |
| commit | 54e1d02715747ee81585bfd23e96a1f4956dbf66 (patch) | |
| tree | 83dfc746883b6b7aee0018bb55d4aea3095400e8 /include | |
| parent | 0dac20642b971191256e058282811cf9307292e7 (diff) | |
Fix a bug that causes a struct field to be initialized twice. (#8619)
We insert field initialization logic at the beginning of every ctor in
`synthesizeCtorBody`, but then immediately inserts another round of
initialization again for explicit ctors in `maybeInsertDefaultInitExpr`,
both called from `SemanticsDeclBodyVisitor::visitAggTypeDecl` right next
to each other.
The fix is to remove `maybeInsertDefaultInitExpr`.
This change also enhances the address aliasing analysis, so that for the
following case:
```
this->member1 = 0;
this->member2 = 0;
this->member1 = param;
```
We can still remove the first assignment to `this->member1` despite
seeing `this->member2=0`, since it is easy to know that `this->member2`
cannot alias with `this->member1`.
Closes #8600.
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
