Sign in

username:

password:



Not a member?

Search code-comp



Search tips

Subscribe to code-comp



code-comp by Keywords

ARM7 | BIOS | Bug | EVM | JTAG | Linker | LOG_printf | McBSP | Profiling | Relocation | RTDX | Simulator | Target | Watch

Sponsor

NEW! TMS320C6474: 3x the performance. 1/3 the cost. Three 1 GHz cores on 1 chip.

Discussion Groups

Discussion Groups | Code-Composer | Re: [Fwd: Re: Re: Max Number Of Arguments passed to function is t maximum 4?]

Technical discussions about Code Composer Studio.

  

Post a new Thread

Re: [Fwd: Re: Re: Max Number Of Arguments passed to function is t maximum 4?] - Andrew Nesterov - Jun 8 15:45:00 2004




> Date: Mon, 07 Jun 2004 04:06:48 -0500
> From: Jeff Brower <>
>
> Unless optimization is completely off, you simply cannot expect any
> local variable to be stay consistent inside a function.

For practical purposes this might be considered as a correct answer,
but semantically this is incorrect. A local variable, unless explicitly
changed or replaced by another local with a smaller scope, stays constant
until control exits the local scope and in this moment the local variable
gets destroyed.

> I.e. if you
> hold your cursor over a local variable you might see undefined results.

This is the inability of CCS to track a local variable content, which
can be stored either in a register or pushed on the stack. Sad thing.
I would rather consider it as a bug.

Rgds,

Andrew





(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )

RE: Re: [Fwd: Re: Re: Max Number Of Arguments passed to function is t maximum 4?] - Author Unknown - Jun 8 16:51:00 2004

Sorry, Andrew, but Jeff's answer is indeed correct. It seems that you've
never looked at the optimized Assembly that the C compiler produces. With
optimization turned on, local variables get, whenever possible, assigned to
registers whose scope is only as long as the variable is being used. The
register might then be re-assigned to another local variable whose scope was
irrelevant before. So the start and end of the lifetime for local variables
is determined by the context of your code and not by any semantic. This is
what optimization is all about. You can also take the example of a loop
construct in C. Such a construct will most likely be translated into a
no-overhead loop (via RPT or RPTB instructions). The loop counter for such a
loop is located in a dedicated register that always counts down, no matter
if your local loop counter is counting up or down. Debugging optimized code
(especially if the code was also built without flag -mn) does only make
sense if one is aware of the debug limitations of optimized code. CCS might
have some bugs, but this one is definitely not one of them. You simply can't
have your cake and eat it too. Either you want debugable code that runs
semantically correct or you want fast code that will take some shortcuts.

Just my opinion,
Roland
-----Original Message-----
From: Andrew Nesterov [mailto:]
Sent: Dienstag, 8. Juni 2004 17:46
To:
Subject: [code-comp] Re: [Fwd: Re: Re: Max Number Of Arguments passed to
function is t maximum 4?]
> Date: Mon, 07 Jun 2004 04:06:48 -0500
> From: Jeff Brower <>
>
> Unless optimization is completely off, you simply cannot expect any
> local variable to be stay consistent inside a function.

For practical purposes this might be considered as a correct answer, but
semantically this is incorrect. A local variable, unless explicitly changed
or replaced by another local with a smaller scope, stays constant until
control exits the local scope and in this moment the local variable gets
destroyed.

> I.e. if you
> hold your cursor over a local variable you might see undefined
> results.

This is the inability of CCS to track a local variable content, which can be
stored either in a register or pushed on the stack. Sad thing. I would
rather consider it as a bug.

Rgds,

Andrew




(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )