-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Implement P2280R4 Using unknown pointers and references in constant expressions #63139
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
Labels
Comments
@llvm/issue-subscribers-clang-frontend |
@llvm/issue-subscribers-c-2b |
This was referenced Jun 6, 2023
Closed
Valve's Gamescope on git HEAD does not build anymore due to this error if my (limited) understanding is correct. GCC passes, Clang doesn't.
Full context: https://github.com/ValveSoftware/gamescope/blob/master/src/rc.h Tested on CachyOS (Arch) Linux, LLVM 19.0.0 1c683eb. (Workaround suggestions (besides switching compilers) appreciated) |
shafik
added a commit
to shafik/llvm-project
that referenced
this issue
Jul 17, 2024
…nstant expressions P2280R4 allows the use of references in pointers of unknown origins in a constant expression context but only in specific cases that could be constant expressions. We track whether a variable is a constexpr unknown in a constant expression by setting a flag in either APValue or LValue and using this flag to prevent using unknown values in places where it is not allowed. In `evaluateVarDeclInit` we may need to create a new `APValue` to track the unknown referene or pointer and we track that `APValue` in the `CallStackFrame`. Fixes: llvm#63139 llvm#63117
jktjkt
added a commit
to CESNET/velia
that referenced
this issue
Nov 19, 2024
On one board, the 3V3 channel was constantly measuring 3.406V. This was below our threshold, so I tried to identify what the actual standard tolerances are. In the ATX specification version 2.2 [1] (unofficial link because the official (?) formfactors.org now redirects to an Intel page which says nope, nothing here), all tolerances for positive voltages are specified as ±5%. Let's use that for the warning threshold everywhere (because this is a standard, anything that's within the allowed range is by definition OK). We also have to account for the tolerance of the actual measurement. The PSU's specification says [2, page 27] that (during our typical load, which fits into the 10%-20% range), the measurements have a ±5% tolerance. So it's "possible" that we have, say, a perfectly valid voltage of 5.25V (which is within 5% of the 5V target) measured by an inaccurate sensor, yielding a 5.5125V. This shall be our "critical" threshold. Let's wrap this in a shiny function as Tomas suggested. I also wanted to add something like: static_assert(nominal > hysteresis * 10, "these units look very suspicious"); ...but clang rejects this, probably due to [3]. TL;DR: a critical voltage alarm now means that the power is seriously hosed. A warning might still be a false positive when the tolerances are not aligned properly. [1] https://cdn.instructables.com/ORIG/FS8/5ILB/GU59Z1AT/FS85ILBGU59Z1AT.pdf [2] CzechLight/hw-docs, components/power/YH5151-1EB01R-Spec.pdf [3] llvm/llvm-project#63139 Change-Id: Iad2e06ede62d82b5b338e8486224d85850d7c018
github-actions bot
pushed a commit
to arm/arm-toolchain
that referenced
this issue
Jan 22, 2025
…ences in constant expressions (#95474) P2280R4 allows the use of references in pointers of unknown origins in a constant expression context but only in specific cases that could be constant expressions. We track whether a variable is a constexpr unknown in a constant expression by setting a flag in either APValue or LValue and using this flag to prevent using unknown values in places where it is not allowed. Fixes: llvm/llvm-project#63139 llvm/llvm-project#63117
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: