From: Pavel S. <pav...@gm...> - 2011-10-31 18:48:16
|
Thanks, Gabriel! After implementing your suggestions, the patch looks much more concise. Attached. Using simplification of structs with --no-convert-field offsets yeilds an assertion failure ("Cannot find component .foo of bar"). Could it be the result of contradiction between splitting structures and attempts to keep the structural information instead of relying to a low-level memory model? Assume that the code (the original or an "intermediate" version) looks like this. struct A {int x; int y;}; struct B {struct A a;}; int some_function(struct A *ptr) { return ptr->y; } int main() { struct B b; some_function(&b.a); } I do not really understand the intent of split structus, but could it, under some circumstances, result in something like this: in main() { int x_in_a, y_in_a; some_function(&x_in_a); } The converted some_function then won't have any access to y_in_a, because all expressions like ((*int)(&x_in_a) + 4) should not appear in the generated code, and there's no other way to reach y_in_a in the fixed code. If such situation may appear with split structures, then splitting structures should be suppressed when using --no-convert-field- offsets, like it is in the patch. However, I do not really understand in what cases splitting structures happens. Is the situation like the one above feasible? -- Pavel Shved website: http://coldattic.info/ e-mail: pav...@gm... |