Skip to content

Conversation

@MichaelChirico
Copy link
Member

Searched the sources:

grep -Er "const\b.*[*]\w+\s*=\s*[A-Z]+([^OR]|[^A]R)[(]" src

This is some low-hanging fruit in terms of better use of read-only accessors. There will be other cases where we can make the change to a const pointer as well, but those can't be identified with a simple regex.

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.02%. Comparing base (e13ea60) to head (9b034c8).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7611      +/-   ##
==========================================
- Coverage   99.02%   99.02%   -0.01%     
==========================================
  Files          87       87              
  Lines       16903    16890      -13     
==========================================
- Hits        16739    16726      -13     
  Misses        164      164              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Jan 20, 2026

No obvious timing issues in HEAD=ro-access
Comparison Plot

Generated via commit 9b034c8

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 3 minutes and 0 seconds
Installing different package versions 43 seconds
Running and plotting the test cases 4 minutes and 26 seconds

@MichaelChirico
Copy link
Member Author

Another big class of cases where we could switch to _RO are call sites like INTEGER(x)[k] -- once we do [ to the output, we know we're only reading from x.

There are roughly 240 such sites (grep -Er "(INTEGER|LOGICAL|REAL|COMPLEX|RAW)[(]\w+[)]\[[^=]*$"), I just suspect it's not worth it to change them.

@MichaelChirico
Copy link
Member Author

I see this has some (or total) overlap with #7394. I think it's good to break out the changes into minimally-digestible parts -- here we focus only on const <type> *<var> = <writeable>(x) --> const <type> *<var> = <read-only>(x).

@ben-schwen
Copy link
Member

Should we add an accessor for integer64?

#define INTEGER64_RO(x)	((const int64_t *) DATAPTR_RO(x))

@MichaelChirico
Copy link
Member Author

Should we add an accessor for integer64?

#define INTEGER64_RO(x)	((const int64_t *) DATAPTR_RO(x))

Good point, though I think out of scope -- #7618

Co-authored-by: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com>
@aitap
Copy link
Member

aitap commented Jan 22, 2026 via email

MichaelChirico and others added 4 commits January 23, 2026 11:27
Co-authored-by: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com>
Keep the casts because they are currently necessary for the integer64 case.
@ben-schwen ben-schwen merged commit 293f3b0 into master Jan 24, 2026
13 checks passed
@ben-schwen ben-schwen deleted the ro-access branch January 24, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants