gpt4 book ai didi

c++ - 有条件的跳跃或移动取决于未初始化的值

转载 作者:行者123 更新时间:2023-11-28 03:16:37 25 4
gpt4 key购买 nike

Valgrind 中的第一个错误:

 /media/d2bfa67b-a3e7-4dde-9f3a-119260e3a29c/workspace/000-back-office/var/root_data/global_product_id/global_product_id_cut.root
==14840== Conditional jump or move depends on uninitialised value(s)
==14840== at 0x8B264E0: inflateReset2 (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4)
==14840== by 0x8B265D8: inflateInit2_ (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4)
==14840== by 0x5627ABA: R__unzip (in /media/d2bfa67b-a3e7-4dde-9f3a-119260e3a29c /workspace/000-back-office/src/root/lib/libCore.so)
==14840== by 0x5E1B409: TKey::ReadObjWithBuffer(char*) (in /media/d2bfa67b-a3e7-4dde-9f3a-119260e3a29c/workspace/000-back-office/src/root/lib/libRIO.so)
==14840== by 0x5DFB673: TFile::GetStreamerInfoList() (in /media/d2bfa67b-a3e7-4dde-9f3a-119260e3a29c/workspace/000-back-office/src/root/lib/libRIO.so)
==14840== by 0x5DF9CC9: TFile::ReadStreamerInfo() (in /media/d2bfa67b-a3e7-4dde-9f3a-119260e3a29c/workspace/000-back-office/src/root/lib/libRIO.so)
==14840== by 0x5DFCE68: TFile::Init(bool) (in /media/d2bfa67b-a3e7-4dde-9f3a-119260e3a29c/workspace/000-back-office/src/root/lib/libRIO.so)
==14840== by 0x5DFDE12: TFile::TFile(char const*, char const*, char const*, int) (in /media/d2bfa67b-a3e7-4dde-9f3a-119260e3a29c/workspace/000-back-office/src/root/lib/libRIO.so)
==14840== by 0x43BBA6: ROOTproduct_id_record::loadROOT(bool) (ROOTproductidrecord.cpp:1078)
==14840== by 0x42E5CD: ROOTproduct_id::loadROOT() (ROOTproductid.cpp:142)
==14840== by 0x469D17: main (report_engine.cpp:528)

ROOTproductidrecord.cpp:1077-1078

std::cout<<filename_char<<"\n";
TFile* my_rootfile_pointer = new TFile(filename_char); //open an existing file for reading (default).

如您所见,filename_char 有一个值...下一个函数 (TFile::TFile) 来自稳定的 CERN 库。

我不明白 ROOTproductidrecord.cpp:1078 有什么问题...

最佳答案

来自 http://zlib.net/zlib_faq.html#faq36 :“Valgrind(或一些类似的内存访问检查器)说 deflate 正在执行取决于未初始化值的条件跳转。这不是错误吗?

没有。出于性能原因,这是有意为之的,并且 deflate 的输出不受影响。这最近才开始出现,因为 zlib 1.2.x 默认使用 malloc() 进行分配,而早期版本使用 calloc(),它将分配的内存清零。尽管代码是正确的,但 1.2.4 版及更高版本已更改为不刺激这些跳棋。”

关于c++ - 有条件的跳跃或移动取决于未初始化的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16707173/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com