|
From: Crispin F. <val...@fl...> - 2003-11-19 14:00:18
|
I made a simpler test case while having a quick look at this, see the attached file. I couldn't simplify it any more than this. Hope it helps. Crispin On Wed, 2003-11-19 at 12:45, Lee Kindness wrote: > Hi, some further info on this problem (see below), not necessarily a > reply to Dennis. > > Dennis Lubert writes: > > At 17:10 18.11.2003, you wrote: > > >The attached test case results in different output when run under > > >Valgrind (version 2.0 & 1.9.6) compared to when it is run > > >stand-alone. This source makes use of nested functions. > > > > > >The following is output when run normally: > > > > > > % ./hmmlk 1 2 > > > bob is odd > > > bob is NOT even > > > > > >and when run under Valgrind (I've also attached verbose output): > > > > > > % valgrind ./hmmlk 1 2 > > > bob is odd > > > bob is even > > > > I can confirm this for gcc 3.3.1 and valgrind HEAD as well as 1.9.6 ... > > Even the nul skin does produce this behaviour. > > > > A quick look at the generated assembly, looks as if it should work, but > > obiously valgrind is confusing something. I would rather try to fix > > valgrind, than simply not to use nested functions, since the bug might > > affect other function pointer / nested function issues. > > > > gcc produces two symbols. One is sel.1 and the other is sel.3 ... I would > > suspect that valgrind does not get the second symbol right, since it does > > not even seem to pass the right function pointer to find_name ... Another > > curious thing is, if you let the program display the pointers, they seem to > > be the same, with and without valgrind... Its all just a rough guess, since > > I don't know much about the internals, and how gcc handles function pointers... > > > The double nesting is irrelevant; moving both is_even() and is_odd() > to the outer scope doesn't change the behaviour. > > Both "hmmlk" and "hmmlk 0" (which use only is_odd()) work the same > when run normally and when run under valgrind > > The order of definition of is_odd(), is_even() is irrelevant, but the > order of calling is not: I tried changing main() to allow several > calls, in various orders of test() and testw() and it seems that the > second function called is always in error (ie differs under valgrind > and normal running), however often it is called, while the first one > is ok, however often called. > > Thanks, Lee. > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users |