Check pointers in Debug mode
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
The issue does not name implementation files, tests, or entry points. Start by locating Debug-mode runtime pointer handling in the compiler, then cover pointer association, dereference, and target scope exit; done means dangling pointers produce a runtime error instead of a segmentation fault.
Written by the indexing model from the issue text.
Description
Original issue: https://gitlab.com/lfortran/lfortran/-/issues/366
In Fortran a pointer can only point to a variable that has the target attribute. We should implement an option in Debug mode to check pointers to ensure they cannot segfault, here is how it would work:
- Each pointer will have a flag
dangling - Each time a pointer is dereferenced at runtime, we check the
danglingflag, if true, we give a nice runtime error - Each target variable will have a list of pointers that point to it
- Each time we associate a pointer with some target variable, we add the pointer to the target variable's list
- Each time a target variable goes out of scope, we go over the list of pointers and set their
danglingflag to true.
Thanks to the target attribute, the pointer list only has to be stored for those, and so the overhead should not be too large (and it's a Debug mode feature anyway).
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 271
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 173
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.
More from lfortran/lfortran
-
tests
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Cleanup: resolve_proc_pointer_placeholders re-resolves placeholders already in placeholder_to_real Openderived types
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
derived types
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
openmp
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
All issues in lfortran/lfortran
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·