Embedded Coder Bug: Not using return value of code-generated "Prelookup" function
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Gabriel Aaron
le 15 Fév 2024
Modifié(e) : Walter Roberson
le 23 Fév 2024
Hi,
I'm having an issue with some code generated by Embedded Coder. For some reason, my model's main loop calls the prelookup function plook_u32d_linckpag() but does not use the return value.
The function declaration is as follows:
extern uint32_T plook_u32d_linckpag(real_T u, const real_T bp[], uint32_T
maxIndex, uint32_T *prevIndex);
Has anyone seen behavior like this before?
While I'm here, I'm also seeing the model's main loop setting every element of an array to zero right before an if-statement that checks if one of these array elements is nonzero to execute another block of code.
Is this an artifact of optimization? I've tried debugging the Target Language Compiler but I don't think I'm getting anywhere.
0 commentaires
Réponse acceptée
Abhishek Kumar Singh
le 23 Fév 2024
Hi Gabriel,
Regarding the unused return value from the prelookup function, I assume you have already checked the model configuration, ensured the correct model setup, and also tried code generation with the 'Interpolation Using Prelookup' block. The most probable cause seems to be dead code elimination. The optimization process employed by Embedded Coder might have determined that the return value does not affect the program's behavior and thus removed its usage.
As for the issue of array initialization, there could be two reasons: either the Embedded Coder is initializing the array before entering the conditional logic for determinism reasons, or, as you suggested, it is an artifact of optimization. You can check the code generation settings related to initialization and data handling.
Investigating these points may help to pinpoint the problem. Of course, the nuances of each model can shed more light on such issues, making them easier to unravel.
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Deployment, Integration, and Supported Hardware dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!