From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7D5743858D39; Thu, 23 Sep 2021 07:08:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D5743858D39 From: "unlvsur at live dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102466] New: -O3 -fsanitize=undefined causes warnings (writing 2 bytes into a region of size 0) Date: Thu, 23 Sep 2021 07:08:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: unlvsur at live dot com X-Bugzilla-Status: UNCONFIRMED 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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: Thu, 23 Sep 2021 07:08:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102466 Bug ID: 102466 Summary: -O3 -fsanitize=3Dundefined causes warnings (writing 2 bytes into a region of size 0) Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: unlvsur at live dot com Target Milestone: --- Created attachment 51503 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D51503&action=3Dedit Preprocessed file without -fsanitize=3Dundefined or use -O2 won't trigger the warning here cqwrteur@Home-Server:~/fast_io/examples/0021.kernel_driver$ g++ -S main.cc -std=3Dc++20 -I../../include -s -fno-exceptions -fno-rtti -fsanitize=3Dund= efined -O3 -ffreestanding In function 'constexpr void fast_io::linux::print_status_define(fast_io::linux::basic_kpr, Args ...) [with bool line =3D true; ch_type =3D char; Args =3D {fast_io::basic_io_scatter_t, fast_io::manipulators::scalar_manip_t, fast_io::basic_io_scatter_t, fast_io::basic_io_scatter_t, fast_io::manipulators::scalar_manip_t, fast_io::manipulators::scalar_manip_t}]': cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] cc1plus: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] This is freestanding code to reduce size of processor file. You can just tr= eat printk function as printf. -ffreestanding does not affect whether the warni= ng would emit or not. Do not know whether it is a false positive.=