This is the same fix as in r338478, for another occurrance of the
same pattern from r338464.
See gcc.gnu.org/PR86769 for details of the bug.
llvm-svn: 338749
const TypeSourceInfo *TSI = FD->getTypeSourceInfo();
if (!TSI)
return false;
+ // Don't declare this variable in the second operand of the for-statement;
+ // GCC miscompiles that by ending its lifetime before evaluating the
+ // third operand. See gcc.gnu.org/PR86769.
+ AttributedTypeLoc ATL;
for (TypeLoc TL = TSI->getTypeLoc();
- auto ATL = TL.getAsAdjusted<AttributedTypeLoc>();
+ (ATL = TL.getAsAdjusted<AttributedTypeLoc>());
TL = ATL.getModifiedLoc()) {
if (ATL.getAttrKind() == AttributedType::attr_lifetimebound)
return true;