From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CAC923858C83; Wed, 12 Apr 2023 08:46:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAC923858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681289179; bh=u/UYc/gXm7A/sJuyHm096zC+reILY46k991lm616ixY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=blBGSNMl30DXAv932wro3Rwc1qqKFR6xY+CwBcBX9X9sWQ9rNNaUhGozPgvVL7R1s gzlIeZhEAHNAp0GLTMtADGp0kg6uaiCLM4Rkz6z3nc7GlswfPxLWe1uDcr830NBX9z resEPqnfgDIA4cK4LFGy2nqfQJ14JMq5Vrf3sB1Y= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/109446] Possible destination array overflow without diagnosis in memcpy Date: Wed, 12 Apr 2023 08:46:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 8.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109446 --- Comment #6 from Richard Biener --- (In reply to Martin Li=C5=A1ka from comment #5) > > It seems Clang disables this optimization and convert memcpy to > > __asan_memcpy calls if -fsanitize=3Daddress used: > >=20 > > https://godbolt.org/z/dcfadoMYY >=20 > Yep! Richi, do you know a place where we lower this? gimple_fold_builtin_memory_op not sure if we should prevent all of those transforms. But the question is why ASAN doesn't instrument the generated aggregate copy? Maybe because in C/C++ you cannot write an aggregate array copy?=