Skip to content
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

Transmit power reading incorrect when compiling p2app with -O3 & -O2 flags #8

Open
dchristle opened this issue Aug 6, 2024 · 0 comments

Comments

@dchristle
Copy link
Contributor

dchristle commented Aug 6, 2024

There appears to be a concurrency bug in p2app that can be caused passing the -O3 or -O2 flags to gcc via the Makefile. These flags should let the compiler produce more optimized code, including by reordering instructions in a way it believes won't change the program semantics.

When connecting via Thetis v2.10.3.6 dev_3, if I transmit, the power reading meter shows 0W. If I recompile p2app without -O2 or -O3 (gcc will use -O1 by default) & run it, Thetis shows the correct transmit power.

This suggests there's a critical section that isn't synchronized somewhere, or some other undefined behavior that p2app is relying on when it shouldn't. We should fix it, since relying on the compiler to order things in a certain way is dangerous and it's only a matter of time before it crops up again in another setting. This also limits using -O2 and -O3, which we could use to produce more efficient executables.

@dchristle dchristle changed the title Transmit power reading incorrect when compiling p2app with -O3 flag Transmit power reading incorrect when compiling p2app with -O3 & -O2 flags Aug 7, 2024
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

1 participant