S12Z: __attribute__ ((aligned (4))) has no effect

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S12Z: __attribute__ ((aligned (4))) has no effect

1,323 次查看
pascalbrand
Contributor I

Hello,

Using CodeWarrior for MCU, v10.7, on S12Z target, I am not able to aligned global variables as specified in the documentation:

#pragma cpp1x on
int foo __attribute__ ((aligned (4)));
void main(void) {
    static_assert(__alignof__(foo) == 1, "SHOULD BE WRONG"); /* compilation OK. But it should fail */
    static_assert(__alignof__(foo) == 4, "SHOULD BE OK"); /* compilation failed. But it should be ok? */
}

compiled with

mwccs12lisa.exe alignment.c

results in the compilation error

Compiler:
# File: alignment.c
# --------------------
# 5: static_assert(__alignof__(foo) == 4, "SHOULD BE OK"); /* compilation failed. But it should be ok? */
# Error: ^^^^^^^^^^^^^^
# static assert check 'SHOULD BE OK' failed

What did I miss?

Thanks for your support,
Pascal.

0 项奖励
回复
6 回复数

991 次查看
pascalbrand
Contributor I

Here is a 7zip of my project.

Thanks for your support,

Pascal;

0 项奖励
回复

991 次查看
pascalbrand
Contributor I

Hello ZhangJennie,

Have you been able to reproduce what I am describing?

Do you need extra info?

Thanks for your support,

Pascal.

0 项奖励
回复

991 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Pascal.

Sorry for the late, I was not in office these days.

I tested your project on my side and I reproduced your problem.

I will contact developer for it.

Will keep you informed.

Best Regards,

Jennie Zhang

0 项奖励
回复

991 次查看
pascalbrand
Contributor I

Hello ZhangJennie,

any news?

Thanks,

Pascal.

0 项奖励
回复

991 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Pascal.

I reproduced your problem and escalated this problem to development team.with report number CMPLG-41

I will keep you informed if I get any update there.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

991 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Pascal,

Can you please send me your demo project for your problem?

Thanks.

Best Regards,

Jennie Zhang

0 项奖励
回复