Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Please respond to my comment.
Aside from the one comment, all builds and tests correctly and looks good.
flang/lib/Lower/ConvertExpr.cpp | ||
---|---|---|
2197 | This coding construct seems dangerous to me, although you're just mimicking the other cases. The function genTempExtAddr is returning a lambda where the capture is by reference. If I understand things correctly, this lambda will be evaluated after genTempExtAddr returns. The stack context at that point will not include the stack frame of genTempExtAddr. This means that any local variable declared in genTempExtAddr will not have a valid address at the point of evaluation. This section of code references the local variable loc. Thus, (again, please correct me if I have this wrong) at the time when this lambda is evaluated the reference to the variable loc will be erroneous. Furthermore, I believe that is erroneous reference will usually go undetected. I'm guessing that there are many places in the lowering code like this. |
flang/lib/Lower/ConvertExpr.cpp | ||
---|---|---|
2197 | The function genTempExtAddr is returning an ExtendedValue, not a lambda. The lambda is evaluated in the match so we are fine on this side. |
This coding construct seems dangerous to me, although you're just mimicking the other cases. The function genTempExtAddr is returning a lambda where the capture is by reference. If I understand things correctly, this lambda will be evaluated after genTempExtAddr returns. The stack context at that point will not include the stack frame of genTempExtAddr. This means that any local variable declared in genTempExtAddr will not have a valid address at the point of evaluation. This section of code references the local variable loc. Thus, (again, please correct me if I have this wrong) at the time when this lambda is evaluated the reference to the variable loc will be erroneous. Furthermore, I believe that is erroneous reference will usually go undetected.
I'm guessing that there are many places in the lowering code like this.