Re: [Valgrind-users] compat_ioctl cmd does not match even if it shows same value

2020-08-16 Thread Patrick J. LoPresti
On Sat, Aug 15, 2020 at 10:59 AM John Reiser wrote: > > The fact that you write '0xc018786f' here, but '3222829167' in the code, > shows that you are not sufficiently paranoid. First, if the bit pattern is important > then you should write hex. If you insist on decimal, then you should write '32

Re: [Valgrind-users] Building and Installing vlagrind 3.15.0 in an embedded Linux cross-compile environment

2019-10-15 Thread Patrick J. LoPresti
> If I run strings against the valgrind binary, I see the full pathname to > valgrinds library …/output/debug/valgrind/install/lib/valgrind which of > course is not right, it needs to be /lib/valgrind. FWIW, I have had no problem relocating a Valgrind installation tree and then setting the VALGR

Re: [Valgrind-users] Possible helgrind false positive in static global?

2019-03-11 Thread Patrick J. LoPresti
I believe Helgrind does not understand modern GCC implementations of the Meyers Singleton. You will see similar warnings for any non-trivial static object. See e.g. https://stackoverflow.com/q/44698412/ I vaguely recall this was discussed here before and deemed "hard to fix". But I cannot seem to

Re: [Valgrind-users] Extending memcheck's validity bit propagation

2016-11-06 Thread Patrick J. LoPresti
Thank you, John and Phillippe, for your replies. First, to John: Valgrind actually does know that a conditional move is a functional operation and not a conditional branch. So if you can convince your compiler to emit conditional moves, Valgrind will simply "taint" the output instead of emitting

[Valgrind-users] Extending memcheck's validity bit propagation

2016-11-03 Thread Patrick J. LoPresti
Right now, if I have code like this: int a; /* invalid value */ int b = a + 1; /* operation on invalid value */ ...memcheck does not produce a warning for the addition. It just taints b as invalid and only generates a warning if I try to use b in a behavior-changing way. This is good, and it

Re: [Valgrind-users] helgrind, PTHREAD_RWLOCK_INITIALIZER and pthread_rwlock_destroy

2016-10-06 Thread Patrick J. LoPresti
On Thu, Oct 6, 2016 at 8:53 AM, Alex Bligh wrote: > > > > On 6 Oct 2016, at 16:06, Mateusz Jemielity wrote: > > > > The effects are equivalent to pthread_rwlock_init, thus in my opinion they > > require pthread_rwlock_destroy. > > However, I'm not sure why you'd need to call pthread_*_destroy on

Re: [Valgrind-users] Uninitialized access findings on non-static file scope variables that's been initialized?

2015-08-13 Thread Patrick J. LoPresti
On Thu, Aug 13, 2015 at 10:28 AM, Jeffrey Walton wrote: > > And converting the file-scoped globals into locals with accessors > suffers the same problem on the destructor side. Not true. The C++ spec guarantees destructors will run in the opposite order of constructors in most cases. The Meyers S

Re: [Valgrind-users] can't compile valgrind 3.10.0 on SuSE Linux SLES 10SP3 64bit

2014-09-15 Thread Patrick J. LoPresti
On Mon, Sep 15, 2014 at 4:52 PM, Tom Hughes wrote: > > So I think the original diagnosis stands, that the C library is too old to > know about this flag. Fair enough. In which case Valgrind's conditional should perhaps be on __GLIBC__ / __GLIBC_MINOR__ rather than VGA_s390x? I can confirm PTRACE

Re: [Valgrind-users] can't compile valgrind 3.10.0 on SuSE Linux SLES 10SP3 64bit

2014-09-15 Thread Patrick J. LoPresti
PTRACE_GETSIGINFO definitely exists on SLES10 SP3 64-bit: suse10$ cat /etc/issue Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l). suse10$ find /usr/include -type f | xargs grep PTRACE_GETSIGINFO /usr/include/linux/ptrace.h:#define PTRACE_GETSIGINFO 0x4202 sus

Re: [Valgrind-users] helgrind and threadsafe-statics

2014-06-09 Thread Patrick J. LoPresti
On Mon, Jun 9, 2014 at 12:53 AM, Bart Van Assche wrote: > > I think g++ will have to be modified to allow Helgrind and DRD to > recognize thread-safe statics on architectures that do not have relaxed > memory consistency. From the gcc source file gcc/cp/decl.c I derived > that on architectures wit

Re: [Valgrind-users] valgrind breaks any long double operation on x86-64

2014-01-22 Thread Patrick J. LoPresti
On Wed, Jan 22, 2014 at 1:36 PM, Philippe Waroquiers wrote: > > The gcc documentation says for -mfpmath=sse: > > The resulting code should be considerably faster in the majority of > cases and avoid the numerical instability problems of 387 code, but > may break some existing code that expec

Re: [Valgrind-users] valgrind with shell scripts

2014-01-14 Thread Patrick J. LoPresti
On Tue, Jan 14, 2014 at 7:18 AM, Samuel Quiring wrote: > > Will valgrind evaluate the shell script or my app or both? The script, and as others have said, "--trace-children=yes" will do what you want. However... ...you can also change your script to "exec" your app. That is better style anyway (

Re: [Valgrind-users] DESPERATE: Receiving confusing warnings during very short execution phase

2013-08-16 Thread Patrick J. LoPresti
On Fri, Aug 16, 2013 at 8:33 AM, cleca wrote: > == PASTE of parts of the complaints == > Invalid read of size 8 > ==19525==at 0x6E6E2CA: ??? (in > /home/cap/workspace/kademlia2/libs/libc.so.6) You will get better backtraces if you install the "glibc-debuginfo" package. (Assuming you are us

Re: [Valgrind-users] Core dump trying to run my application under valgrind

2013-05-13 Thread Patrick J. LoPresti
On Mon, May 13, 2013 at 6:46 AM, Gonzalo wrote: > ==8527== Process terminating with default action of signal 11 (SIGSEGV) > ==8527== Access not within mapped region at address 0xBEF3EDA4 > ==8527==at 0x8091CD0: WriteFiasco(std::string const&) (fiasco_finder.h:28) > ==8527==by 0x43F810D:

Re: [Valgrind-users] "Potentially" lost memory

2013-03-14 Thread Patrick J. LoPresti
On Thu, Mar 14, 2013 at 1:58 PM, Philippe Waroquiers wrote: > On Thu, 2013-03-14 at 19:21 +, Phil Longstaff wrote: >> How hard would it be for memcheck to not report a block as being >> potentially lost if the internal pointer could be a pointer to a base >> class? Is there sufficient info in

Re: [Valgrind-users] Execution of a dirty helper: atomic?

2012-12-31 Thread Patrick J. LoPresti
On Mon, Dec 31, 2012 at 4:48 AM, Philippe Waroquiers wrote: > > It is even not ok to use an atomic instruction : first tests have > shown that having one atomic instruction on this path makes a > multi-threaded Valgrind slower than a serialised Valgrind. You mean a multi-threaded Valgrind is slow

Re: [Valgrind-users] helgrind/drd annotations for one statement

2012-12-05 Thread Patrick J. LoPresti
On Wed, Dec 5, 2012 at 10:29 AM, Leif Walsh wrote: > Here are the threads I have: > > { > pthread_rwlock_rdlock(); > x = 1; > pthread_rwlock_rdunlock(); > } > > { > pthread_rwlock_wrlock(); > if (x) { > x = 0; > } else { > foo(); > } > pthread_rwlock_wrunlock(); > } I am g

Re: [Valgrind-users] helgrind/drd annotations for one statement

2012-12-04 Thread Patrick J. LoPresti
On Tue, Dec 4, 2012 at 7:24 AM, Leif Walsh wrote: > > I'm ashamed to say I don't quite understand The first step to enlightenment > what can fail here but I'm not worried until I start supporting such > architectures. Thanks for the warning though. It is not only about future architectures; it

Re: [Valgrind-users] closing bracket of destructor

2012-10-02 Thread Patrick J. LoPresti
On Tue, Oct 2, 2012 at 9:16 AM, John Reiser wrote: > > Not necessarily. Yes, necessarily. > In *your* favorite "modern" CPU, a transfer of control > to a non-local destination can cost 15 times as much as a local test-and- > skip-over, depending on branch prediction and Icache misses. True but

Re: [Valgrind-users] closing bracket of destructor

2012-10-02 Thread Patrick J. LoPresti
On Tue, Oct 2, 2012 at 5:55 AM, jody wrote: > > > - > void CellGrid::destroyGrid() { > > if (m_apCells != NULL) { > for (coord j = 0; j < m_iNumCells; j++) { > if (m_apCells[j] != NULL) { > delete m_apCells[j]; >

Re: [Valgrind-users] helgrind and atomic operations

2012-08-27 Thread Patrick J. LoPresti
On Sun, Aug 26, 2012 at 2:06 AM, David Faure wrote: > > Marc Mutz said " > The standard says it's racy, but the implementation of > std::atomic::load(memory_order_acquire) won't look different. Simple reads > and writes on x86 are already sequentially consistent. I do not think this is true. Loa

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-13 Thread Patrick J. LoPresti
On Mon, Aug 13, 2012 at 8:54 AM, John Reiser wrote: > > In the case at hand, we are interested in string operations, not floating > point. > Suppose that stpncpy contributes 0.25% (1/400) of the normal running time. > Then > instruction-by-instruction emulation of stpncpy by memcheck is about 20

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-13 Thread Patrick J. LoPresti
On Mon, Aug 13, 2012 at 1:07 AM, Julian Seward wrote: > > I lose track of what is actually required. Is it to implement, for > vector loads, the same thing that you did for scalar loads? That is, > don't complain about naturally aligned word size loads that partially > overlap the end of a bloc

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Patrick J. LoPresti
On Sun, Aug 12, 2012 at 7:10 PM, John Reiser wrote: > On 08/12/2012 06:44 PM, Patrick J. LoPresti wrote: > > > Or, you know, we could instead spend effort fixing Valgrind's machine > emulator to match the memory model of real machines. > > Your idea of "real m

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Patrick J. LoPresti
On Sun, Aug 12, 2012 at 1:44 PM, John Reiser wrote: > > memcheck implements intercepting re-directs for both strcpy and strncpy. > The re-directs remove the possibility of any false positive complaints, > and also are significantly faster than emulating instructions. > Therefore, I suggest that t

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Patrick J. LoPresti
On Sun, Aug 12, 2012 at 11:03 AM, Philippe Waroquiers < philippe.waroqui...@skynet.be> wrote: > On Sun, 2012-08-12 at 19:15 +0200, Francis Giraldeau wrote: > > > The best is to file a bug on bugzilla, > with the test program to reproduce the false positive > and additional details such as gcc vers

Re: [Valgrind-users] Line number of source file for shared library now shown

2012-07-27 Thread Patrick J. LoPresti
On Fri, Jul 27, 2012 at 8:13 AM, Florian Krohm wrote: > > The shared lib has no debug info. That's why you don't get a file name > and line number. If math.so is your own shared object read this: > http://valgrind.org/docs/manual/faq.html#faq.unhelpful > > If it is a system lib you need to instal

Re: [Valgrind-users] posix_memalign on Mac results in an apparent leak

2012-07-26 Thread Patrick J. LoPresti
On Thu, Jul 26, 2012 at 11:12 AM, Sean McBride wrote: > > I think it's definitely worth a bug report. If nothing else, the man page > should discuss whether a zero size is undefined behaviour or not. The POSIX spec makes it pretty clear that this is not undefined behavior: http://pubs.opengrou

Re: [Valgrind-users] Strange warning for invalid read of size 8 in memcpy

2012-07-12 Thread Patrick J. LoPresti
On Wed, Jul 11, 2012 at 10:13 PM, Tanmay Mohapatra wrote: > Thanks Pat. > Here's the output of "otool -v -t check" > Is this what is required? > Do let me know if I need to disassemble in some other way. Looks like the offending code is in a shared library (?) Maybe try "gdb ./check", and then "

Re: [Valgrind-users] Strange warning for invalid read of size 8 in memcpy

2012-07-10 Thread Patrick J. LoPresti
On Sun, Jul 8, 2012 at 11:00 PM, John Reiser wrote: > In particular, there is a long and convoluted > history of "word at a time" idioms (instead of simple "character at a time" > code) for computing strlen() and strchr(). Also memcpy(), memcmp(), etc. To elaborate a bit: An aligned load cannot

Re: [Valgrind-users] Strange warning for invalid read of size 8 in memcpy

2012-07-10 Thread Patrick J. LoPresti
On Sat, Jul 7, 2012 at 9:58 PM, Tanmay Mohapatra wrote: > Thanks John and Pat. > > So what I understand is I can ignore the warning in this case. > But, I still get the warning even with --partial-loads-ok=yes. Why so? Because this is an SSE-optimized routine. The evidence is here: > ==67529==

Re: [Valgrind-users] Strange warning for invalid read of size 8 in memcpy

2012-07-06 Thread Patrick J. LoPresti
On Fri, Jul 6, 2012 at 11:45 AM, John Reiser wrote: > > The compiler has decided to generate inline code for memcpy. > This is hard for memcheck to recognize as memcpy. But memcheck does not have to recognize it at all if you use "--partial-loads-ok=yes". The problem is that the default memory m

Re: [Valgrind-users] gcc -O2 problem SSE optimization?

2012-06-14 Thread Patrick J. LoPresti
On Thu, Jun 14, 2012 at 1:10 PM, Kevyn-Alexandre Paré wrote: > > valgrind --leak-check=full --partial-loads-ok=yes ./test > > Adding the flag didn't  remove the error? Are you _sure_ it is exactly the same error? Your original report said this was the error: ==21719== Invalid read of size 4 ==2

Re: [Valgrind-users] --partial-loads-ok and aligned SSE loads

2012-02-20 Thread Patrick J. LoPresti
John Reiser writes: > It seems to me that there may be at least one set of cases where > the memcheck complaint might be correct, namely if there is no '\0' > in an allocated block whose length is not a multiple of 16. If there is no `\0` in your string and you call strlen(), I agree we need to i

[Valgrind-users] --partial-loads-ok and aligned SSE loads

2012-02-17 Thread Patrick J. LoPresti
Hello again, Valgrind community. I have filed the following bug report: https://bugs.kde.org/show_bug.cgi?id=294285 (By the way, "3.8.0SVN" is not presently an option for the "Version" drop-down when filing a bug.) Background: I am using Valgrind on optimized SSE4.2 output from the Intel C Comp

[Valgrind-users] "retq" is an unhandled instruction?

2012-02-15 Thread Patrick J. LoPresti
Hello. I downloaded the development version of valgrind from Subversion today. It configured and built fine, but while trying to run it on my application, I got this error during the run: vex amd64->IR: unhandled instruction bytes: 0xC2 0x0 0x0 0x66 0x66 0x66 0x90 0x66 ==10739== valgrind: Unreco