unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Check in src/intervals.c, offset_intervals
@ 2012-08-08 11:46 Dmitry Antipov
  2012-08-08 11:56 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Antipov @ 2012-08-08 11:46 UTC (permalink / raw)
  To: Emacs development discussions

If 'length' is of type ptrdiff_t, is it ever possible to hit abort in:

if (length < - TYPE_MAXIMUM (ptrdiff_t)) abort ();

Dmitry



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Check in src/intervals.c, offset_intervals
  2012-08-08 11:46 Check in src/intervals.c, offset_intervals Dmitry Antipov
@ 2012-08-08 11:56 ` Andreas Schwab
  2012-08-14  8:33   ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2012-08-08 11:56 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

Dmitry Antipov <dmantipov@yandex.ru> writes:

> If 'length' is of type ptrdiff_t, is it ever possible to hit abort in:
>
> if (length < - TYPE_MAXIMUM (ptrdiff_t)) abort ();

Unless length is TYPE_MINIMUM (ptrdiff_t) (but the length is never
supposed to be negative).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Check in src/intervals.c, offset_intervals
  2012-08-08 11:56 ` Andreas Schwab
@ 2012-08-14  8:33   ` Paul Eggert
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2012-08-14  8:33 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Dmitry Antipov, Emacs development discussions

On 08/08/2012 04:56 AM, Andreas Schwab wrote:

> Unless length is TYPE_MINIMUM (ptrdiff_t) (but the length is never
> supposed to be negative).

In that particular context, 'length' can be negative.

I don't think 'length' can be PTRDIFF_MIN there.  The IF_LINT test
pacifies "gcc -O2 -Werror=strict-overflow".  This warning flag is
problematic because it sometimes has false alarms (as
here) but it has found many bugs for me.  Perhaps
I should give up on that warning flag, in which case the
IF_LINT test can be removed.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-14  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-08 11:46 Check in src/intervals.c, offset_intervals Dmitry Antipov
2012-08-08 11:56 ` Andreas Schwab
2012-08-14  8:33   ` Paul Eggert

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).