From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id B7F183858C2D for ; Mon, 7 Nov 2022 17:28:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B7F183858C2D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=foss.arm.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=foss.arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 961651FB; Mon, 7 Nov 2022 09:28:44 -0800 (PST) Received: from [10.2.78.76] (unknown [10.2.78.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 051973F534; Mon, 7 Nov 2022 09:28:37 -0800 (PST) Message-ID: Date: Mon, 7 Nov 2022 17:28:36 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: round() on arm vs aarch64 Content-Language: en-GB To: joel@rtems.org, Newlib References: From: Richard Earnshaw In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3489.8 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_NUMSUBJECT,NICE_REPLY_A,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no 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 03/11/2022 14:13, Joel Sherrill wrote: > Hi > > This is likely not a newlib bug but I thought I would start here because > I'm not sure what is going on and I thought someone on this list would have > an idea: This is a simple C++ function that calls std::round. It compiles > on arm but aarch64 says round isn't in the std namespace. > > If you change the program to just use round() and not std::round() it > compiles on both architectures. > > The compiler versions are the same and report: > > arm-rtems6-gcc (GCC) 12.2.1 20221014 (RTEMS 6, RSB > cb8821e93378118e78a9cb25859789b126bd5761, Newlib 0b6342c) > > ===================== > $ cat r.cc > #include > > > > int wrap(double v) > > { > > double r = std::round((float)v); > > return (r > 0); > > } > > [joel@devel round]$ arm-rtems6-gcc -Wall -c r.cc > [joel@devel round]$ aarch64-rtems6-gcc -Wall -c r.cc > r.cc: In function 'int wrap(double)': > r.cc:5:19: error: 'round' is not a member of 'std'; did you mean 'round'? > 5 | double r = std::round((float)v); > | ^~~~~ > In file included from > /home/joel/rtems-work/tools/6/lib/gcc/aarch64-rtems6/12.2.1/include/c++/cmath:45, > from r.cc:1: > /home/joel/rtems-work/tools/6/aarch64-rtems6/include/math.h:337:15: note: > 'round' declared here > 337 | extern double round (double); > ===================== > > Any ideas what would cause this? > > Thanks > > --joel Have you tried comparing the pre-processed output from the two versions? It might give a clue as to what's going on. R.