From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 93C233858C52 for ; Fri, 15 Sep 2023 15:18:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 93C233858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-31fc91d5ca6so2153097f8f.0 for ; Fri, 15 Sep 2023 08:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694791121; x=1695395921; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KvWpN6ZLq6ve62N5H3/QOq8HHuw7SHxMAqxQtDMuOPo=; b=TqEFXu7R6Ieyolbp+8QkdX0dZCfRf+dwef5P+dC3Yewd9+Mi0DHR/HojH3qHtzPMrW OKyyH3Me+e31uZNur6CXwKYLW91ruc9KPZbY3SNscgjUxx1DE6kB8pvsMUsimxYXO3rq rdKQe5/cIGHYXGV0FI41j7kW8KmGqcHYzSuTn5a5O/64ocC/yQknIz5pUgjkSXhDB+Fa dpGwS/pfiLChR6hG8/wFP8soKrArlZq4OtsAsqInW8Zv306npSKbDpI9ErL3MfxM8/ES f1nY49BD9w+HNa41CWwP3IidAYriak1+Icz3gL1wdN6fQV8HZV+xi8HMaEZbYD2EdskB VE0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694791121; x=1695395921; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KvWpN6ZLq6ve62N5H3/QOq8HHuw7SHxMAqxQtDMuOPo=; b=JzRKMjkdjA6PGmxY69azibpFhNS6JMsD1I99c2D9Gp/sl9gNnYvFM7rLNE19OUFL45 VLMjjTlkeO8YWl8lNOUp/1t5eUFwpcTmgUZwb0C9KTGNsHs9caiYAZCkGJJfaJdGXKyu JgoiKBCVPt9Uew59KmHJnMsHoSzcMXlcxTNqAT9NAPjSLk4YAdabT/axoH1ZxIHtTv47 /3Q5NX7qAYT72xlJ5VDof6EWWIrAPCluurQne07R98U7/ajdZK2r+34bZ/qu2LD8e4Jv QT5SimotahtzAfdpQJHIqn0dmy+rFITTJC+MM0OBol1lNUtUgluaRbUSbI6dYxFiSbEw N/4w== X-Gm-Message-State: AOJu0YybAC+J0dgE0xee9os7rA566YTMbidO0qB75vBTCiklZTZEIh9Y xQFexZTreTL/7dZkYmdXkfbMOnpfSBHE8BGcpI0= X-Google-Smtp-Source: AGHT+IFIJuMjo7Oc6aLH5yWS2LS0W0q7HFoOJUQQ73+eEuorhnFHYSxRp4aKryHmDHxPD77q+Al72GaOYGgVt6JzKcI= X-Received: by 2002:a5d:58d6:0:b0:31f:e980:cd88 with SMTP id o22-20020a5d58d6000000b0031fe980cd88mr1803905wrf.61.1694791120888; Fri, 15 Sep 2023 08:18:40 -0700 (PDT) MIME-Version: 1.0 References: <5E83778D-E24C-4B9A-90C8-42DE5F26AA17@oracle.com> <9D17171F-5E62-4822-B245-04FB1C7B2739@gmail.com> <288732AC-20C3-4CEF-B412-E8259E2D4011@oracle.com> <4A05D2C5-352F-4B13-8CCE-50EB7D0B93FA@oracle.com> <47F4F21B-7A1A-48D4-AE37-583CC7EBA6B7@oracle.com> In-Reply-To: <47F4F21B-7A1A-48D4-AE37-583CC7EBA6B7@oracle.com> From: Andrew Pinski Date: Fri, 15 Sep 2023 08:18:28 -0700 Message-ID: Subject: Re: Question on -fwrapv and -fwrapv-pointer To: Qing Zhao Cc: Xi Ruoyao , Richard Biener , gcc Patches , kees Cook Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Sep 15, 2023 at 8:12=E2=80=AFAM Qing Zhao wr= ote: > > > > > On Sep 15, 2023, at 3:43 AM, Xi Ruoyao wrote: > > > > On Thu, 2023-09-14 at 21:41 +0000, Qing Zhao wrote: > >>>> CLANG already provided -fsanitize=3Dunsigned-integer-overflow. GCC > >>>> might need to do the same. > >>> > >>> NO. There is no such thing as unsigned integer overflow. That option > >>> is badly designed and the GCC community has rejected a few times now > >>> having that sanitizer before. It is bad form to have a sanitizer for > >>> well defined code. > >> > >> Even though unsigned integer overflow is well defined, it might be > >> unintentional, shall we warn user about this? > > > > *Everything* could be unintentional and should be warned then. GCC is = a > > compiler, not an advanced AI educating the programmers. > > Well, you are right in some sense. -:) > > However, overflow is one important source for security flaws, it=E2=80=99= s important for compilers to detect > overflows in the programs in general. Except it is NOT an overflow. Rather it is wrapping. That is a big point here. unsigned wraps and does NOT overflow. Yes there is a major difference. > > Qing > > > > -- > > Xi Ruoyao > > School of Aerospace Science and Technology, Xidian University >