Skip to content

fix: replace STRING_PTR with STRING_PTR_RO for R-devel compatibility#192

Merged
gladkia merged 2 commits into
mainfrom
GDR-3367
Apr 27, 2026
Merged

fix: replace STRING_PTR with STRING_PTR_RO for R-devel compatibility#192
gladkia merged 2 commits into
mainfrom
GDR-3367

Conversation

@gladkia
Copy link
Copy Markdown
Contributor

@gladkia gladkia commented Apr 27, 2026

Description

What changed?

  • replace STRING_PTR with STRING_PTR_RO in src/gDRcore.cpp

Related JIRA issue: GDR-3367

Why was it changed?

STRING_PTR was removed from the R C API in R-devel (Bioc 3.23).
Linux build on Bioconductor failed with "STRING_PTR was not declared in this scope".
macOS build was unaffected. Fix uses STRING_PTR_RO (read-only access) with
const_cast where in-place sorting requires mutable iterators.

Checklist for sustainable code base

  • I added tests for any code changed/added
  • I added documentation for any code changed/added
  • I made sure naming of any new functions is self-explanatory and consistent

Logistic checklist

  • Package version bumped
  • Changelog updated

@gladkia gladkia requested a review from a team as a code owner April 27, 2026 10:54
@gladkia gladkia requested review from bczech and darsoo and removed request for a team April 27, 2026 10:54
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates gDRcore to version 1.9.8 and addresses C++ compilation errors on R-devel by transitioning from STRING_PTR to STRING_PTR_RO. A critical review comment identifies that using const_cast to sort a pointer from STRING_PTR_RO is unsafe in the R C API, particularly with ALTREP objects, and recommends using a temporary buffer with SET_STRING_ELT instead.

Comment thread src/gDRcore.cpp Outdated
const_cast on STRING_PTR_RO pointer is UB for ALTREP objects —
the backing store may be read-only memory. Copy through a temporary
vector and write back via SET_STRING_ELT (official write-barrier API).
@gladkia gladkia merged commit 2b119f9 into main Apr 27, 2026
3 of 4 checks passed
@gladkia gladkia deleted the GDR-3367 branch April 27, 2026 14:44
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

Successfully merging this pull request may close these issues.

3 participants