From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id C80BD3938C06 for ; Fri, 1 May 2020 13:38:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C80BD3938C06 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 041DcNc7030605; Fri, 1 May 2020 08:38:23 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 041DcNUb030604; Fri, 1 May 2020 08:38:23 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 1 May 2020 08:38:23 -0500 From: Segher Boessenkool To: Jonathan Wakely Cc: Tom N , gcc-help Subject: Re: -fsanitize=undefined behavior Message-ID: <20200501133823.GB31009@gate.crashing.org> References: <705810366.188410.1588278611012@email.ionos.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 13:38:27 -0000 Hi! On Thu, Apr 30, 2020 at 10:57:49PM +0100, Jonathan Wakely via Gcc-help wrote: > On Thu, 30 Apr 2020 at 22:27, Tom N wrote: > > > > The man page for -fsanitize=undefined lists a bunch of sub-options (eg. -fsanitize=shift, -fsanitize=shift-exponent, etc). If I include -fsanitize=undefined does it enable all of the sub-options, or none, or something in between? If it doesn't enable all sub-options, is there an easy way to do that short of specifying all of them? > > The man page says: > > "Unlike other similar options, -fsanitize=float-divide-by-zero is not > enabled by -fsanitize=undefined" and "Unlike other similar options, > -fsanitize=float-cast-overflow is not enabled by -fsanitize=undefined" > > So it seems reasonable to assume that all the other suboptions are > enabled by -fsanitize=undefined, and if you want *all* of them then > use -fsanitize=undefined -fsanitize=float-divide-by-zero > -fsanitize=float-cast-overflow The code (flag-types.h) says SANITIZE_UNDEFINED_NONDEFAULT = SANITIZE_FLOAT_DIVIDE | SANITIZE_FLOAT_CAST | SANITIZE_BOUNDS_STRICT (and there are no surprises with how it is used). The -fsanitize-bounds-strict option is unusual: it *weakens* what -fsanitize-bounds does! So yes, only -fsanitize=float-divide-by-zero and -fsanitize=float-cast-overflow are not enabled by default. Segher