From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id 1D7843858D35 for ; Thu, 16 Mar 2023 21:01:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1D7843858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x22a.google.com with SMTP id be16so2385438oib.0 for ; Thu, 16 Mar 2023 14:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679000517; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ThkOTrr7FUtrGDP9XbfXNT5uOtC/Gkuz6OWxydgvVTA=; b=Ixt7bAOABVK0LgU2E/rdCLiP+PzWjYgaIjnfTOk8Zu38qA3bl3E2qIwQ271uYsdOzs ev1TEan1uK8sW34edNWRLrHS+XGiDnXPbJy1LcYWOEliVxrtO+gTSJus7VYA5UgYPQUw oZfsTRDOxyCMDkOrZLXDUUNAp8vHF+AoekC6yE4DLYDMHaOj+mZqR33p/31/iUl9bKLc OtwyV0nFAxZrbyMakZPaD5Bdu+qDGuNiYcEuDMY6OoBDjlA4uh0q5Dmoabe84dzuvVw+ men/LTWP4J/Kc5inC1STLsGZX5tOX5XpoaT89TC8wuf6QTBeUe6nfJu5/WeaDxB/cxko iFQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679000517; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ThkOTrr7FUtrGDP9XbfXNT5uOtC/Gkuz6OWxydgvVTA=; b=XgeNzOXKHj1gPXH19m6erabQVELbSyG3KCKLLZ7aSHuEUG46XSZrruhTI3pZsWBFH+ efUQM9pAc+CYazOUbbGtThxbVCXH1ehH0S6FbUCWFCuUvIo9cCsq5kgR4x6RU8ehGyRI 9b39oSzSWx44dKXtvyi+ipcc/rD2ytfScG+R+I7aaGkKSo0I9nn39Va/PyvxMmKcLWwV fcV95dm76Eal1Lx+ikFU6ZfvedRaPU+xktAGeOb/Ltyxy6voihjyVmJo4XBd3PW6gWBV UyP9HQrailpKM3Yr06/r3bKXZeFvBF0bE3B0FBhQQU/YGqcB2Rl0+y0clsTPzERaQUOn bxTQ== X-Gm-Message-State: AO0yUKW9M3hFSyJyVZ0wTiclXhEHjaP4fMdkrp0CB3NRoLibbJoOqjgZ p7wcWBC46DJlVLpg1iN+kP2dggNy1hjLCsQauCfGiA== X-Google-Smtp-Source: AK7set+xMuJcfcbxMn5j8hwIaIKDSm1uVXsQDf86IBh2hKGdeCcjLubkiR+XaFS1kbiHGM2JjHmF4A== X-Received: by 2002:a54:441a:0:b0:384:8b17:3795 with SMTP id k26-20020a54441a000000b003848b173795mr3056576oiw.28.1679000516784; Thu, 16 Mar 2023 14:01:56 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c0:c260:9a4:3847:50c3:a2f0? ([2804:1b3:a7c0:c260:9a4:3847:50c3:a2f0]) by smtp.gmail.com with ESMTPSA id vj7-20020a0568710e0700b00172289de1besm239407oab.18.2023.03.16.14.01.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Mar 2023 14:01:56 -0700 (PDT) Message-ID: <731d2025-ab53-4027-7d14-9326722b563e@linaro.org> Date: Thu, 16 Mar 2023 18:01:54 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: C2x strtol binary constant handling: Fix special case "0b" Content-Language: en-US To: libc-alpha@sourceware.org References: <3614039.ZfL8zNpBrT@nimes> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <3614039.ZfL8zNpBrT@nimes> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 16/03/23 12:14, Bruno Haible wrote: > Hi Joseph, > > While adding C2x support to the strtol, strtoll, strtoul, strtoull > functions in Gnulib, I was glad to see that you have already done > the support in glibc. But I noticed that the glibc implementation > apparently does not handle the input "0b" correctly. The unit test > cases for this special case are: > > { > const char input[] = "0b"; > char *ptr; > long result; > errno = 0; > result = strtol (input, &ptr, 2); > assert (result == 0L); > assert (ptr == input + 1); > assert (errno == 0); > } > { > const char input[] = "0b"; > char *ptr; > long result; > errno = 0; > result = strtol (input, &ptr, 0); > assert (result == 0L); > assert (ptr == input + 1); > assert (errno == 0); > } > > and likewise for strtoll, strtoul, strtoull. > > Find attached a correction for this. I have tested it in Gnulib (which > has very similar source code as glibc for this functionality), not in > Glibc directly. Therefore, please review thoroughly. > > Bruno Could you also add these testscase on strtol tests ?