This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello everyone,
Target C6678, Compiler 7.4.5
Here's a case where I think the compiler reports a false MISRA 17.6 violation.
Can you confirm ? Or is there something that I'm missing ?
typedef struct { int a; int b; }s_ab; int32* fct(s_ab* alpha) { return &(alpha->b); } s_ab* ab; main { int* adr_b; adr_b = fct(ab); }
Compilation will lead to
(MISRA-C:2004 17.6/R) The address of an object with automatic
storage shall not be assigned to another object that may persist
after the first object has ceased to exist ("alpha")
return &(alpha->b);
Thank you,
Clement
This problem has already been reported. Please see this forum thread. It has not been fixed yet.
Thanks and regards,
-George
George,
I did see SDSCM00045452
but it's for TMS470 Code Generation Tools and ARM Cortex R4 ARM
it needs to be fixed for C6000 too.
Clement