Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Don't apply the aligned attribute nedlessly

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

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
compilers

調査の方向性

まず Builder::load と get_aligned 呼び出しを追跡し、次に rustc が整数型、浮動小数点型、ベクター型、複合型について保証されるアラインメントをどのように公開しているかを調べます。バックエンドが、型に保証されたアラインメントと異なる場合にのみアラインメントを出力し、バイトサイズの型や自然にアラインされた構造体については出力を避けるようになれば完了です。

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

説明

enhancement

Currently, we apply the aligned attribute to all integers, regardless of their actual aligement.

This leads to such gems as this:

__int8_t  __attribute__((aligned(1)))

Since a byte-sized type has a size of 1(by definition), it's alignment can be 1 and only 1.

This attribute is thus unneeded, and only leads to increased memory consumption, and more confusing debug strings. It could also inhibit some optimizations(no examples of that yet, but it is not hard to imagine some of them can't deal with under / over aligned types, and ignore types with explicit alignment altogether).

While removing this attribute for byte-sized types is an easy fix, other types pose a bigger challenge.

Ideally, we'd need an API to query GCC about the aligement of intigers / floats / vectors, and then use that API to not emit this attribute when not necessary(eg. a structure composed of floats with aligement 4 is alteady correctly aligned by the virtue of containing floats).

For example, Builder::load could check if the requested align: Align differs from the one already guaranteed for a type(by checking the aligement on the rustc side of things). We could then call get_aligned if and only if this aligement differs, reducing the usage of this attribute(thus reducing memory usage).

主要言語
Rust
スター
1.2k
フォーク
106
平均マージ
6時間 47分
マージ済み PR(30日)
21

環境構築

はじめの一歩

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

rust-lang/rustc_codegen_gcc のほかの issue

rust-lang/rustc_codegen_gcc の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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