Conditional Parsing values not being added to size #1503
-
Hi, I have an array of values, of a type where they have conditional members. Unfortunately, the size seems to be computed only from the static properties. Is there a way around this? In the example above |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
I think it may be because its a conditional union |
Beta Was this translation helpful? Give feedback.
-
Yeah, condition union was the issue. I was able to resolve it by making it a struct then offsetting my other structs with |
Beta Was this translation helpful? Give feedback.
-
From what you posted the unions are the members, but the collection is a structure. the size of the union is the size of the largest element in the union. If the collection is part of the first union, then the size of the union should be 0xD and not 2. I have tested that with a simple example and it works. struct test {
u32 array[5];
};
union test2 {
u8 a;
u8 b;
test t;
};
test2 t2 @0; |
Beta Was this translation helpful? Give feedback.
-
I see. You marked your response as a solution but it just a work around and the bug needs to be fixed because unions should also calculate their sizes correctly. In order to narrow down the possible places where the bug is located you may want to mention unions in the title. |
Beta Was this translation helpful? Give feedback.
Yeah, condition union was the issue. I was able to resolve it by making it a struct then offsetting my other structs with
$ -= 0x02;