|
From: Dan S. <dan...@go...> - 2012-06-08 14:08:38
|
On 8 June 2012 15:54, Tom Hughes <to...@co...> wrote:
> On 08/06/12 14:51, Dan Shelton wrote:
>>
>> On 31 May 2012 21:27, Tom Hughes <to...@co...> wrote:
>>>
>>> On 31/05/12 19:45, Dan Shelton wrote:
>>>
>>>> This bug report just came through the AT&T AST/ksh93 development list.
>>>> Can someone confirm that this is a bug, please?
>>>
>>>
>>>
>>> Well it's not a bug as such more a limitation of the way that exp-sgcheck
>>> works - there's a reason it's experimental.
>>>
>>> Basically exp-sgcheck assumes that once a pointer has been used to access
>>> one array it will always access the same array until the end of the
>>> current
>>> function.
>>
>>
>> Is it possible to change that so that functions with variable number
>> of arguments like sprintf work as expected?
>
>
> It's nothing to do with having a variable number of arguments, you could get
> exactly the same warning with a fixed number of arguments if you wrote a
> function like this:
>
> void foo(char *a, char *b)
> {
> char *p;
>
> for (p = a; *p; p++)
> {
> ...
> }
>
> for (p = b; *p; p++)
> {
> ...
> }
> }
>
> The problem is the reuse of a variable (p in this example) to access
> different arrays.
It can't get an option to always check the pointer for every access?
> And no, we know of no good solution.
>
> Basically exp-sgcheck was an interesting experiment, but in my experience it
> is not workable for real world programs.
Is there any tool based on valgrind which can do checks on global
arrays and stack variables and is not experimental?
|