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.
From 28bbd158919d5fabac2384a593b635f9054a8ba5 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sun, 28 Aug 2016 10:52:18 -0700
Subject: [PATCH] build: update gnulib submodule to latest

This should fix Bug#24323 reported by Dennis Clarke, where grep
does not build on Solaris 10 when compiled with Solaris Studio 12.4.
---
 gnulib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnulib b/gnulib
index b7bc3c1..bea6f3f 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit b7bc3c1a4e78add4cbad39ae1a0c4fb0747b483f
+Subproject commit bea6f3f8fc6ca3d5bc26e8fb651ecfcafa24115d
-- 
2.7.4

Reply via email to