Skip to content

Conversation

shadiramadan
Copy link

@shadiramadan shadiramadan commented Sep 21, 2025

Description

Without the volatile keyword clang complains- volatile ensures this statement is not optimized out. My builds succeed after this change.

Clang error (before volatile keyword)

espressif__esp_hosted/common/utils/esp_hosted_cli.c:203:2: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
  203 |         *(int *) (0x0) = 0;

Testing

Passing gcc/clang builds.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Without the volatile keyword clang complains- volatile ensures this statement is not optimized out.  My builds succeed after this change.

espressif__esp_hosted/common/utils/esp_hosted_cli.c:203:2: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
  203 |         *(int *) (0x0) = 0;
@Copilot Copilot AI review requested due to automatic review settings September 21, 2025 20:01
@CLAassistant
Copy link

CLAassistant commented Sep 21, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a clang compiler warning by adding the volatile keyword to a null pointer dereference in a crash handler function. The change ensures that the intentional crash statement is not optimized away by the compiler.

  • Adds volatile qualifier to the null pointer cast in the crash handler
  • Resolves clang compiler error -Werror,-Wnull-dereference
  • Maintains the intentional crash behavior while satisfying compiler requirements

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

2 participants