[PUSHED] nvptx: Clarify 'nvptx_output_skip' case of no or incomplete initializer

Message ID 20250214213525.1342539-1-tschwinge@baylibre.com
State Committed
Commit 09b207bf26b9c79a43e1a346a4493d4b202b4ac5
Headers
Series [PUSHED] nvptx: Clarify 'nvptx_output_skip' case of no or incomplete initializer |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap fail Patch failed to apply
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Thomas Schwinge Feb. 14, 2025, 9:35 p.m. UTC
  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.
---
 gcc/config/nvptx/nvptx.cc | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 060f45318f4..6f364619205 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -2391,6 +2391,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