https://bugs.kde.org/show_bug.cgi?id=457898

            Bug ID: 457898
           Summary: Assertion 'found' failed. with multiple thread
           Product: valgrind
           Version: 3.19.0
          Platform: Archlinux Packages
                OS: Linux
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: helgrind
          Assignee: jsew...@acm.org
          Reporter: adrien.thie...@gmail.com
  Target Milestone: ---

SUMMARY
Helgrind reports an error in the very simple code below:

STEPS TO REPRODUCE
In any .c file:

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>

void    *routine(void *nop)
{
        usleep(1);
        return (nop);
}

int     main(void)
{
        int                     i;
        int                     max;
        pthread_t       *threads;

        i = 0;
        max = 5;
        threads = malloc(sizeof(*threads) * max);
        while (i < max)
                if (pthread_create((threads + i++), NULL, &routine, NULL))
                        exit (1);
        i = 0;
        while (i < max)
                if (pthread_join(*(threads + i++), NULL))
                        exit (2);
        free(threads);
        return (0);
}



OBSERVED RESULT
==3537== Helgrind, a thread error detector
==3537== Copyright (C) 2007-2017, and GNU GPL'd, by OpenWorks LLP et al.
==3537== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==3537== Command: ./a.out
==3537== 

Helgrind: hg_main.c:5379 (hg_handle_client_request): Assertion 'found' failed.

host stacktrace:
==3537==    at 0x58026BCA: ??? (in /usr/lib/valgrind/helgrind-amd64-linux)
==3537==    by 0x58026CF7: ??? (in /usr/lib/valgrind/helgrind-amd64-linux)
==3537==    by 0x58026E9B: ??? (in /usr/lib/valgrind/helgrind-amd64-linux)
==3537==    by 0x5801014A: ??? (in /usr/lib/valgrind/helgrind-amd64-linux)
==3537==    by 0x5803B454: ??? (in /usr/lib/valgrind/helgrind-amd64-linux)
==3537==    by 0x58082CC7: ??? (in /usr/lib/valgrind/helgrind-amd64-linux)
==3537==    by 0x580C97C0: ??? (in /usr/lib/valgrind/helgrind-amd64-linux)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable (lwpid 3537)
==3537==    at 0x484A943: ??? (in
/usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==3537==    by 0x10924D: main (in /home/adrien/Prog/philosophers/a.out)
client stack range: [0x1FFEFFE000 0x1FFF000FFF] client SP: 0x1FFF000390
valgrind stack range: [0x1002E8E000 0x1002F8DFFF] top usage: 8880 of 1048576


Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.



EXPECTED RESULT
No errors

SOFTWARE/OS VERSIONS
Tested on several systems (Ubuntu20.04 and arch)

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to