From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id E64D23858D35 for ; Thu, 16 Dec 2021 21:00:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E64D23858D35 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mxxrD-0007AE-A5 for fortran@gcc.gnu.org; Thu, 16 Dec 2021 22:00:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: fortran@gcc.gnu.org From: Harald Anlauf Subject: Re: [patch] Fix PR libfortran/95177, ctype.h functions should not be called with char arguments Date: Thu, 16 Dec 2021 22:00:01 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 In-Reply-To: Content-Language: en-US Cc: gcc-patches@gcc.gnu.org X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FORGED_MUA_MOZILLA, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Dec 2021 21:00:10 -0000 Hi FX, Am 16.12.21 um 21:22 schrieb FX via Fortran: > Hi, > > Functions from should only be called on values that can be represented by unsigned char. On targets where char is a signed type, some of libgfortran calls have undefined behaviour. > > The solution is to cast the argument to unsigned char type. I’ve defined macros in libgfortran.h to do so, to retain legibility of the library code. > > Bootstrapped and regtested on x86_64-pc-linux-gnu. > OK to commit? > > FX > I think that is basically OK. However, I am wondering if calling the macros safe_* gives a false impression of what they actually do. The cases where they are used with your patch applied seem sane, for now, though. Thanks for the patch! Harald