GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
openmp

OpenMP: Fix error message for duplicate variants.

Corrects the error message when duplicate variants are declared in OpenMP.

This commit fixes an internal compiler error (ICE) that occurred when duplicate variants were declared in OpenMP code. The error message reporting the duplicate variant now correctly identifies the problematic code, resolving an issue introduced in a prior commit. A new test case has also been added to prevent regressions.

In Details

The omp-general.cc file handles general OpenMP code generation. The omp_check_for_duplicate_variant function verifies that variant declarations are unique. Due to a change in the internal tree representation, the code was using an incorrect tree node to construct the error message, leading to a crash. This commit corrects the tree used for the error message.

For Context

OpenMP is a parallel programming API that allows developers to easily write multi-threaded programs. The declare variant directive allows functions to have different implementations depending on the context. This commit fixes a bug in the compiler that caused it to crash when two declare variant directives for the same function were used. The error message is corrected, thus improving the developer experience.

Filed Under: openmpbugfixerror message