<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/optimization/func-resource-result/init-copy-eliminate.slang, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2025-10-07T15:53:36+00:00</updated>
<entry>
<title>Fix a bug that causes a struct field to be initialized twice. (#8619)</title>
<updated>2025-10-07T15:53:36+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-10-07T15:53:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=54e1d02715747ee81585bfd23e96a1f4956dbf66'/>
<id>urn:sha1:54e1d02715747ee81585bfd23e96a1f4956dbf66</id>
<content type='text'>
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-&gt;member1 = 0;
this-&gt;member2 = 0;
this-&gt;member1 = param;
```
We can still remove the first assignment to `this-&gt;member1` despite
seeing `this-&gt;member2=0`, since it is easy to know that `this-&gt;member2`
cannot alias with `this-&gt;member1`.

Closes #8600.</content>
</entry>
</feed>
