Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Incorrect const in pgm_read_ptr

Open
#96 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
embedded-iot

Research direction

Open cores/arduino/avr/pgmspace.h at the linked line and inspect the pgm_read_ptr macro and its callers. Verify the pointer-qualification behavior and compile the affected uses; the issue is done when the cast matches the intended read-only pointer semantics without breaking those uses.

Written by the indexing model from the issue text.

Description

There seems to be bug in macro pgm_read_ptr macro in the pgmspace.h header.

https://github.com/arduino/ArduinoCore-sam/blob/c893c62ec9953ed36a256b5243272fda2e473c14/cores/arduino/avr/pgmspace.h#L106

The cast to const void ** is incorrect, because it casts it to "a pointer to a pointer to a read-only object of any type".
I believe that the correct type would be void *const *, "a pointer to a read-only pointer to an object of any type". The pointer itself is in progmem, and therefore is read-only, but the pointee is not necessarily read-only, as it could be in static memory.

Discovered here: https://github.com/tttapa/Control-Surface/issues/64

Dominant language
HTML
Stars
91
Forks
112
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from arduino/ArduinoCore-sam

All issues in arduino/ArduinoCore-sam

Similar issues

More Embedded & IoT issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.