From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E085E3858C2D; Fri, 12 May 2023 22:34:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E085E3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683930846; bh=6MzKjhGsPRxhy1LgbBWyqhK9tz7Lj3dNPCHQA5spHU8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ilf8SOIGUrWE9Cv+tmFgqtytgqvxrm1CBXU7csED9esBIJAUcXDtIr8aZ6qyml+DJ cfKdYwDvtUeU0Y5RdxiHUIEB3TTQ3BLUPyhzzmsYj3b67El+4Y2yiDCrLtEKjECntN s7TtRZsK3f+EB+fTFJguobgURkOLrJ1TaMWzF/2M= From: "arsen at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109814] [13/14 Regression] freestanding using cmath does not compile anymore Date: Fri, 12 May 2023 22:34:06 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: arsen at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109814 --- Comment #10 from Arsen Arsenovi=C4=87 --- (In reply to lesto fante from comment #9) > To be fair I have no idea what would be the impact of removing freestandi= ng, > from a quick test does not seems to have a realistic impact. >=20 > I guess what happen here is that the freestanding option should remove as > much as possible, and the -specs=3Dnano.specs should re-enable only the > minimum necessary. >=20 > Seems like the proper way to do so is to just specify -specs=3Dnano.specs= , or > go full freestanding? I was hinting at the former. -ffreestanding doesn't do much (grep for flag_hosted in gcc/), so it *should* be safe to drop. (it changes __STDC_HOSTED__, and hence _GLIBCXX_HOSTED, and silences some main-related warnings) -specs=3Dnano.specs is a newlib thing - I'm not sure how it's meant to be u= sed (but it seems fine to keep it from a quick read) > My user case is industrial robot that have to be as reliable as possible. >=20 > Being able to write embedded code using C++ give me RAII, constexpr, > templating, function overload, runtime and compile time polymorphism.=20 >=20 > Generally the manufacturer IDE disable allocation and exception, so I pre= tty > much avoid STL as it is a mine field. libstdc++ ought to work without those. std::allocator isn't part of the freestanding subset, but many bits of the STL work regardless of that. > In pure freestanding, I would expect smart pointer and at least parts cma= th > to work; the compiler offer me only the FPU accelerated functionality, and > is up to me to implement the remaining. a good bit is, but not cmath, as a large part of it required a runtime. you should be able to use it in your configuration without -ffreestanding, prob= ably > Unofficial AVR-gcc used the trick of making double into float, i would > prefer compilation error than those switcheroo under the hoods. arm-none-eabi-gcc seems to be built with a hosted libstdc++ configuration, = so my guess is (without trying) that removing -ffreestanding should recover I want to add more code to the freestanding subset to GCC 14, but have not = had time for such experimentation yet. cmath is on that list.=