* Problem report #5
@ 2006-04-09 6:59 Dan Nicolaescu
0 siblings, 0 replies; 4+ messages in thread
From: Dan Nicolaescu @ 2006-04-09 6:59 UTC (permalink / raw
ERROR
CID: 5
Checker: DEADCODE (help)
File: emacs/src/buffer.c
Function: recenter_overlay_lists
Description: Assigning "tail" to "prev"
3139 with some future change. */
Event assignment: Assigning "0" to "prev"
Event const: After this line, the value of "prev" is equal to 0
Also see events: [dead_error_line][dead_error_condition][const][const][assignment]
3140 prev = NULL;
Event const: After this line, the value of "prev" is equal to 0
Event assignment: Assigning "tail" to "prev"
Also see events: [dead_error_line][dead_error_condition][assignment][const][assignment]
3141 for (tail = buf->overlays_before; tail; prev = tail, tail = next)
3142 {
3143 next = tail->next;
3144 XSETMISC (overlay, tail);
3145
3146 /* If the overlay is not valid, get rid of it. */
3147 if (!OVERLAY_VALID (overlay))
3148 #if 1
3149 abort ();
3150 #else
3151 {
3152 /* Splice the cons cell TAIL out of overlays_before. */
3153 if (!NILP (prev))
3154 XCDR (prev) = next;
3155 else
3156 buf->overlays_before = next;
3157 tail = prev;
3158 continue;
3159 }
3160 #endif
3161
3162 beg = OVERLAY_START (overlay);
3163 end = OVERLAY_END (overlay);
3164
3165 if (OVERLAY_POSITION (end) > pos)
3166 {
3167 /* OVERLAY needs to be moved. */
3168 int where = OVERLAY_POSITION (beg);
3169 struct Lisp_Overlay *other, *other_prev;
3170
3171 /* Splice the cons cell TAIL out of overlays_before. */
Event dead_error_condition: On this path, the condition "prev != 0" could not be true
Also see events: [dead_error_line][assignment][const][const][assignment]
3172 if (prev)
Event dead_error_line: Cannot reach this line of code
Also see events: [dead_error_condition][assignment][const][const][assignment]
3173 prev->next = next;
3174 else
3175 buf->overlays_before = next;
3176
3177 /* Search thru overlays_after for where to put it. */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Problem report #5
@ 2006-04-11 15:49 Dan Nicolaescu
2006-04-11 17:22 ` Stuart D. Herring
0 siblings, 1 reply; 4+ messages in thread
From: Dan Nicolaescu @ 2006-04-11 15:49 UTC (permalink / raw
CID: 5
Checker: DEADCODE (help)
File: emacs/src/buffer.c
Function: recenter_overlay_lists
Description: Assigning "tail" to "prev"
Event assignment: Assigning "0" to "prev"
Event const: After this line, the value of "prev" is equal to 0
Also see events: [dead_error_line][dead_error_condition][const][const][assignment]
3140 prev = NULL;
Event const: After this line, the value of "prev" is equal to 0
Event assignment: Assigning "tail" to "prev"
Also see events: [dead_error_line][dead_error_condition][assignment][const][assignment]
3141 for (tail = buf->overlays_before; tail; prev = tail, tail = next)
3142 {
3143 next = tail->next;
3144 XSETMISC (overlay, tail);
3145
3146 /* If the overlay is not valid, get rid of it. */
3147 if (!OVERLAY_VALID (overlay))
3148 #if 1
3149 abort ();
3150 #else
3151 {
3152 /* Splice the cons cell TAIL out of overlays_before. */
3153 if (!NILP (prev))
3154 XCDR (prev) = next;
3155 else
3156 buf->overlays_before = next;
3157 tail = prev;
3158 continue;
3159 }
3160 #endif
3161
3162 beg = OVERLAY_START (overlay);
3163 end = OVERLAY_END (overlay);
3164
3165 if (OVERLAY_POSITION (end) > pos)
3166 {
3167 /* OVERLAY needs to be moved. */
3168 int where = OVERLAY_POSITION (beg);
3169 struct Lisp_Overlay *other, *other_prev;
3170
3171 /* Splice the cons cell TAIL out of overlays_before. */
Event dead_error_condition: On this path, the condition "prev != 0" could not be true
Also see events: [dead_error_line][assignment][const][const][assignment]
3172 if (prev)
Event dead_error_line: Cannot reach this line of code
Also see events: [dead_error_condition][assignment][const][const][assignment]
3173 prev->next = next;
3174 else
3175 buf->overlays_before = next;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem report #5
2006-04-11 15:49 Problem report #5 Dan Nicolaescu
@ 2006-04-11 17:22 ` Stuart D. Herring
2006-04-11 18:07 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Stuart D. Herring @ 2006-04-11 17:22 UTC (permalink / raw
> 3140 prev = NULL;
> 3141 for (tail = buf->overlays_before; tail; prev = tail, tail = next)
> 3142 {
> 3143 next = tail->next;
> 3144 XSETMISC (overlay, tail);
> 3145
> 3146 /* If the overlay is not valid, get rid of it. */
> 3147 if (!OVERLAY_VALID (overlay))
> [...]
> 3161
> 3162 beg = OVERLAY_START (overlay);
> 3163 end = OVERLAY_END (overlay);
> 3164
> 3165 if (OVERLAY_POSITION (end) > pos)
> 3166 {
> 3167 /* OVERLAY needs to be moved. */
> 3168 int where = OVERLAY_POSITION (beg);
> 3169 struct Lisp_Overlay *other, *other_prev;
> 3170
> 3171 /* Splice the cons cell TAIL out of overlays_before. */
>
> Event dead_error_condition: On this path, the condition "prev != 0" could
> not be true
> Also see events: [dead_error_line][assignment][const][const][assignment]
>
> 3172 if (prev)
It's true that tail is never 0 within the loop (loop test), and that on
every iteration but the first prev has been assigned tail, which wasn't 0
at the time of assignment. But on the first iteration, this test is
guaranteed to pass! No bug.
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem report #5
2006-04-11 17:22 ` Stuart D. Herring
@ 2006-04-11 18:07 ` Andreas Schwab
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2006-04-11 18:07 UTC (permalink / raw
Cc: emacs-devel
"Stuart D. Herring" <herring@lanl.gov> writes:
>> 3140 prev = NULL;
>> 3141 for (tail = buf->overlays_before; tail; prev = tail, tail = next)
>> 3142 {
>> 3143 next = tail->next;
>> 3144 XSETMISC (overlay, tail);
>> 3145
>> 3146 /* If the overlay is not valid, get rid of it. */
>> 3147 if (!OVERLAY_VALID (overlay))
>> [...]
>> 3161
>> 3162 beg = OVERLAY_START (overlay);
>> 3163 end = OVERLAY_END (overlay);
>> 3164
>> 3165 if (OVERLAY_POSITION (end) > pos)
>> 3166 {
>> 3167 /* OVERLAY needs to be moved. */
>> 3168 int where = OVERLAY_POSITION (beg);
>> 3169 struct Lisp_Overlay *other, *other_prev;
>> 3170
>> 3171 /* Splice the cons cell TAIL out of overlays_before. */
>>
>> Event dead_error_condition: On this path, the condition "prev != 0" could
>> not be true
>> Also see events: [dead_error_line][assignment][const][const][assignment]
>>
>> 3172 if (prev)
>
> It's true that tail is never 0 within the loop (loop test), and that on
> every iteration but the first prev has been assigned tail, which wasn't 0
> at the time of assignment. But on the first iteration, this test is
> guaranteed to pass! No bug.
The point is that prev can never get non-NULL because later prev (while
still being NULL) is assigned to tail, or else the loop is exited right
away in the false arm of the conditional in line 3165. But the comment
before the loop explains why it is written this way:
/* We don't strictly need prev in this loop; it should always be nil.
But we use it for symmetry and in case that should cease to be true
with some future change. */
So this is on purpose.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-04-11 18:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-11 15:49 Problem report #5 Dan Nicolaescu
2006-04-11 17:22 ` Stuart D. Herring
2006-04-11 18:07 ` Andreas Schwab
-- strict thread matches above, loose matches on Subject: below --
2006-04-09 6:59 Dan Nicolaescu
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).