GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
openmp

OpenMP: Simplify error reporting for 'device_type(nohost)'

Streamlines GOMP_error calls in OpenMP offloading code generation.

This commit simplifies the OpenMP compiler’s handling of the device_type(nohost) clause when targeting offload devices. It refactors the code generation logic in gimplify.cc to use helper functions like build_string_literal and build_int_cst for constructing error messages and values. This change also adjusts related test cases for accuracy, making the code cleaner and easier to maintain.

In Details

In the context of OpenMP offloading, device_type(nohost) specifies that the target device is not the host. This commit simplifies the GIMPLE tree construction for error reporting when this clause is encountered during gimplify_omp_workshare. It replaces direct string and integer constant building with helper functions, making the code cleaner and ensuring consistency. Corresponding test cases have been adjusted to reflect these changes in representation.

For Context
OpenMP
An API that supports multi-platform shared-memory parallel programming in C, C++, and Fortran, consisting of a set of compiler directives, library routines, and environment variables.
Offloading
A feature in OpenMP that allows parts of a program to be executed on a separate accelerator device (like a GPU) instead of the main CPU.
GIMPLE
A three-address intermediate representation used by GCC. It's designed to simplify many optimizations compared to RTL (Register Transfer Language).
Clause
A directive-specific option that modifies the behavior of an OpenMP construct. 'device_type(nohost)' is an example of a clause.
Filed Under: openmpoffloading