Bug 49613 - Error with OpenMP / gomp and gcc detected by valgrind
Summary: Error with OpenMP / gomp and gcc detected by valgrind
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libgomp (show other bugs)
Version: 4.5.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2011-07-02 11:37 UTC by Clemens09
Modified: 2011-07-02 11:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Code, makefile and result log. (2.35 KB, application/zip)
2011-07-02 11:37 UTC, Clemens09
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Clemens09 2011-07-02 11:37:52 UTC
Created attachment 24658 [details]
Code, makefile and result log.

Hey,
I've got a error when compiling

#include <stdio.h>


int main()

{
int i,max=100;

double r[max];



#pragma omp parallel private(i) shared(r)

{

#pragma omp for schedule(static,2) nowait

for(i=0;i<max;i++)

	r[i]=i*max;

}
return 1;

}

with

gcc -O0 -g -Wall -Wextra -pedantic -std=c99 -fopenmp -o test test.c

The .c file, makefile and a logfile is included in this report. Running valgrind I get the following output

valgrind --leak-check=full --show-reachable=yes --track-origins=yes ./test

==2078== Memcheck, a memory error detector
==2078== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==2078== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==2078== Command: ./test
==2078== 
==2078== 
==2078== HEAP SUMMARY:
==2078==     in use at exit: 1,756 bytes in 4 blocks
==2078==   total heap usage: 4 allocs, 0 frees, 1,756 bytes allocated
==2078== 
==2078== 12 bytes in 1 blocks are still reachable in loss record 1 of 4
==2078==    at 0x4025BD3: malloc (vg_replace_malloc.c:236)
==2078==    by 0x4025C5D: realloc (vg_replace_malloc.c:525)
==2078==    by 0x406AC58: gomp_realloc (alloc.c:54)
==2078==    by 0x40707CB: gomp_team_start (team.c:360)
==2078==    by 0x406F29D: GOMP_parallel_start (parallel.c:108)
==2078==    by 0x804857C: main (test.c:9)
==2078== 
==2078== 144 bytes in 1 blocks are possibly lost in loss record 2 of 4
==2078==    at 0x4024F12: calloc (vg_replace_malloc.c:467)
==2078==    by 0x40117CB: _dl_allocate_tls (dl-tls.c:300)
==2078==    by 0x407A6A9: pthread_create@@GLIBC_2.1 (allocatestack.c:570)
==2078==    by 0x40705DB: gomp_team_start (team.c:422)
==2078==    by 0x406F29D: GOMP_parallel_start (parallel.c:108)
==2078==    by 0x804857C: main (test.c:9)
==2078== 
==2078== 192 bytes in 1 blocks are still reachable in loss record 3 of 4
==2078==    at 0x4025BD3: malloc (vg_replace_malloc.c:236)
==2078==    by 0x406ABB1: gomp_malloc (alloc.c:36)
==2078==    by 0x407080E: gomp_team_start (team.c:191)
==2078==    by 0x406F29D: GOMP_parallel_start (parallel.c:108)
==2078==    by 0x804857C: main (test.c:9)
==2078== 
==2078== 1,408 bytes in 1 blocks are still reachable in loss record 4 of 4
==2078==    at 0x4025BD3: malloc (vg_replace_malloc.c:236)
==2078==    by 0x406ABB1: gomp_malloc (alloc.c:36)
==2078==    by 0x40702D8: gomp_new_team (team.c:144)
==2078==    by 0x406F283: GOMP_parallel_start (parallel.c:108)
==2078==    by 0x804857C: main (test.c:9)
==2078== 
==2078== LEAK SUMMARY:
==2078==    definitely lost: 0 bytes in 0 blocks
==2078==    indirectly lost: 0 bytes in 0 blocks
==2078==      possibly lost: 144 bytes in 1 blocks
==2078==    still reachable: 1,612 bytes in 3 blocks
==2078==         suppressed: 0 bytes in 0 blocks
==2078== 
==2078== For counts of detected and suppressed errors, rerun with: -v
==2078== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 21 from 8)

I've tested this also on an Intel CPU and get the same result.
Comment 1 Jakub Jelinek 2011-07-02 11:56:44 UTC
These aren't errors of any kind.