Subject: bug#41853: 28.0.50; Peculiar "args out of range" error when using Edebug

From: Philipp Stephani <[email-masked]>
Date: Sun, 14 Jun 2020 17:20:14 +0200

Am So., 14. Juni 2020 um 16:23 Uhr schrieb Philipp Stephani
<[email-masked]>:
>
>
> This error is somewhat common when using `edebug-all-defuns'.  It's not
> easy to reproduce with a minimal example, but happens in real-world
> code.  For example, the following recipe works for me consistently:
>
> 1. Clone the Flycheck repository at commit
>    c02cd773dded0215f9417ec04dfe8dabda63ef43 (probably most other commits
>    also work, this is just for reproducibility).
>
> 2. Clone the dash.el repository at commit
>    ea4a4cc7cce7c3b93862a22df8bca8b83052ccbf (probably the exact commit
>    doesn't matter here as well).
>
> 3. Visit flycheck.el like so:
>
>    emacs -Q -L /src/dash.el/ -l edebug -f edebug-all-defuns \
>      -f toggle-debug-on-error flycheck.el
>
> 4. M-x eval-buffer
>
> 5. Step through macro expansions using the `G' key.  Repeat until
>    `eval-buffer' is complete or has signalled and error.
>
> 6. At some point, there will be an error
>
>    edebug--display: Args out of range: [66 86 129 138 139], 5
>
>    without invoking the debugger or backtrace.
>
> This looks like a bug in Edebug.
>

The immediate trigger appears to be that in `edebug-slow-after' for
`flycheck--checker-property-name' the AFTER-INDEX is out of range for
the EDEBUG-FREQ-COUNT vector.  I still don't understand why though;
there must be some part in edebug that misinstruments these forms.
The vector [66 86 129 138 139] is likely a vector of offsets, not
frequencies; the vector matches the setter for flycheck-checker-get
quite well. So maybe there's an issue with how edebug instruments
gv-define-setter?