This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14632] New: regcomp function does not return 0 for invalid regular expression
- From: "jas at cs dot yorku dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Mar 2004 14:45:20 -0000
- Subject: [Bug c/14632] New: regcomp function does not return 0 for invalid regular expression
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
A few tests using regcomp indicate that it is not returning 0 for an invalid
regular expression. For example:
#include <stdio.h>
#include <sys/types.h>
#include <regex.h>
main()
{
regex_t re;
int x;
x = regcomp(&re, "(", 0);
printf("%d\n",x);
}
Run this, x is 0.
if I set the regexp to "*", x is 0 (the man page describes the error code
REG_BADRPT as "Invalid use of repetition operators such as using `*' as the
first character.)
if I set the regexp to "**" or even "((", x is 0.
In fact, I can't input a regular expression that has x return anything other than 0.
Comments?
--
Summary: regcomp function does not return 0 for invalid regular
expression
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jas at cs dot yorku dot ca
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14632