Closed windfanstry closed 1 year ago
OCRunner version: master分支
description: 嵌套结构体时,内部嵌套的结构体的偏移对齐值,不能按照它的尺寸来定义,而是由它的最大的基础变量的尺寸决定的
example: `struct A { int a1; char a2; }; struct B { char b1; struct A b2; };
struct B s1 = {1,{2,3}};`
OCRunner 版本号: xxx
问题描述:
计算结构体内部变量的偏移量时,当遇到structA这种,嵌套结构体时,它的size是8,但它的对齐偏移值应该是4,在structB中b2变量的offset应该是4,这里错误计算为8.
bug 示例代码:
OCRunner version: master分支
description: 嵌套结构体时,内部嵌套的结构体的偏移对齐值,不能按照它的尺寸来定义,而是由它的最大的基础变量的尺寸决定的
example: `struct A { int a1; char a2; }; struct B { char b1; struct A b2; };
struct B s1 = {1,{2,3}};`
OCRunner 版本号: xxx
问题描述:
计算结构体内部变量的偏移量时,当遇到structA这种,嵌套结构体时,它的size是8,但它的对齐偏移值应该是4,在structB中b2变量的offset应该是4,这里错误计算为8.
bug 示例代码: