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.
Tool/software: Code Composer Studio
We are using TMS570LS3137 in our project and software development using CCS ( Version: 6.0.1.00040 ). We are analyzing all the erratas belongs to it. We happened to observe TI compiler errata "ARM floating point conversion routines do not support NaN".
we are not sure the impact of this errata and we are curious to know about it. when we try to simulate the NaN condition by following code and x has been assigned NaN. is this related to compiler errata?
Pseudo code:
float x;
x = 0.0f/0.0f;
Subash Sundaresan said:is this related to compiler errata?
No.
When a value is converted from type float to type double, functions in the RTS library are called to perform that task. The problem was that those functions would incorrectly change a NaN to infinity. In your pseudo code, no conversions are needed, so the problem does not occur. This problem has been fixed since compiler version 5.2.6, which was released October 2015.
Thanks and regards,
-George
Hi George,
Thank you so much for your response.
We tried to reproduce the issue as per your inputs (by float to double conversion), however we failed to do so. Could you please let us know how to simulate the problem (provide some code snippet).
Pseudo code 1:
double y;
y = 0.0f / 0.0
In debug window:
y = NaN
Memory browser:
0x08001330 7FF80000
Pseudo code 2:
float x;
double y;
x = 0.0f / 0.0f
y = (double) x;
In debug window:
x = NaN
y = NaN
Memory browser:
(x) 0x08001328 7FC00000
(y) 0x08001330 7FF80000
Note: Note that different numeric memory representation for NaN for x and y;
We have chosen Compiler version as 5.1.6 in the project plan , hence we can't change the compiler version intermediately. As per your inputs, the issue would be applicable for this compiler version (5.1.6), we would like to incorporate only updated CRTL library function instead of adapting different compiler version. could you please let us know where we can get updated CRTL library function.
Thanks,
Subash
0/0 is undefined and the compiler can return anything it wants, either NaN or infinity. You are free to check for 0/0 and supply whatever answer you think appropriate.
You are describing CODEGEN-831, also known as SDSCM00049912. Here is a test case demonstrating the incorrect behavior:
/* armcl --abi=eabi CQ49912.c -z -llnk.cmd */
#include <stdio.h>
#include <math.h>
#include <assert.h>
int main()
{
volatile float y = NAN;
assert(isnan((double)y));
}
Still I unable to reproduce the issue,
I have tested following scenarios, nevertheless both yield same results, in other words in both scenarios program control jumps to next instruction which is x= x + 1;
/* Scenario -1 */
/* armcl --abi=eabi CQ49912.c -z -llnk.cmd */
#include <stdio.h>
#include <math.h>
#include <assert.h>
int main()
{
volatile float y = NAN;
int x ;
assert(isnan((double)y));
x = x + 1;
}
/* Scenario -2 */
/* armcl --abi=eabi CQ49912.c -z -llnk.cmd */
#include <stdio.h>
#include <math.h>
#include <assert.h>
int main()
{
volatile double y = NAN;
int x ;
assert(isnan(y));
x = x + 1;
}
PS: we would want to incorporate updated compiler CRTL function in our old compiler version which is 5.1.6. Could you please provide us latest compiler CRTL library.
This bug is present in TI ARM compiler versions 5.2.0 through 5.2.5. You use version 5.1.6, which does not have this bug. I'm sorry I didn't notice this detail earlier.
Thanks and regards,
-George