AdaCore / AdaCore/Ada_Drivers_Library
Incorrect usage of 'Val instead of 'Enum_Val
Nobody has claimed this yet.
- Dominant language
- Ada
- Stars
- 286
- Forks
- 165
- PR merge metrics
- No merged PRs in 30d
Description
The below line will raise a Constraint_Error if Range_Check is enabled as the enumeration is not continuous, using 'Enum_Val instead would fix this. This error could exist in the other uses of 'Val which I have not checked and it could have potentially worse consequences than this one which will likely be harmless when Range_Check is disabled.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open arch/ARM/STM32/drivers/stm32-adc.adb at the linked line around 410 and inspect the use of 'Val with the non-contiguous enumeration. Check the other 'Val uses mentioned in the issue for the same problem; done means the unsafe conversion is corrected and no similar affected use remains.
Written by the indexing model from the issue text.
Assessment
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100