<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/110617>110617</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Miscompile assigning to result of comma operator?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          efriedma-quic
      </td>
    </tr>
</table>

<pre>
    Consider the following in C:

```
struct S;
struct C {
  int i;
  struct S *tab[1];
};
struct S { struct C c; };
void f(struct S *x) {
 ((void)1, x->c).tab[0] = 0;
}
```

Normally, the result of a comma operator isn't assignable, because it's an rvalue... but with array-to-pointer decay, you can assign to it.  So the question is, does the assignment affect "x"?  Or are we supposed to construct a temporary?  Or is this just undefined behavior?

It looks like for the equivalent with an assignment operator, we do construct a temporary.  Not sure if there's any other way to get a struct rvalue in C.

Ran into this trying to figure out why we allow EmitLValue on a CK_LValueToRValue in CodeGen.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VF2P2zYQ_DWrl4UFiZJP1oMecnZcFG1TIFfktaDFlc2E4vr4YZ__fUFJvviKFjBkkJqdnR2OKL3XR0vUwfoZ1rtMxnBi19HgNKlRrl6j7rMDq1u3Zeu1IofhRDiwMXzV9oja4haqT1DsoLg_n4rlNy19cLEP-ALV84eNLUKz7CBqG1C_IxDvRQjiU5AHWD-XsN69A6DZ_ZvuJdHhO3cP1TM-wi6sFQ4gNo_UbyDaBxkgNiA2CQmiLUFs8W0F1eceRJvPKgpY7xCqHRYftPzX3PPzC7tRGnNLZMk5Rz6agDygxJ7HUSKfycnADrW3IJqA85nIg6FUdKBeRk-oA4jGo7ToLtJEyvMcDzHgVYcTSufkbRV4dWZtAzlU1Mup540j9tIupBgYdcgRX3hS8xrJB80WtU9gxeSn_Rk9kg0oh4H6gCDEGwgB1R7xT4fSEV4JfTyf2ZNKvD3bxVqJgcYzO-lud7xOvNrj9-gDRqto0JYUHugkL5odVPtH034NaJh_eDT6RwrbHDp6jfoiTRI1D20fdd5tTHNcCdX_CMoRv3BAHx2hHhKvo8XYG3Ja4lXe0jxHSoULw-z5lPb8UelXaVN2eZ4uuFv6JgLjoI-pA6cDOt2SIJm-GPw86vD7t4mLLUrc_vb3vPyLv357b8GKfiGbZ6qrVFu1MqOubETT1E3RNtmpU62isqhkIURfK9VvhrYSVVvTsKmaZtNkuhOFqMuiKIuyrtdNrkTbU1s3QrVP1NcK6oJGqU1uzGXM2R0z7X2kriyLp7LJjDyQ8dOlIISlK05v0_mvd5nrUtHqEI8e6sJoH_xPmqCDoe4P7Xsez9rco7TY8jP9H7MP1T6LznSnEM4-XSdiD2J_1OEUD3nPI4h96rD8rc6Ov1MfQOwnXR7EfhF-6cQ_AQAA___Msohd">