GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
risc-v

RISC-V: Fix NULL pointer check in target attribute parser

Correctly checks for NULL pointer before dereferencing in RISC-V target attribute parser.

The RISC-V target attribute parser in GCC previously dereferenced a potentially NULL pointer when checking for architecture information. This commit modifies the parser to check if the pointer itself is NULL before attempting to dereference it, aligning with other diagnostic sites and preventing potential crashes.

In Details

The parse_arch function in riscv-target-attr.cc previously dereferenced m_loc unconditionally. This commit adds a if (m_loc) check to prevent a NULL pointer dereference when emitting diagnostics, ensuring robustness.

Filed Under: risc-vcompilerbugfix