bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gawk] Attribute((pure)) with impure function causes test failures


From: Neil Cahill
Subject: [bug-gawk] Attribute((pure)) with impure function causes test failures
Date: Sun, 21 Aug 2011 20:47:21 +0100 (BST)

With the gawk-3.1.6 source bz2, gawk compiles incorrectly on my Gentoo system with gcc-4.4.5 -O2 -fno-inline.  This causes 4 tests to fail (eg. datanonl.awk), all related to character classes like /[[:alpha:]]/ not being recognized.

I tracked this down to the following function:

/* regex_internal.c */
static unsigned char
internal_function __attribute((pure))
re_string_fetch_byte_case(...)

This function modifies a value pstr->cur_idx which is also used in a macro (re_string_eoi).  Calling the macro after calling the function can mean an old value of cur_idx is used.  This happens in regcomp.c in the function parse_bracket_symbol, which caused those character classes to go unrecognized.

A simple fix is to remove the pure attribute from the function.  This seems to be present in 3.1.8 as well, as both exhibited the same problem.

Neil Cahill.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]