https://bugs.kde.org/show_bug.cgi?id=438984
Bug ID: 438984 Summary: Uncomplete report with C++ and --track-origins=yes Product: valgrind Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: memcheck Assignee: jsew...@acm.org Reporter: jskar...@redhat.com Target Milestone: --- SUMMARY Install powertop-2.14 STEPS TO REPRODUCE 1. valgrind --log-file=/var/tmp/log --trace-origins=y powertop 2. 3. OBSERVED RESULT ==6543== Conditional jump or move depends on uninitialised value(s) ==6543== at 0x1404A2: global_power() (measurement.cpp:89) ==6543== by 0x14051A: global_sample_power() (measurement.cpp:104) ==6543== by 0x1220A8: one_measurement(int, int, char*) (main.cpp:246) ==6543== by 0x1179DB: main (main.cpp:543) ==6543== Uninitialised value was created by a heap allocation ==6543== at 0x483A0F4: operator new(unsigned long, std::nothrow_t const&) (vg_replace_malloc.c:385) ==6543== by 0x13E1EF: sysfs_power_meters_callback(char const*) (measurement.cpp:144) ==6543== by 0x121553: process_directory(char const*, void (*)(char const*)) (lib.cpp:455) ==6543== by 0x1219AE: UnknownInlinedFun (measurement.cpp:174) ==6543== by 0x1219AE: powertop_init(int) [clone .part.0] (main.cpp:403) ==6543== by 0x1179A8: UnknownInlinedFun (extech.cpp:280) ==6543== by 0x1179A8: main (main.cpp:518) EXPECTED RESULT Pointer from where the uninitialized value is coming from. In the current output there is missing step the user has to find out manually, see the ADDITIONAL INFORMATION bellow. SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: Fedora 33 (available in About System) KDE Plasma Version: KDE Frameworks Version: Qt Version: valgrind-3.16.1 ADDITIONAL INFORMATION measurement.cpp: 076: double global_power(void) 077: { 079: bool global_discharging = false; 080: double total = 0.0; 081: unsigned int i; 082: 083: for (i = 0; i < power_meters.size(); i++) { 084 global_discharging |= power_meters[i]->is_discharging(); 085: total += power_meters[i]->power(); 086: } 087: 088: /* report global time left if at least one battery is discharging */ 089: if (!global_discharging) 090: return 0.0; 091: 092: all_results.power = total; 093: if (total < min_power && total > 0.01) 094: min_power = total; 095: return total; 096: } The line 89 with 'if (!global_discharging)' is not much helpful, because on line 79 the global_discharging is explicitly initialized to 'false'. It's actually the line 84 where the problem is (and it's missing from the valgrind report). On the line 84 it's the call 'power_meters[i]->is_discharging()' which is causing the problem. measurement.h 32: class power_meter { 33: bool discharging; 34: public: 35: virtual ~power_meter() {}; 36: 37: virtual void start_measurement(void); 38: virtual void end_measurement(void); 39: virtual double power(void); 40: 41: virtual double dev_capacity(void) 42: { 43: return 0.0; /* in Joules */ 44: } 45: 46: virtual void set_discharging(bool d) 47: { 48: discharging = d; 49: } 50: 51: virtual bool is_discharging() 52: { 53: return discharging; 53: } 55: }; So the real problem is line 53, which leads to the line 33 which is missing the explicit initialization. But these steps are missing from the valgrind report and needs to be found out manually. -- You are receiving this mail because: You are watching all bug changes.