Landing: a6310d58aac5

Project / Subsystem

gcc / lto.cc

Date

2026-09-10

Author

Tobias Burnus

Commit

a6310d58aac505bdea37a6a0d6ab6b9593d01259

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
lto.cc
patch_id
—
commit_hash
a6310d58aac505bdea37a6a0d6ab6b9593d01259
source_type
github
headline
Fix OpenMP offload link variables for global variables.
tldr
Correctly handles OpenMP 'link' clause variables for global variables in LTO builds, preventing duplicate declarations and ensuring host/device consistency.
author
Tobias Burnus
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • openmp
  • • lto
  • • offload
discussion_id_link
—
bugzilla_pr
—
date
2026-09-10T00:00:00.000Z

This commit addresses issues with OpenMP’s declare target directive when used with global variables in link clauses, specifically within the LTO (Link-Time Optimization) process. It prevents redundant creation of device-side pointer variables (...$linkptr) by checking for existing VALUE_EXPRs and ensures that host and device symbols are correctly finalized and outputted by calling varpool_node::finalize_decl and using force_output.