diff options
| author | xdBronch <51252236+xdBronch@users.noreply.github.com> | 2025-11-13 12:18:21 -0500 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-11-16 06:30:51 +0000 |
| commit | f6fecfdc001fa2fc3ee63ca344e419825a11f094 (patch) | |
| tree | 0d28849278487b0a8522326849b8cec42d6b08c7 /test/cases/compile_errors/astgen_assembly_errors.zig | |
| parent | d07360f99990497fdb72a888df257a94c9547b2f (diff) | |
| download | zig-f6fecfdc001fa2fc3ee63ca344e419825a11f094.tar.gz zig-f6fecfdc001fa2fc3ee63ca344e419825a11f094.zip | |
improve assembly error test coverage
Diffstat (limited to 'test/cases/compile_errors/astgen_assembly_errors.zig')
| -rw-r--r-- | test/cases/compile_errors/astgen_assembly_errors.zig | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/test/cases/compile_errors/astgen_assembly_errors.zig b/test/cases/compile_errors/astgen_assembly_errors.zig new file mode 100644 index 0000000000..968f5aa285 --- /dev/null +++ b/test/cases/compile_errors/astgen_assembly_errors.zig @@ -0,0 +1,97 @@ +comptime { + asm volatile (""); +} +comptime { + asm ("" + : [_] "" (-> u8), + ); +} +comptime { + asm ("" + : + : [_] "" (0), + ); +} +comptime { + asm ("" ::: .{}); +} +export fn a() void { + asm (""); +} +export fn b() void { + asm ("" + : [_] "" (-> u8), + [_] "" (-> u8), + ); +} +export fn c() void { + var out: u8 = 0; + asm ("" + : [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + [_] "" (out), + ); +} +export fn d() void { + asm volatile ("" + : + : [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + [_] "" (0), + ); +} + +// error +// +// :2:9: error: volatile is meaningless on global assembly +// :5:5: error: global assembly cannot have inputs, outputs, or clobbers +// :10:5: error: global assembly cannot have inputs, outputs, or clobbers +// :16:5: error: global assembly cannot have inputs, outputs, or clobbers +// :19:5: error: assembly expression with no output must be marked volatile +// :24:12: error: inline assembly allows up to one output value +// :46:12: error: too many asm outputs +// :84:12: error: too many asm inputs |
