https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146
Bug ID: 82146 Summary: if (&pdo) is always true error Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: maasoftware at yandex dot ru Target Milestone: --- // // Linux Debian 9 Stretch x64 g++ 6.3.0 // -O2 or -O3 optimization option // g++ -c -pipe -W -O3 -I. -I.. -I/usr/local/include -o file.o file.cpp // int CMyClass::MyFunc(_qword FileNum, CMaaString &Path, CMaaXmlDocument &doc) { .... if (CMaaFile::IsAFile(FileName)) { if (&Path) { Path = FileName; // GPFault when Path is passed as *(CMaaString *)NULL } doc = _doc; return true; } .... } int CMyClass::MyFunc2() { ... return MyFunc(Num, *(CMaaString *)NULL, doc); // produces GPF ... }