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

structs of structs don't seem to work

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

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

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

評価

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

調査の方向性

まず、報告されている OSL 1.13.12.0.2 環境で、示されている StructA と StructB の初期化ケースを再現します。報告者は osltoy を使用していると述べていますが、issue 2035 によって阻まれています。一時変数のケースで引き続きゼロが生成されるかを確認し、修正を定義する前に、関連するコンパイラまたはコード生成の経路を特定してください。

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

説明

Describe the bug

Adding a struct to a struct seems to result in undefined initialization behavior.

OSL version and dependencies

  • OSL branch/version: 1.13.12.0.2
  • OS: Rocky Linux release 9.4
  • C++ compiler: clang-15.0.7.3
  • LLVM version: llvm-15.0.7.1
  • OIIO version: OpenImageIO-2.4.13.0.4
  • Qt version: Qt-5.15.3.8

To Reproduce

Steps to reproduce the behavior:

Given the following structs:

struct StructA
{
  float cellRand;
  point minDist;
  point closest;
  point secondClosest;
  float edgeDist;
};

struct StructB
{
  StructA result;
  int level;
  float scale;
};

and given a shading function with signature:

StructA somefunction();

If you try and initialize using:

StructB value = StructB(somefunction(), 0, 1.0);

all the attributes are correctly set in the various structs, but if, instead, you do:

StructA temp = somefunction();
StructB value = StructB(temp, 0, 1.0);

then value is incorrect, and the result member is filled with zeroes.

Evidence

It'd be great for someone else to confirm they can reproduce this behavior, thanks!

主要言語
C++
スター
2.3k
フォーク
414
平均マージ
2日 14時間
マージ済み PR(30日)
13

環境構築

はじめの一歩

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

AcademySoftwareFoundation/OpenShadingLanguage のほかの issue

AcademySoftwareFoundation/OpenShadingLanguage の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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