[clang-tidy] argument to operator delete is the address of a local stack variable, which is not memory allocated by 'new'
まだ誰も着手していません。
評価
調査の方向性
boost/multiprecision/number.hpp の 2005 行付近と boost/multiprecision/cpp_int.hpp の 1822-1904 行付近から始め、続いて 365 行の allocator パスと scoped_shared_storage の実装を調べます。報告された string 変換を伴う clang-tidy の診断を再現し、その警告が有効かどうかを判断し、結果として生じる動作を文書化またはテストします。
索引モデルが issue の本文から書いたものです。
説明
clang-tidy on a project brought this to my attention:
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/ext/new_allocator.h:125:2: error: Argument to operator delete is the address of a local stack variable, which is not memory allocated by 'new' [clang-analyzer-cplusplus.NewDelete,-warnings-as-errors]
::operator delete(__p);
^
...
my_private_include_path/include/boost/multiprecision/number.hpp:2005:25: note: Calling 'number::str'
std::string s = r.str(d, os.flags());
^
my_private_include_path/include/boost/multiprecision/number.hpp:808:14: note: Calling 'cpp_int_backend::str'
return m_backend.str(digits, f);
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1920:14: note: Calling 'cpp_int_backend::do_get_string'
return do_get_string(f, trivial_tag());
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1822:11: note: Assuming the condition is false
if ((f & std::ios_base::oct) == std::ios_base::oct)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1822:7: note: Taking false branch
if ((f & std::ios_base::oct) == std::ios_base::oct)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1824:16: note: Assuming the condition is false
else if ((f & std::ios_base::hex) == std::ios_base::hex)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1824:12: note: Taking false branch
else if ((f & std::ios_base::hex) == std::ios_base::hex)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1830:11: note: 'base' is not equal to 8
if (base == 8 || base == 16)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1830:11: note: Left side of '||' is false
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1830:24: note: 'base' is not equal to 16
if (base == 8 || base == 16)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1830:7: note: Taking false branch
if (base == 8 || base == 16)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1876:10: note: Taking false branch
if (t.sign())
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1881:14: note: Assuming the condition is false
if (this->size() == 1)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1881:10: note: Taking false branch
if (this->size() == 1)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1889:13: note: Loop condition is false. Execution continues on line 364
while (eval_get_sign(t) != 0)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1904:10: note: Calling implicit destructor for 'cpp_int_backend<0, 0, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, std::allocator<unsigned long long>>'
}
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:1904:10: note: Calling '~cpp_int_base'
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:364:11: note: Assuming field 'm_internal' is false
if (!m_internal)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:364:7: note: Taking true branch
if (!m_internal)
^
my_private_include_path/include/boost/multiprecision/cpp_int.hpp:365:10: note: Calling 'new_allocator::deallocate'
allocator().deallocate(limbs(), capacity());
^
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/ext/new_allocator.h:125:2: note: Argument to operator delete is the address of a local stack variable, which is not memory allocated by 'new'
::operator delete(__p);
^
I am not sure but it seems that clang-tidy misinterprets the call to the custom allocator scoped_shared_storage.
- 主要言語
- C++
- スター
- 268
- フォーク
- 130
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/multiprecision のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
boostorg/multiprecision#779 · コメント 1 件 ·
-
cpp_bin_float fma rounds the product before the addition instead of fusing対応中かも @NAThompson が 43 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
boostorg/multiprecision#777 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
boostorg/multiprecision#775 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
boostorg/multiprecision#768 · コメント 4 件 ·
-
Eigen NumTraits specialisation doesn't define max_digits10()対応中かも @trestoncuzzort が 28 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
boostorg/multiprecision#744 ·
boostorg/multiprecision の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
sav-oss-org/ptusa_main#1610 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
open-astro/AlpacaBridge#2606 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Refactor force_torque_system integration test to use EcmScope対応中かも @patelshivani2283-lab が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Niko1221/Strata#6731 · コメント 2 件 ·
メンテナーはふだん 6 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100