Issue 90162
Summary [clang][static analyzer]alpha.deadcode.UnreachableCode false positive on cxxTryStmt
Labels clang:static analyzer
Assignees
Reporter mzyKi
    ```cpp
  class BaseException {};
 
  class DerivedException : public BaseException {};
  
  void foo();
  
  void f4() {
    try {
      foo();
    } catch (BaseException &b) {
    } catch (DerivedException &d) {
    }
 }
```

When I run ```clang-tidy --allow-enabling-analyzer-alpha-checkers -checks=-*,clang-analyzer-alpha.deadcode.UnreachableCode test.cpp```, the result like as following:

```bash
test.cpp:8:3: warning: This statement is never executed [clang-analyzer-alpha.deadcode.UnreachableCode]
    8 |   try {
      | ^~~~~
    9 |     foo();
      |     ~~~~~~
   10 |   } catch (BaseException &b) {
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   11 |   } catch (DerivedException &d) {
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   12 |   }
      | ~
test.cpp:8:3: note: This statement is never executed
    8 |   try {
      |   ^~~~~
    9 |     foo();
      |     ~~~~~~
   10 | } catch (BaseException &b) {
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 11 |   } catch (DerivedException &d) {
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   12 |   }
      | ~

```

I think this is false positive. If not , I am not clear about reason.



_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to