From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86059 invoked by alias); 2 Jan 2020 05:37:47 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 86031 invoked by uid 89); 2 Jan 2020 05:37:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:209.85.222, yubin, Yubin, int16_t X-HELO: mail-qk1-f169.google.com Received: from mail-qk1-f169.google.com (HELO mail-qk1-f169.google.com) (209.85.222.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Jan 2020 05:37:43 +0000 Received: by mail-qk1-f169.google.com with SMTP id z14so29420140qkg.9 for ; Wed, 01 Jan 2020 21:37:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=sJYCmBsQhBMKYoV8+0AuHcp9c0hbpaxxGkZGT078+d0=; b=cBvI5NBTarSPUoag+tYM919d8ox6xzSGyxngnac1pcX4iAeQOVXwV/ZNWn+me2mvdQ CAkbrXpTD1y9964fhivVTrnovXKU9TQ316X82wf0F3pqhw0Z/DoazdY4MuUVqyeS8E0t B82Mn1U8Ic6viOwojqxKSUy8OzkeW7KWdHKDhUb916tXoFh19jPwvMadY0KwcZqnjfjF +7k1ilfvTJEyLjaQ7CwemNofG0Qk7hjMT25Xky/ei8XV/7OO4NPkuykCr+mSAcahjNBQ OocnBWv+ZbVRzxqEJqWNxFDSUNETui2L6KyX5i8++NB3RGbPm6DvD5bxK6qeHek44y8X 9atw== MIME-Version: 1.0 References: <01c8106b-e971-a51b-6dfa-291acf456362@126.com> In-Reply-To: <01c8106b-e971-a51b-6dfa-291acf456362@126.com> From: Yubin Ruan Date: Thu, 02 Jan 2020 05:37:00 -0000 Message-ID: Subject: Re: gcc warning about return value truncation To: Liu Hao Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00000.txt.bz2 Thanks a lot. On Sun, Dec 29, 2019 at 2:29 PM Liu Hao wrote: > > =E5=9C=A8 2019/12/29 13:11, Yubin Ruan =E5=86=99=E9=81=93: > > Is there any gcc flag to warn about this? > > > > > > The return value of func() was truncated because the return type is > > accidentally written as int16_t > > > > > It's `-Wconversion`. By the way I suggest you add `-Wsign-conversion` in > C++ as well. > > > -- > Best regards, > LH_Mouse >