https://gcc.gnu.org/g:35cc4cf0dbe812b1dc83586308262e35a00e21c4
commit 35cc4cf0dbe812b1dc83586308262e35a00e21c4 Author: Thomas Schwinge <tschwi...@baylibre.com> Date: Thu Feb 13 22:58:21 2025 +0100 nvptx: Clarify 'nvptx_output_skip' case of no or incomplete initializer I was getting confused about 'nvptx_output_skip' in certain cases not doing anything at all; write down and 'assert' what I found. gcc/ * config/nvptx/nvptx.cc (nvptx_output_skip): Clarify case of no or incomplete initializer. (cherry picked from commit 09b207bf26b9c79a43e1a346a4493d4b202b4ac5) Diff: --- gcc/ChangeLog.omp | 6 ++++++ gcc/config/nvptx/nvptx.cc | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 33e6e677d7b9..2bc4343b2235 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,5 +1,11 @@ 2025-02-18 Thomas Schwinge <tschwi...@baylibre.com> + Backported from trunk: + 2025-02-14 Thomas Schwinge <tschwi...@baylibre.com> + + * config/nvptx/nvptx.cc (nvptx_output_skip): Clarify case of + no or incomplete initializer. + Backported from trunk: 2025-02-08 Thomas Schwinge <tschwi...@baylibre.com> diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc index 3a55f6d5d64a..ef867daba3c5 100644 --- a/gcc/config/nvptx/nvptx.cc +++ b/gcc/config/nvptx/nvptx.cc @@ -2467,6 +2467,12 @@ nvptx_output_skip (FILE *, unsigned HOST_WIDE_INT size) if (size) nvptx_assemble_value (0, size); } + else + /* Otherwise, we don't have to do anything: this skip terminates the + initializer; we skip either the full ('!init_frag.started' case) or the + remainder ('init_frag.started' case) of the initializer (that is, either + no or incomplete initializer). */ + gcc_checking_assert (size == init_frag.remaining * init_frag.size); } /* Output a string STR with length SIZE. As in nvptx_output_skip we