https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68099
Bug ID: 68099 Summary: arm-*-linux-gnueabihf -fsanitize=undefined warning: '<anonymous>' is used uninitialized in this function Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: yba at tkos dot co.il CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org Target Milestone: --- Created attachment 36586 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36586&action=edit crosstool-ng .config file for arm-mxs-linux-gnueabihf Command: arm-mxs-linux-gnueabihf-g++ \ -Wall -Wextra \ -O3 \ --sysroot=${STAGING} \ -o test test.cpp Code: #include <iostream> class Dog { public: typedef void(Dog::*BarkFunction)(int); Dog () {} void makeNoise (int z) { std::cout << "Woof!" << z << std::endl; } void something1() { BarkFunction fnc = &Dog::makeNoise; (this->*fnc)(7); } void something2(); }; void Dog::something2() { BarkFunction fnc = &Dog::makeNoise; (this->*fnc)(7); Dog::makeNoise(7); } int main(int argc, char* argv[]) { return 0; } Output: dog.cpp:26:14: warning: '<anonymous>' is used uninitialized in this function [-Wuninitialized] (this->*fnc)(7); ^ Comments: 1. crosstool-ng .config attached. 2. The warning cited is not emitted when the optimization -O<x> is removed from the command. 3. The warning cited is not emitted on x86_64 compiler built with similar config 4. Compiler was built using crosstool-ng using the attached .config. 5. Same problem happens with GCC 5.1.0 compiled with crosstool-ng with similar arm-*-linux-gnuabihf .config