簡體   English   中英

OpenMP未初始化的值和Valgrind

[英]OpenMP Uninitialized values and Valgrind

我在使用Valgrind檢查內存泄漏時遇到了一些問題(並且還了解了我在fprintf中遇到的段錯誤),但是似乎有些原因使用了一些未初始化的值,這些值不是我的代碼產生的。 我是調試器調試的新手,所以我可能會缺少一些東西。

我知道Valgrind是不是舒適與我的默認GCC的OpenMP( http://valgrind.org/docs/manual/drd-manual.html#drd-manual.openmp ),但我使用它,compilimg我的代碼以-pedantic -Wall -static -O0 -g -fopenmp我沒有錯誤。

但是,在運行Valgrind時,

valgrind --leak-check=full --track-origins=yes --error-limit=no --log-file=./logfile ~/developing/trunk/gop.exe

我在日志文件中收到很多警告,從

==5944== Memcheck, a memory error detector
==5944== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==5944== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==5944== Command: /home/henrique/developing/trunk/gop.exe
==5944== Parent PID: 11534
==5944== 
==5944== Syscall param set_robust_list(head) points to uninitialised byte(s)
==5944==    at 0x4983DF: __pthread_initialize_minimal (nptl-init.c:369)
==5944==    by 0x498920: (below main) (libc-start.c:146)
==5944==  Address 0x4000bf0 is not stack'd, malloc'd or (recently) free'd
==5944==  Uninitialised value was created
==5944==    at 0x513A6A: brk (brk.c:32)
==5944==    by 0x4ED4EB: sbrk (sbrk.c:54)
==5944==    by 0x498C13: __libc_setup_tls (libc-tls.c:150)
==5944==    by 0x498366: __pthread_initialize_minimal (nptl-init.c:296)
==5944==    by 0x498920: (below main) (libc-start.c:146)

然后收到與以下警告類似的大量警告(數千!)

==5944== Conditional jump or move depends on uninitialised value(s)
==5944==    at 0x4EF546: __linkin_atfork (register-atfork.c:119)
==5944==    by 0x4BA5D3: ptmalloc_init (arena.c:388)
==5944==    by 0x4BB283: malloc_hook_ini (hooks.c:32)
==5944==    by 0x51842B: _dl_init_paths (dl-load.c:732)
==5944==    by 0x4F097A: _dl_non_dynamic_init (dl-support.c:268)
==5944==    by 0x4F1352: __libc_init_first (init-first.c:83)
==5944==    by 0x49895B: (below main) (libc-start.c:165)
==5944==  Uninitialised value was created
==5944==    at 0x513A6A: brk (brk.c:32)
==5944==    by 0x4ED4EB: sbrk (sbrk.c:54)
==5944==    by 0x498C13: __libc_setup_tls (libc-tls.c:150)
==5944==    by 0x498366: __pthread_initialize_minimal (nptl-init.c:296)
==5944==    by 0x498920: (below main) (libc-start.c:146)

在編譯或運行Valgrind時是否缺少某些內容? 還是我的代碼確實存在所有這些錯誤?

非常感謝你!

某些庫確實有很多小警告,例如您正在顯示的警告。 我認為它們不是從您的代碼中看到它們出現的文件名而來。

您將不得不在其他地方查找段錯誤。 嘗試使用gdb運行它,查看它的停止位置並在錯誤周圍打印值以查看發生了什么。

希望能幫助到你 :)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM