https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95622
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org, | |rguenth at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Dunno, perhaps there is a better way than force_output, how exactly we represent void *refs[] __attribute__((used)) = { &var1, &var2, &var3 }; where we say the array can't be optimized away and thus the referenced vars can't be optimized away? Does that also prevent such an optimization? For these vars, all we want to ensure is that the vars aren't optimized away, but don't need to derive from that that some other code could be accessing those vars indirectly. Or, shall we support putting NULL (or some other magic value) into the tables on the host or offload side if those vars have been optimized away completely on the host (or offload) sides? At least when not doing the not yet supported offloading from offload device back to host, perhaps a variable optimized away completely on the host will mean we can't every lookup such variable's address and so nothing needs to be recorded in the splay trees. But, if something is completely unused on the offload side but used on the host side, one can still try to e.g. map those variables and should get the address of the device var even if it is otherwise unused.