Skip to content

C11 _Atomic and C++11 std::atomic<> types not supported--will they ever be? (Arduino needs to update their version of avr-gcc?) #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ElectricRCAircraftGuy opened this issue May 10, 2023 · 1 comment

Comments

@ElectricRCAircraftGuy
Copy link

ElectricRCAircraftGuy commented May 10, 2023

See my answer here, under the section "Why not just use the atomic_* types offered by C11 and C++11 or later?". See my comments under that answer and under this answer too.

Will the 8-bit AVRs ever support this?

Currently my work-around is the decades-old one described in my "Full example usage: how to efficiently, atomically, read shared volatile variables" here.

See also my comment:

Note: arduino-1.8.13/hardware/tools/avr/bin/avr-g++ --version shows avr-g++ (GCC) 7.3.0. I just installed the latest Arduino 2.1.0 and got the same error too. Checking its g++ version, I see it is the same: ~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ --version --> output: avr-g++ (GCC) 7.3.0

Godbolt seems to think the latest AVR gcc version is 13.1.0: https://godbolt.org/z/z1a386vc1

@ElectricRCAircraftGuy ElectricRCAircraftGuy changed the title C11 _Atomic and C++11 std::atomic<> types not supported--will they ever be? (update avr-gcc?) C11 _Atomic and C++11 std::atomic<> types not supported--will they ever be? (Arduino needs to update their version of avr-gcc?) May 10, 2023
@matthijskooijman
Copy link
Collaborator

Will the 8-bit AVRs ever support this?

For that, I think avr-gcc should be compiled with libstdc++, see #89 for that. I'm not sure if libstdc++ on AVR already has support for atomic, though, since AFAIK nobody (at least not Arduino and I think also not atmel) builds libstdc++ for AVR, so it probably has some bitrot and lack of testing / demand, but I've seen some reports of people compiling it succesfully (see #89 for links).

Godbolt seems to think the latest AVR gcc version is 13.1.0: https://godbolt.org/z/z1a386vc1

I guess the latest gcc can just be compiled for avr, but the arduino version applies patches from atmel, which were often very much behind (I haven't checked current status, though).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants