From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by sourceware.org (Postfix) with ESMTPS id A781D38983AD for ; Tue, 15 Nov 2022 15:38:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A781D38983AD Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rtems.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f173.google.com with SMTP id p18so9717726qkg.2 for ; Tue, 15 Nov 2022 07:38:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+JclGgl5pY1WnxTuOT8kZ4qkXpCt65wOTuCT3nZKzCg=; b=ZKjG4dbZ5RjouWHb2M5QWftNKFL5qwUm6NO2UseqIZVYZvVGyCE3xEPdLFPdAtzoDG aGnpHz8Dbh/9pcBOo2W7QPn7WCkb/w5AgDte9NAFxOYET3eYnlRptA5ibXK4QV4p6rA0 lKfHZusRyEqUBJKnjAh6wnZRWrywQjH4uokBEtjhxcEoTY8w61T0KabMDs2wW31pdbr+ sES3rWIp9zmMPgw4V3nm++uwnxRv99vKDUbJIjsJ+ykbYbx0jcYRh5ydfYZdahQ0tS95 yeZXLVDpKlkdOzv19trANi7JMR2CQ8/o/5FIbqAgLi8rwkJCYjtZ6XQQo1ncntpnV0FK BZvw== X-Gm-Message-State: ANoB5pmucXFtazvuo88j+ETlw6sHom3XhQgr6wxy3V9ZAmbtEERh5Nnu iB96ea0zOM2TCWDNDUveJWC/Uen2G/g= X-Google-Smtp-Source: AA0mqf7RsiJQFPBf1EMc1zq22GHFw6/OJVtb8m/jADLi8h0uCWosfoLrPpuHmjf/g81TPjKq4n+kyA== X-Received: by 2002:a05:620a:13aa:b0:6fa:1584:4912 with SMTP id m10-20020a05620a13aa00b006fa15844912mr15957398qki.701.1668526719714; Tue, 15 Nov 2022 07:38:39 -0800 (PST) Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com. [209.85.128.175]) by smtp.gmail.com with ESMTPSA id t2-20020a05620a450200b006ceb933a9fesm8171027qkp.81.2022.11.15.07.38.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Nov 2022 07:38:39 -0800 (PST) Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-376596ae449so140529577b3.5 for ; Tue, 15 Nov 2022 07:38:38 -0800 (PST) X-Received: by 2002:a05:690c:b0a:b0:36f:ce5a:40a3 with SMTP id cj10-20020a05690c0b0a00b0036fce5a40a3mr17657216ywb.272.1668526718728; Tue, 15 Nov 2022 07:38:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Reply-To: joel@rtems.org From: Joel Sherrill Date: Tue, 15 Nov 2022 09:38:26 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: round() on arm vs aarch64 To: Richard Earnshaw Cc: Newlib Content-Type: multipart/alternative; boundary="0000000000005e41ec05ed842691" X-Spam-Status: No, score=-3031.4 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,KAM_DMARC_STATUS,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,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: --0000000000005e41ec05ed842691 Content-Type: text/plain; charset="UTF-8" Digging a bit, I noticed a huge block of is ifdef'ed out for aarch64. I found the file c++config.h which is different between the two. Based on the diff of the arm and aarch64 versions, arm has _GLIBCXX_USE_C99_MATH_TR1 defined but aarch64 does not. I have no idea where the settings in this file come from but this appears to be the key difference. More insight appreciated. ===================================================== round]$ diff /home/joel/rtems-work/tools/6/lib/gcc/arm-rtems6/12.2.1/include/c++/arm-rtems6/bits/c++config.h /home/joel/rtems-work/tools/6/lib/gcc/aarch64-rtems6/12.2.1/include/c++/aarch64-rtems6/bits/c++config.h 886c886 < /* #undef _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY */ --- > #define _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY 1 1702c1702 < #define _GLIBCXX_MANGLE_SIZE_T j --- > #define _GLIBCXX_MANGLE_SIZE_T m 1711c1711 < #define _GLIBCXX_PTRDIFF_T_IS_INT 1 --- > /* #undef _GLIBCXX_PTRDIFF_T_IS_INT */ 1717c1717 < #define _GLIBCXX_SIZE_T_IS_UINT 1 --- > /* #undef _GLIBCXX_SIZE_T_IS_UINT */ 1774c1774 < #define _GLIBCXX_USE_C99_MATH_TR1 1 --- > /* #undef _GLIBCXX_USE_C99_MATH_TR1 */ ===================================================== On Mon, Nov 7, 2022 at 11:28 AM Richard Earnshaw < Richard.Earnshaw@foss.arm.com> wrote: > > > 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. > --0000000000005e41ec05ed842691--