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.

Appearance of nondeclared variable



Hello all,

I used the function "floor" and was surprised with the appearance
of nondeclared variable "y" in MSM memory.
Breakpoint after function "floor" allows to look this variable
in bookmark "Variables" such as:
y double 1.258603404736656e+303 0x0C3FFFE8

Please look complete program in the attachment.
Compiler's settings:
Debug [Active]
C6000 Compiler -> Optimization -> Optimization level -> 2
C6000 Compiler -> Advanced Optimization -> Optimize for speed -> 2

Please answer on two questions
- why did this variable appeare ?
- what necessary to do to avoid appearance of this nondeclared variable?

Best regards,
Stanislaw

program.zip

  • This may be a hiccup in the debugging information; I doubt it would affect the correctness of the program.

    If you look at the source code for the implementation of floor.c, you'll see that there is a variable y used during computation.  However, this shouldn't show up at the call site.  

    1. Exactly when during program execution are you able to see the variable y?  
    2. Are you stepping into the function floor itself?  
    3. Which version of CCS are you using?

  • Thank you for your quick reply.

    > This may be a hiccup in the debugging information;
    > I doubt it would affect the correctness of the program.

    Earlier I worked with another program that used function "floor"
    in both the Core0 and Core1.
    All variables were declared in L2 with the derective #pragma.
    So the both Cores did not have commom variables declared myself.
    Though, sometimes I got incorrect results.
    Unfortunately I can not find that program and therefore I can not argue
    that result.
    But it seems as one core affect on other core with an obscure manner.
    I suspected that this influence performed over this "common" variable "y",
    populated by the compiler in shared memory as a global variable.

    >If you look at the source code for the implementation of floor.c,
    > you'll see that there is a variable y used during computation.

    Variable within a function should to be a local variable,
    but as I thought "y" was shown as a global variable.

    > However, this shouldn't show up at the call site.

    Why it was shown?

    >Exactly when during program execution are you able to see the variable y?

    As I wrote, I did not use variable "y" in my sourse code.
    After loading the program I looked "y"
    in the bookmark "Variables" such as:
                  y unknown Error: Memory map prevented reading of target memory at 0x0C400000
    After breakpoint at the line 127 (i.e. after calling the function "floor"),
    I looked "y" in the bookmark "Variables" such as:
                   y double 3.0 0x0C3FFFF0

    Now I send simplified version of the test program for Core0 only.
    Please look it in the attachment.

    >Are you stepping into the function floor itself?

    I was stepping into assembler code of the
    _c6xabi_fixdu
    Unfortunately Debugger did not show the C code of function "floor"
    (No sourse avaiable for "_c6xabi_fixdu...) and I did not know
    how to include it into the debug's window.
    So I did not find the answer on my question there.

    >Which version of CCS are you using?

    I used:
    Code Composer Studio 5.2.1.00018
    Compiler 7.4.7
    mcsdk_2_01_02_06
    pdk_C6678_1_1_2_6
    MDSEVM6678L board


    The main question:
    - what necessary to do to avoid appearance of this nondeclared variable?

    Best regards,
    Stanislaw

    program_Core0.zip

  • There is no global variable named y in your program.  I suspect this ...

    Stanislaw Kowal said:
    After loading the program I looked "y"
    in the bookmark "Variables" such as:
                  y unknown Error: Memory map prevented reading of target memory at 0x0C400000
    After breakpoint at the line 127 (i.e. after calling the function "floor"),
    I looked "y" in the bookmark "Variables" such as:
                   y double 3.0 0x0C3FFFF0

    ... is due to some bug in CCS related to displaying local variables in a function that recently ended execution.  I recommend you start a new thread on this topic in the CCS forum.  Or, if you prefer, I can move this thread into that forum.  I'm sure they will need you to send in a CCS project which allows them to reproduce the problem.

    Thanks and regards,

    -George

  • George,

    thank you for your reply.

    >There is no global variable named y in your program. I suspect this ...
    >... is due to some bug in CCS related to displaying local variables in a function that recently ended >execution.

    This variable was displayed not only in a function that recently ended execution,
    but just after loading the program.

    Please move this thread into CCS forum.

    Best regards,
    Stanislaw
  • Hello all

    anybody in this forum can answer me?

    Best regards,

    Stanislaw