ImHex icon indicating copy to clipboard operation
ImHex copied to clipboard

[Bug] Can't evaluate sizeof() of a fixed size structure with pointers.

Open Naheulf opened this issue 4 months ago • 1 comments

Operating System

Windows

What's the issue you encountered?

Almost the same as #2386 but with the [[fixed_size(size)]] Attribute.

How can the issue be reproduced?

struct Test {
    u32 *ptr:u32;
}[[fixed_size(4)]];

std::print("size = {}", sizeof(Test));

ImHex Version

1.37.4

ImHex Build Type

  • [ ] Nightly or built from sources

Installation type

MSI

Additional context?

Just wanted to add an alternate answer to #2386 but found another bug.

Naheulf avatar Aug 08 '25 17:08 Naheulf

And by the way, if I set [[fixed_size(4)]] twice with two different sizes it doesn't complain even if it doesn't makes any sens:

struct Test {
    u32 *ptr:u32;
}[[fixed_size(4), fixed_size(96)]]; //This line should rise an error

Naheulf avatar Aug 08 '25 18:08 Naheulf