Skip to content

Conversation

@mattst88
Copy link

Two commits. I'm on Linux, so I'm unable to test the Windows-only changes. Hopefully CI will handle that.


Add and use packed_luid() function

Nearly all of the open-coded implementations were wrong in multiple ways:

  • shifting by 31 instead of 32
  • shifting a 32-bit value (the HighPart) without first casting to a 64-bit type
  • shifting into the sign bit (undefined behavior)

Use packed_luid() to avoid aliasing violation

This solves the compile error when building with -Werror=strict-aliasing.

/home/mattst88/projects/gfxreconstruct/framework/encode/parameter_encoder.h: In member function ‘void gfxrecon::encode::ParameterEncoder::EncodeLUIDValue(LUID)’:
/home/mattst88/projects/gfxreconstruct/framework/encode/parameter_encoder.h:80:53: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   80 |     void EncodeLUIDValue(LUID value) { EncodeValue(*reinterpret_cast<int64_t*>(&value)); }
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Closes: #2358


cc: @igorbrsn, @JerryAMD, @rurra-amd because they all introduced instances of << 31
cc: @jzulauf-lunarg because he introduced the aliasing violation and then dutifully ignored issue #2358

@mattst88 mattst88 requested a review from a team as a code owner December 14, 2025 22:26
@ci-tester-lunarg
Copy link
Collaborator

Author mattst88 not on autobuild list. Waiting for curator authorization before starting CI build.

@mattst88 mattst88 force-pushed the fix-packed-luid-conversions branch from 96c61af to fdef2c9 Compare December 15, 2025 00:18
@ci-tester-lunarg
Copy link
Collaborator

Author mattst88 not on autobuild list. Waiting for curator authorization before starting CI build.

@mattst88 mattst88 force-pushed the fix-packed-luid-conversions branch from fdef2c9 to cfc1b25 Compare December 15, 2025 01:23
@ci-tester-lunarg
Copy link
Collaborator

Author mattst88 not on autobuild list. Waiting for curator authorization before starting CI build.

@mattst88 mattst88 force-pushed the fix-packed-luid-conversions branch from cfc1b25 to 7fcf44a Compare December 15, 2025 02:55
@ci-tester-lunarg
Copy link
Collaborator

Author mattst88 not on autobuild list. Waiting for curator authorization before starting CI build.

@lunarpapillo
Copy link
Contributor

The code looks clean to me. I'm starting a CI build in order to see the impacts on Windows, which the author is unable to test.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 601414.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8350 running.

@lunarpapillo
Copy link
Contributor

Fails to build on Wndows. A typical cmake invocation is attached.

006-cmake-stdout.txt

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8350 failed.

@bradgrantham-lunarg
Copy link
Contributor

Fails to build on Wndows. A typical cmake invocation is attached.

006-cmake-stdout.txt

@lunarpapillo The GitHub CI build also builds on Windows and I've enabled several times and the author has been able to provide several rounds of attempts to pass CI through branch pushes. There's no need to tie up internal Jenkins CI results until the GH CI runs succeed.

@mattst88 mattst88 force-pushed the fix-packed-luid-conversions branch from 7fcf44a to 68b2cad Compare December 15, 2025 14:31
@ci-tester-lunarg
Copy link
Collaborator

Author mattst88 not on autobuild list. Waiting for curator authorization before starting CI build.

@mattst88
Copy link
Author

Could use another CI workflow approval. Hopefully this is the last time ;)

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 603508.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8369 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8369 failed.

@bradgrantham-lunarg
Copy link
Contributor

Hi, @mattst88 ! I really appreciate this PR and I want to merge it but Our GitHub CI resources are not infinite. I don't think I want to authorize more runs until you can resolve the Windows compilation issue. Can you find or borrow a Windows machine to resolve the Windows build? Thank you!

@mattst88 mattst88 force-pushed the fix-packed-luid-conversions branch from 68b2cad to 8b1b910 Compare December 17, 2025 01:13
@ci-tester-lunarg
Copy link
Collaborator

Author mattst88 not on autobuild list. Waiting for curator authorization before starting CI build.

@mattst88
Copy link
Author

Hi, @mattst88 ! I really appreciate this PR and I want to merge it but Our GitHub CI resources are not infinite. I don't think I want to authorize more runs until you can resolve the Windows compilation issue. Can you find or borrow a Windows machine to resolve the Windows build? Thank you!

Sorry. I'm not interested or invested enough to spend the time getting a Windows development environment going so I can fix this.

It's just something I noticed and figured wouldn't be too difficult to fix, but if it's too expensive to run the CI a few times and no one who actually works on the project can spare the time to figure out what #include needs to be changed, then I guess I can just leave it here.

@mattst88
Copy link
Author

I will drop the patch that touches Windows-only code and leaves it obviously broken, since it's not worth the CI costs to fix.

This solves the compile error when building with
`-Werror=strict-aliasing`.

```
/home/mattst88/projects/gfxreconstruct/framework/encode/parameter_encoder.h: In member function ‘void gfxrecon::encode::ParameterEncoder::EncodeLUIDValue(LUID)’:
/home/mattst88/projects/gfxreconstruct/framework/encode/parameter_encoder.h:80:53: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   80 |     void EncodeLUIDValue(LUID value) { EncodeValue(*reinterpret_cast<int64_t*>(&value)); }
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Closes: LunarG#2358
@mattst88 mattst88 force-pushed the fix-packed-luid-conversions branch from 8b1b910 to 9e55017 Compare December 17, 2025 01:40
@ci-tester-lunarg
Copy link
Collaborator

Author mattst88 not on autobuild list. Waiting for curator authorization before starting CI build.

@mattst88
Copy link
Author

This is ready for a final CI run.

@mattst88
Copy link
Author

@bradgrantham-lunarg: ping?

@mattst88
Copy link
Author

mattst88 commented Jan 3, 2026

@bradgrantham-lunarg: ping²?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails with strict-aliasing violations

4 participants