pioasm: Throw syntax_error for unsupported 'rel' with irq prev/next #2854

Merged
gonzalolarralde merged 1 commit from gonzalolarralde/fix-pioasm-segfault into develop 2026-04-05 13:10:00 -05:00
gonzalolarralde commented 2026-03-08 13:17:28 -05:00 (Migrated from github.com)

Replaces error() with throw syntax_error when rel is used with irq prev or irq next instructions in parser.yy. Without this fix the compiler will segfault instead of throw an error when trying to compile the following inputs:

.program irq_next_rel
.pio_version 1
    irq next set 0 rel
.program irq_prev_rel
.pio_version 1
    irq prev set 0 rel

Before this fix:

% ./bazel-bin/tools/pioasm/pioasm /var/folders/44/bgmj54wj15vbrvzxnp57kk2w0000gn/T/tmp.LC5BPmyQJb
/var/folders/44/bgmj54wj15vbrvzxnp57kk2w0000gn/T/tmp.LC5BPmyQJb:3.20-22: 'rel' is not supported for 'irq prev'
    3 |     irq prev set 0 rel
      |                    ^~~
zsh: segmentation fault  ./bazel-bin/tools/pioasm/pioasm 

After the fix:

% ./bazel-bin/tools/pioasm/pioasm /var/folders/44/bgmj54wj15vbrvzxnp57kk2w0000gn/T/tmp.LC5BPmyQJb
/var/folders/44/bgmj54wj15vbrvzxnp57kk2w0000gn/T/tmp.LC5BPmyQJb:3.20-22: 'rel' is not supported for 'irq prev'
    3 |     irq prev set 0 rel
      |                    ^~~
Replaces error() with throw syntax_error when `rel` is used with `irq prev` or `irq next` instructions in parser.yy. Without this fix the compiler will segfault instead of throw an error when trying to compile the following inputs: ``` .program irq_next_rel .pio_version 1 irq next set 0 rel ``` ``` .program irq_prev_rel .pio_version 1 irq prev set 0 rel ``` Before this fix: ``` % ./bazel-bin/tools/pioasm/pioasm /var/folders/44/bgmj54wj15vbrvzxnp57kk2w0000gn/T/tmp.LC5BPmyQJb /var/folders/44/bgmj54wj15vbrvzxnp57kk2w0000gn/T/tmp.LC5BPmyQJb:3.20-22: 'rel' is not supported for 'irq prev' 3 | irq prev set 0 rel | ^~~ zsh: segmentation fault ./bazel-bin/tools/pioasm/pioasm ``` After the fix: ``` % ./bazel-bin/tools/pioasm/pioasm /var/folders/44/bgmj54wj15vbrvzxnp57kk2w0000gn/T/tmp.LC5BPmyQJb /var/folders/44/bgmj54wj15vbrvzxnp57kk2w0000gn/T/tmp.LC5BPmyQJb:3.20-22: 'rel' is not supported for 'irq prev' 3 | irq prev set 0 rel | ^~~ ```
kilograham (Migrated from github.com) approved these changes 2026-04-05 13:09:50 -05:00
kilograham (Migrated from github.com) left a comment

nice, thanks

nice, thanks
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!2854
No description provided.