From cd0451a7b77676c1be9cd9afe5d4405255b5921a Mon Sep 17 00:00:00 2001 From: RbPyer <67714233+RbPyer@users.noreply.github.com> Date: Tue, 17 Mar 2026 16:58:58 +0300 Subject: [PATCH] fix #26719 (#26720) * fix #26719 * add new tests for all arhcs --- vlib/v/gen/c/cgen.v | 3 + .../assembly/asm_empty_statement_test.v | 98 ++++++++++++++++++- 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 50ce327b0..2b69d19e1 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -3494,6 +3494,9 @@ fn (mut g Gen) asm_stmt(stmt ast.AsmStmt) { } g.writeln(' (') g.indent++ + if stmt.templates.len == 0 { + g.writeln('""') + } for template_tmp in stmt.templates { mut template := template_tmp g.write('"') diff --git a/vlib/v/slow_tests/assembly/asm_empty_statement_test.v b/vlib/v/slow_tests/assembly/asm_empty_statement_test.v index a441e6211..0b9b04fc4 100644 --- a/vlib/v/slow_tests/assembly/asm_empty_statement_test.v +++ b/vlib/v/slow_tests/assembly/asm_empty_statement_test.v @@ -1,8 +1,104 @@ // vtest build: !msvc -fn test_empty_asm_statements() { + +fn test_empty_inline_block() { + // must compile asm amd64 { + ; ; ; memory } + + asm volatile amd64 { + ; ; ; memory + } + + asm amd64 { + } + + asm volatile amd64 { + } + + asm arm64 { + ; ; ; memory + } + + asm volatile arm64 { + ; ; ; memory + } + asm arm64 { } + + asm volatile arm64 { + } + + asm i386 { + ; ; ; memory + } + + asm volatile i386 { + ; ; ; memory + } + + asm i386 { + } + + asm volatile i386 { + } + + asm rv64 { + ; ; ; memory + } + + asm volatile rv64 { + ; ; ; memory + } + + asm rv64 { + } + + asm volatile rv64 { + } + + asm loongarch64 { + ; ; ; memory + } + + asm volatile loongarch64 { + ; ; ; memory + } + + asm loongarch64 { + } + + asm volatile loongarch64 { + } + + asm ppc64le { + ; ; ; memory + } + + asm volatile ppc64le { + ; ; ; memory + } + + asm ppc64le { + } + + asm volatile ppc64le { + } + + asm s390x { + ; ; ; memory + } + + asm volatile s390x { + ; ; ; memory + } + + asm s390x { + } + + asm volatile s390x { + } + assert true } -- 2.39.5