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.
Hello ZhangJennie,
Have you been able to reproduce what I am describing?
Do you need extra info?
Thanks for your support,
Pascal.
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
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!
-----------------------------------------------------------------------------------------------------------------------
Hello Pascal,
Can you please send me your demo project for your problem?
Thanks.
Best Regards,
Jennie Zhang