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

Previous Next

Package: grep;

Reported by: Dennis Clarke <dclarke <at> blastwave.org>

Date: Sun, 28 Aug 2016 03:43:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 24323-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Dennis Clarke <dclarke <at> blastwave.org>, 24323-done <at> debbugs.gnu.org
Subject: Re: bug#24323: "regcomp.c", line 467: error: syntax error before or
 at: preg
Date: Sun, 28 Aug 2016 12:58:39 -0700
[Message part 1 (text/plain, inline)]
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.
[0001-build-update-gnulib-submodule-to-latest.patch (text/x-diff, attachment)]

This bug report was last modified 8 years and 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.