[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
suspect error in regex.c
From: |
Francesco Potorti` |
Subject: |
suspect error in regex.c |
Date: |
Thu, 05 Sep 2002 17:32:45 +0200 |
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.
- suspect error in regex.c,
Francesco Potorti` <=