This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/14632] New: regcomp function does not return 0 for invalid regular expression


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]