Pointer arithmetic in checked context is not detected as such

オープン
#4,280 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp

調査の方向性

Start by tracing how the decompiler translates checked pointer arithmetic, using the input code and generated output in the issue as the reproduction. Identify where pointer addition is represented or emitted and what existing tests cover that path; the issue names no files or tests. Done means checked pointer arithmetic is recognized and decompiled into clearer pointer arithmetic while preserving its checked behavior.

索引モデルが issue の本文から書いたものです。

説明

Bug Decompiler
Input code
		public unsafe static byte* PointerInChecked(int* p, int a, int b)
		{
#if LEGACY_CSC
			// Legacy csc has a compiler bug that causes `a * b` to be evaluated
			// with type `nint` instead of `int`; so test without the multiplication.
			return checked((byte*)p + a);
#else
			return checked((byte*)p + a * b);
#endif
		}
Ugly output
public unsafe static byte* PointerInChecked(int* p, int a, int b)
{
	return (byte*)checked(unchecked((nuint)p) + unchecked((nuint)a));
}

Not wrong, but the code would be a lot nicer if we detected pointer arithmetic.

主要言語
C#
スター
27.1k
フォーク
3.8k
平均マージ
1日 23時間
マージ済み PR(30日)
44

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

icsharpcode/ILSpy のほかの issue

icsharpcode/ILSpy の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。