bug-grep
[Top][All Lists]
Advanced

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

bug#24323: "regcomp.c", line 467: error: syntax error before or at: preg


From: Paul Eggert
Subject: bug#24323: "regcomp.c", line 467: error: syntax error before or at: preg
Date: Sun, 28 Aug 2016 12:58:39 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

I see the problem: the grep 2.25 tarball contains a regression from Gnulib that breaks compilation on some non-GCC compilers. Details below.

Dennis Clarke wrote:

it has Oracle Studio 12.4 on it.

Ah, that explains it. 12.4 c99 supports __restrict__ but not __restrict, and this runs afoul of a porting bug in grep 2.25, based on Gnulib commit b7bc3c1a4e78add4cbad39ae1a0c4fb0747b483f (2016-04-09), which contains a regression that causes regcomp.c to not build on (non-GCC) compilers that lack __restrict. After grep 2.25 came out, this regression was fixed in Gnulib commit 334d97f35cef30af0cf61c5eeaa0a67890a45578 (2016-06-08), which you can see here:

http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=334d97f35cef30af0cf61c5eeaa0a67890a45578

This Gnulib commit replaces __restrict with _Restrict_ in lib/regcomp.c, which fixes the regression. Applying this change to grep 2.25 should fix things for you.

I fixed the bug by installing the attached patch into the grep master branch on Savannah. This patch updates the Gnulib version to the current latest version, which pulls in the abovementioned bug fix.

If not trivial then change the CFLAGS and give up on ye
old -Xc strict compliance mode and switch to cc with -Xa and a pile of
other flags for my pedantic debugging mode needs :

mimas$ echo $CFLAGS
-m64 -xtarget=ultra2e -xarch=sparcvis -xchip=ultra2e -xcache=generic 
-errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff -m64 
-xmemalign=8s -xnolibmil -Xc -xcode=pic32 -xregs=no%appl -xlibmieee -mc -g -xs 
-ftrap=%none -Qy -xbuiltin=%none -xdebugformat=dwarf -xunroll=1 -D_TS_ERRNO 
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE

You might want to look here for new compiler options in 12.5:

https://docs.oracle.com/cd/E60778_01/html/E60742/gncki.html

Hold on a sec here ... are we re-writing the POSIX standard C library
 functions for some reason ?

Yes, as grep needs a regular expression matcher that works on data that can contain NUL bytes ('\0') and encoding errors. The POSIX API does not provide this, so grep supplies a substitute regex matcher on systems like Solaris that lack the extensions to POSIX that grep needs.

Attachment: 0001-build-update-gnulib-submodule-to-latest.patch
Description: Text Data


reply via email to

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