Subject: bug#24074: bug#24094: 25.1.50; revert-buffer error in CC mode

From: Richard Copley <[email-masked]>
Date: Fri, 29 Jul 2016 19:41:39 +0100

On 29 July 2016 at 19:29, Óscar Fuentes <[email-masked]> wrote:
> Alan Mackenzie <[email-masked]> writes:
>
>> Could you be a bit more descriptive about the "chunks" that are missing,
>> please?  Are we talking about lots of isolated 2-character chunks, or
>> just one or two larger chunks, or what?  Are the chunks at the end of a
>> buffer, or in the "middle" of it?
>
> It just happened again here. The missing chunk is everything below the
> first 9 lines (the file has ~400 lines). Those preserved lines are
> simply #include's. The final preserved line was truncated to
>
> #include <
>
> The original was
>
> #include <string.h>
>
> Prior the revert, the point was much below that 9nth line.
>
> The reported failure is not always the same. In this case was:
>
> c-determine-+ve-limit: Args out of range: #<buffer rawmem.cpp>, -7246, -6746
>
>
> Or course, now that I'm trying to cause the error for obtaining an stack
> trace, it doesn't happen :-( As mentioned on my bug report, it seems
> that the problem is triggered when the point falls on certain places
> on the reverted file's contents, but that's just my guess.

Here is a recipe.

Prepare a file "test0.cpp" as follows: (<<END)
int main () {
  int a = 0;
  int b = 1;
  int c = 2;
  int d = 3;
}
END

In a shell: cp test0.cpp test.cpp
In Emacs: visit test.cpp, transpose "line b" and "line c", save the
buffer, and put point between the transposed lines (i.e., at the
beginning of "line b").
In the shell: cp test0.cpp test.cpp
In Emacs: revisit test.cpp (C-x f M-n RET).

I hope that helps.