all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* suspect error in regex.c
@ 2002-09-05 15:32 Francesco Potorti`
  2002-09-08 12:54 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Francesco Potorti` @ 2002-09-05 15:32 UTC (permalink / raw)


I don't know how regex.c works, but this looks strange to me (I
discovered it because of a warning issued by MSVC on a report I got
about etags, which uses regex.c):

== src/regex.c ==

1837:typedef unsigned regnum_t;

in regex_compile:
2245:  regnum_t regnum = 0;
2847: 		COMPILE_STACK_TOP.regnum = shy ? -regnum : regnum;

Notice that an unsigned value is negated, then assigned to an unsigned
field.

later in regex_compile:
2897:		regnum_t this_group_regnum;
2906:		this_group_regnum = COMPILE_STACK_TOP.regnum;
2914:		if (this_group_regnum <= MAX_REGNUM && this_group_regnum > 0)

That is, the same unsigned value is compared against MAX_REGNUM and 0.
In principle, the code could be correct, but it does sound strange to me
that such a particular programming practice is not even commented.
Looks suspiciously like a bug to me.

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

end of thread, other threads:[~2002-09-09 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-05 15:32 suspect error in regex.c Francesco Potorti`
2002-09-08 12:54 ` Richard Stallman
2002-09-09 10:05   ` Francesco Potorti`

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.