https://bugs.llvm.org/show_bug.cgi?id=50122

            Bug ID: 50122
           Summary: Parser::ParseCastExpression - dodgy unused write
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

The static analyzer is warning about an unread variable write in
Parser::ParseCastExpression:

  switch (SavedKind) {
  case tok::l_paren: {
    // If this expression is limited to being a unary-expression, the paren can
    // not start a cast expression.
    ParenParseOption ParenExprType;
    switch (ParseKind) {
      case CastParseKind::UnaryExprOnly:
        if (!getLangOpts().CPlusPlus)
          ParenExprType = CompoundLiteral; // <<<< UNUSED WRITE WARNING
        LLVM_FALLTHROUGH;
      case CastParseKind::AnyCastExpr:
        ParenExprType = ParenParseOption::CastExpr;
        break;
      case CastParseKind::PrimaryExprOnly:
        ParenExprType = FoldExpr;
        break;
    }

This looks like it was introduced in https://reviews.llvm.org/D43357

Before that the code looked like:

ParenParseOption ParenExprType =
        (isUnaryExpression && !getLangOpts().CPlusPlus) ? CompoundLiteral
                                                        : CastExpr;
So maybe we're missing a break ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to