From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 21C9C3854809; Fri, 18 Dec 2020 21:55:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21C9C3854809 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBtaWRkbGUtZW5kLzk4MzczXSBbMTEgUmVwcmVzc2lvbl0g?= =?UTF-8?B?Qm9ndXMgZXJyb3I6IOKAmHN5bWJ1ZuKAmSBtYXkgYmUgdXNlZCB1bmluaXRp?= =?UTF-8?B?YWxpemVkIGF0IC1PMA==?= Date: Fri, 18 Dec 2020 21:55:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2020 21:55:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98373 H.J. Lu changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW --- Comment #2 from H.J. Lu --- [hjl@gnu-cfl-2 gold]$ cat /tmp/foo.cc=20 template struct Sym_data; template<> struct Sym_data<32> { unsigned char st_info; unsigned char st_other; }; template<> struct Sym_data<64> { unsigned char st_info; unsigned char st_other; }; template class Sym { public: Sym(const unsigned char* p) : p_(reinterpret_cast*>(p)) { } private: const Sym_data* p_; }; template class Sized_relobj_incr { private: void do_add_symbols(); Sym *symbols_; }; template Sym * foo(Sym *); template void Sized_relobj_incr::do_add_symbols() { unsigned char symbuf[100]; Sym sym(symbuf); Sym* res =3D foo(&sym); this->symbols_ =3D res; } template class Sized_relobj_incr<32, false>; [hjl@gnu-cfl-2 gold]$ /usr/gcc-11.0.0-x32/bin/g++ -Wall -S /tmp/foo.cc /tmp/foo.cc: In member function =E2=80=98void Sized_relobj_incr::do_add_symbols() [with int size =3D 32; bool big_endian =3D fa= lse]=E2=80=99: /tmp/foo.cc:47:25: warning: =E2=80=98symbuf=E2=80=99 may be used uninitiali= zed [-Wmaybe-uninitialized] 47 | Sym sym(symbuf); | ^~~ /tmp/foo.cc:22:3: note: by argument 2 of type =E2=80=98const unsigned char*= =E2=80=99 to =E2=80=98Sym::Sym(const unsigned char*) [with int size = =3D 32; bool big_endian =3D false]=E2=80=99 declared here 22 | Sym(const unsigned char* p) | ^~~ /tmp/foo.cc:46:17: note: =E2=80=98symbuf=E2=80=99 declared here 46 | unsigned char symbuf[100]; | ^~~~~~ [hjl@gnu-cfl-2 gold]$=