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,
this is probably a trivial question... The following code:
-----------------------------
#include <stdio.h>
int main(void)
{
long long a[] = {0xffffffffffffffffLL};
unsigned long long b[] = {0xffffffffffffffffULL};
printf("a: %lld, b: %llu\n", a[0], b[0]);
}
-----------------------------
produces: "a: -1, b: 0" with CCS v5 (Linux) using the C64x+ Megamodule Cycle Accurate simulator as contained in "setup_CCS_5.0.0.00090.tar.gz" (same result in CCS v4.1.2). The same results are shown in the "Variables" watch window. Shouldn't the code rather yield "a: -1, b: 18446744073709551615" (see ULL variable range in SPRU187q, page 139)?
Thank you for your support.
Hi,
I couldn't reproduce this issue neither with CCSv4.1.3, 4.2.0 (Windows) or with CCSv5.0.0.00090 (Build 90 for Linux) - all using the C64x Megamodule Cycle Accurate simulator. Check the screen attached.
What do you see in the output of printf()? If you don't see the expected values in the console then I imagine there is something bad with the code itself (not the display).
Also, what do you see in the Memory browser at the location of the variable b?
In the expressions window, can you typecast the type of the variable b by inserting it as (usigned long long*) b?
Regards,
Rafael
Thank you for your replies so far.
It seems to be a bit more complicated: When I start a new CCS project, it works. But I executed the code given above from an existing XDAIS module project where only a main function consisting of the code mentioned was used, with the results posted. But even then, when I switch off the compiler option "generate profile feedback data," it works. However, with a new project and said compiler option activated, it still works.
A screenshot is attached.
Sorry, what is the "expressions window" or where can I find it?
At least I can get it to work now (switching off profile feedback).
Thank you.
This thread keeps switching forums, but right now it does look like the Compiler forum is the right place for it.
Can you please list all the details of the implementation, such as CCS version (4.parts), Code Gen tools, BIOS, and Target Configuration exact simulator name, then do File->Export and export the project to an archive file that you can attach here. Have it setup to build the failing case (profile feedback on).
I think the "expressions window" is another name for the Watch Window. You can put a complex expression in there to see the value.
The use of --gen_profile_info in the XDAIS project is puzzling. You can use cl6x from the command line to get a quick summary on what that option does.
% cl6x -h --gen_profile_info --gen_profile_info Instrument the object code that is generated for a compilation with path profiling information. The compiler will annotate the code that is generated for an application so that, when executed, the application can generate information about which code paths were executed and how often. This profile data can then be used by subsequent compiles to analyze code coverage or call graph information to assist with subsequent development.
Thus, I don't see why this option is being used at all.
Even so, the compiler should generate correct code for this case whether --gen_profile_info is used or not. Please submit the information requested by RandyP so a bug can be filed against the compiler.
Thanks and regards,
-George
Here's what I did to reproduce this issue:
1) Install CCS v5 from file setup_CCS_5.0.0.00090.tar.gz
2) Create a new empty CCS project of type C6000, Executable, Generic C64x+ device (otherwise default settings)
3) Import archive file CCSarch.zip (all files, overwriting project settings); profile feedback should already be activated
4) Debug and note console output and memory content at 'b'
The information you requested is as follows.
Code Composer Studio Version 5.0.0.201010041800
TMS320C6x C/C++ Compiler v7.0.4, Build Number 1KJMO-9D0I7-UARAR-SAW-ZAZG_X_Q_U
DSP/BIOS 5.41.08.30
C64x+ Megamodule Cycle Accurate Simulator, Little Endian
on Debian Lenny Linux 2.6.26-2-686
Please tell me if you can reproduce the issue. Thank you.
Alex,
Thank you for providing your project files, I can reproduce the issue. It seems that the combination of -o0 and --gen_profile_info triggers the bug. If either of these options are removed the results are correct.
I have submitted this as defect # SDSCM00038477 to our compiler team for further review. Feel free to track the status of this bug using the SDOWP link in my signature.