UW 713UP3 patch

Started by Larry Rosenmanover 22 years ago15 messagespatches
Jump to latest
#1Larry Rosenman
ler@lerctr.org

Since peter objects to my methods, what is an ACCEPTABLE way to detect
the 7.1.3UP3 compiler?

I'd like to get this fixed for RC1.

LER

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Larry Rosenman (#1)
Re: UW 713UP3 patch

Larry Rosenman writes:

Since peter objects to my methods, what is an ACCEPTABLE way to detect
the 7.1.3UP3 compiler?

One POSSIBLE way to do this properly is to write a test that

1) Uses $CC, $CFLAGS, and related variables rather than hardcoding 'cc -O'.

2) Names any test files conftest.*, so configure cleans up automatically.

3) Doesn't execute any compiled programs. See the __FAST_MATH__ test for
an example.

However, I still think that we should not bother testing for this.
Considering that the condition first occurred a couple of months ago and
is already fixed, this isn't a big issue. Think about what would happen
if we had to develop and maintain fixes for every buggy GCC compiler every
released.

--
Peter Eisentraut peter_e@gmx.net

#3Larry Rosenman
ler@lerctr.org
In reply to: Peter Eisentraut (#2)
Re: UW 713UP3 patch

--On Sunday, November 02, 2003 22:26:40 +0100 Peter Eisentraut
<peter_e@gmx.net> wrote:

Larry Rosenman writes:

Since peter objects to my methods, what is an ACCEPTABLE way to detect
the 7.1.3UP3 compiler?

One POSSIBLE way to do this properly is to write a test that

1) Uses $CC, $CFLAGS, and related variables rather than hardcoding 'cc
-O'.

2) Names any test files conftest.*, so configure cleans up automatically.

3) Doesn't execute any compiled programs. See the __FAST_MATH__ test for
an example.

However, I still think that we should not bother testing for this.
Considering that the condition first occurred a couple of months ago and
is already fixed, this isn't a big issue. Think about what would happen
if we had to develop and maintain fixes for every buggy GCC compiler every
released.

The problem is MOST people will **NOT** be able to get the fixed compiler
as it's on the Upgrade Pack path (PAY FOR), and **NOT** the Maintenance
Pack path (Free).

I'll try and write the patch as you suggest.

--
Peter Eisentraut peter_e@gmx.net

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

#4Larry Rosenman
ler@lerctr.org
In reply to: Larry Rosenman (#3)
Re: UW 713UP3 patch

--On Sunday, November 02, 2003 15:29:37 -0600 Larry Rosenman
<ler@lerctr.org> wrote:

I'll try and write the patch as you suggest.

Here's a patch as you suggested:

Index: src/template/unixware
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/template/unixware,v
retrieving revision 1.27
diff -u -r1.27 unixware
--- src/template/unixware	25 Oct 2003 15:32:11 -0000	1.27
+++ src/template/unixware	2 Nov 2003 21:53:33 -0000
@@ -1,13 +1,27 @@
 if test "$GCC" = yes; then
   THREAD_CPPFLAGS="-pthread"
 else
-# the -Kno_host is temporary for a bug in the compiler.  See -hackers
+# the -Kno_host is for a bug in the compiler.  See -hackers
 # discussion on 7-8/Aug/2003.
-# when the 7.1.3UP3 or later compiler is out, we can do a version check.
-  CFLAGS="-O -Kinline,no_host"
+# version check for the 7.1.3UP3 compiler (version 401200310):
+cat >conftest.c <<__EOF__
+int main(int argc, char **argv)
+#if __SCO_VERSION__ >= 401200310
+#error good compiler
+#else
+#error bad compiler
+#endif
+__EOF__
+  $CC conftest.c 2>conftest.err 1>&2
+  grep -q good conftest.err
+  if test $? = 0; then
+    CFLAGS="-O -Kinline"
+  else
+    CFLAGS="-O -Kinline,no_host"
+  fi
+  rm conftest.*
   THREAD_CPPFLAGS="-K pthread"
 fi
-
 THREAD_SUPPORT=yes
 NEED_REENTRANT_FUNCS=no		# verified 7.1.3 2003-09-03
 THREAD_CPPFLAGS="$THREAD_CPPFLAGS -D_REENTRANT"

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

Attachments:

unixware.up3.patch2application/octet-stream; name=unixware.up3.patch2Download+18-4
#5Peter Eisentraut
peter_e@gmx.net
In reply to: Larry Rosenman (#3)
Re: UW 713UP3 patch

Larry Rosenman writes:

The problem is MOST people will **NOT** be able to get the fixed compiler
as it's on the Upgrade Pack path (PAY FOR), and **NOT** the Maintenance
Pack path (Free).

Why did they upgrade to the broken compiler in the first place, and why
doesn't SCO provide free fixes for broken products?

--
Peter Eisentraut peter_e@gmx.net

#6Larry Rosenman
ler@lerctr.org
In reply to: Peter Eisentraut (#5)
Re: UW 713UP3 patch

--On Sunday, November 02, 2003 23:05:21 +0100 Peter Eisentraut
<peter_e@gmx.net> wrote:

Larry Rosenman writes:

The problem is MOST people will **NOT** be able to get the fixed compiler
as it's on the Upgrade Pack path (PAY FOR), and **NOT** the Maintenance
Pack path (Free).

Why did they upgrade to the broken compiler in the first place, and why
doesn't SCO provide free fixes for broken products?

The "Broken Compiler" is in EVERY version prior to the UP3 compiler. We
just started tripping it with the changes in 7.4.

I don't know why they didn't/haven't put this fix in the MP path, and I
can't change that decision, therefore, we need to work around it.

It's not that big of a deal. See the patch I posted that SHOULD meet your
requirements.

--
Peter Eisentraut peter_e@gmx.net

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Larry Rosenman (#4)
Re: UW 713UP3 patch

Larry Rosenman <ler@lerctr.org> writes:

+# version check for the 7.1.3UP3 compiler (version 401200310):
+cat >conftest.c <<__EOF__
+int main(int argc, char **argv)
+#if __SCO_VERSION__ >=3D 401200310
+#error good compiler
+#else
+#error bad compiler
+#endif
+__EOF__
+  $CC conftest.c 2>conftest.err 1>&2
+  grep -q good conftest.err
+  if test $? =3D 0; then
+    CFLAGS=3D"-O -Kinline"
+  else
+    CFLAGS=3D"-O -Kinline,no_host"
+  fi

Couldn't this be simplified to

+cat >conftest.c <<__EOF__
+int main(int argc, char **argv)
+{
+#if __SCO_VERSION__ < 401200310
+#error bad compiler
+#endif
+}
+__EOF__
+  $CC conftest.c >/dev/null 2>&1
+  if test $? = 0; then
+    CFLAGS="-O -Kinline"
+  else
+    CFLAGS="-O -Kinline,no_host"
+  fi

regards, tom lane

#8Larry Rosenman
ler@lerctr.org
In reply to: Tom Lane (#7)
Re: UW 713UP3 patch

--On Sunday, November 02, 2003 18:17:26 -0500 Tom Lane <tgl@sss.pgh.pa.us>
wrote:

Larry Rosenman <ler@lerctr.org> writes:

+# version check for the 7.1.3UP3 compiler (version 401200310):
+cat >conftest.c <<__EOF__
+int main(int argc, char **argv)
+#if __SCO_VERSION__ >=3D 401200310
+#error good compiler
+#else
+#error bad compiler
+#endif
+__EOF__
+  $CC conftest.c 2>conftest.err 1>&2
+  grep -q good conftest.err
+  if test $? =3D 0; then
+    CFLAGS=3D"-O -Kinline"
+  else
+    CFLAGS=3D"-O -Kinline,no_host"
+  fi

Couldn't this be simplified to

+cat >conftest.c <<__EOF__
+int main(int argc, char **argv)
+{
+#if __SCO_VERSION__ < 401200310
+#error bad compiler
+#endif
+}
+__EOF__
+  $CC conftest.c >/dev/null 2>&1
+  if test $? = 0; then
+    CFLAGS="-O -Kinline"
+  else
+    CFLAGS="-O -Kinline,no_host"
+  fi

regards, tom lane

How about this? ( I needed to make it valid C):

Index: src/template/unixware
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/template/unixware,v
retrieving revision 1.27
diff -u -r1.27 unixware
--- src/template/unixware	25 Oct 2003 15:32:11 -0000	1.27
+++ src/template/unixware	2 Nov 2003 23:22:21 -0000
@@ -1,13 +1,27 @@
 if test "$GCC" = yes; then
   THREAD_CPPFLAGS="-pthread"
 else
-# the -Kno_host is temporary for a bug in the compiler.  See -hackers
+# the -Kno_host is for a bug in the compiler.  See -hackers
 # discussion on 7-8/Aug/2003.
-# when the 7.1.3UP3 or later compiler is out, we can do a version check.
-  CFLAGS="-O -Kinline,no_host"
+# version check for the 7.1.3UP3 compiler (version 401200310):
+cat >conftest.c <<__EOF__
+#if __SCO_VERSION__ < 401200310
+#error bad compiler
+#endif
+int main(int argc,char **argv)
+{
+}
+
+__EOF__
+  $CC conftest.c >/dev/null 2>&1
+  if test $? = 0; then
+    CFLAGS="-O -Kinline"
+  else
+    CFLAGS="-O -Kinline,no_host"
+  fi
+  rm conftest.*
   THREAD_CPPFLAGS="-K pthread"
 fi
-
 THREAD_SUPPORT=yes
 NEED_REENTRANT_FUNCS=no		# verified 7.1.3 2003-09-03
 THREAD_CPPFLAGS="$THREAD_CPPFLAGS -D_REENTRANT"

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

Attachments:

unixware.up3.patch3application/octet-stream; name=unixware.up3.patch3Download+18-4
#9Larry Rosenman
ler@lerctr.org
In reply to: Larry Rosenman (#8)
Re: UW 713UP3 patch

--On Sunday, November 02, 2003 17:23:59 -0600 Larry Rosenman
<ler@lerctr.org> wrote:

--On Sunday, November 02, 2003 18:17:26 -0500 Tom Lane
<tgl@sss.pgh.pa.us> wrote:

Larry Rosenman <ler@lerctr.org> writes:

+# version check for the 7.1.3UP3 compiler (version 401200310):
+cat >conftest.c <<__EOF__
+int main(int argc, char **argv)
+#if __SCO_VERSION__ >=3D 401200310
+#error good compiler
+#else
+#error bad compiler
+#endif
+__EOF__
+  $CC conftest.c 2>conftest.err 1>&2
+  grep -q good conftest.err
+  if test $? =3D 0; then
+    CFLAGS=3D"-O -Kinline"
+  else
+    CFLAGS=3D"-O -Kinline,no_host"
+  fi

Couldn't this be simplified to

+cat >conftest.c <<__EOF__
+int main(int argc, char **argv)
+{
+#if __SCO_VERSION__ < 401200310
+#error bad compiler
+#endif
+}
+__EOF__
+  $CC conftest.c >/dev/null 2>&1
+  if test $? = 0; then
+    CFLAGS="-O -Kinline"
+  else
+    CFLAGS="-O -Kinline,no_host"
+  fi

regards, tom lane

How about this? ( I needed to make it valid C):

OOOPPPSS. Yes, Tom, yours will work just fine.

I missed the fact that you put the #if inside the braces.

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

#10Peter Eisentraut
peter_e@gmx.net
In reply to: Larry Rosenman (#4)
Re: UW 713UP3 patch

Larry Rosenman writes:

I'll try and write the patch as you suggest.

Here's a patch as you suggested:

Isn't there a way to write a test that actually triggers the bug we're
trying to work around?

--
Peter Eisentraut peter_e@gmx.net

#11Larry Rosenman
ler@lerctr.org
In reply to: Peter Eisentraut (#10)
Re: UW 713UP3 patch

--On Monday, November 03, 2003 23:24:19 +0100 Peter Eisentraut
<peter_e@gmx.net> wrote:

Larry Rosenman writes:

I'll try and write the patch as you suggest.

Here's a patch as you suggested:

Isn't there a way to write a test that actually triggers the bug we're
trying to work around?

Not that I'm aware of (it was the following entry from
SCO's fix list:
141. A bug was repaired in which an inlined function call, having been
passed a null pointer, would trigger an internal C compiler error when
this parameter was the target of a strcpy() or strncpy() call.
fz528141

If you want to write a test, fine, but I think I've done my part which is
report the bug to SCO, get a fix released, and then change our stuff to
detect it.

See the discussion referenced in the template file (7-8/AUG/2003 on
-Hackers).

--
Peter Eisentraut peter_e@gmx.net

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

#12Larry Rosenman
ler@lerctr.org
In reply to: Peter Eisentraut (#10)
Re: UW 713UP3 patch

--On Monday, November 03, 2003 23:24:19 +0100 Peter Eisentraut
<peter_e@gmx.net> wrote:

Larry Rosenman writes:

I'll try and write the patch as you suggest.

Here's a patch as you suggested:

Isn't there a way to write a test that actually triggers the bug we're
trying to work around?

Here is what the SCO Folks said when I reported this back in August:

You can reduce the example down to

extern char *strcpy(char *, const char *);

static void f(char *p, int n){
strcpy(p+n,"");
}
void g(void){
f(0, 0);
}

compile with cc -O -Kinline

that will trip it.

I still think that using the __SCO_VERSION__ preprocessor symbol is the
better idea.

--
Peter Eisentraut peter_e@gmx.net

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

#13Peter Eisentraut
peter_e@gmx.net
In reply to: Larry Rosenman (#12)
Re: UW 713UP3 patch

Larry Rosenman writes:

You can reduce the example down to

extern char *strcpy(char *, const char *);

static void f(char *p, int n){
strcpy(p+n,"");
}
void g(void){
f(0, 0);
}

compile with cc -O -Kinline

I've installed a test based on this and checked off UnixWare on the
supported platforms list.

--
Peter Eisentraut peter_e@gmx.net

#14Bruce Momjian
bruce@momjian.us
In reply to: Peter Eisentraut (#13)
Re: UW 713UP3 patch

Peter Eisentraut wrote:

Larry Rosenman writes:

You can reduce the example down to

extern char *strcpy(char *, const char *);

static void f(char *p, int n){
strcpy(p+n,"");
}
void g(void){
f(0, 0);
}

compile with cc -O -Kinline

I've installed a test based on this and checked off UnixWare on the
supported platforms list.

Another idea would have been to just grep the include file for the
version define. :-)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#15Larry Rosenman
ler@lerctr.org
In reply to: Bruce Momjian (#14)
Re: UW 713UP3 patch

--On Wednesday, November 05, 2003 04:23:35 -0500 Bruce Momjian
<pgman@candle.pha.pa.us> wrote:

Peter Eisentraut wrote:

Larry Rosenman writes:

You can reduce the example down to

extern char *strcpy(char *, const char *);

static void f(char *p, int n){
strcpy(p+n,"");
}
void g(void){
f(0, 0);
}

compile with cc -O -Kinline

I've installed a test based on this and checked off UnixWare on the
supported platforms list.

Another idea would have been to just grep the include file for the
version define. :-)

It's not in an include, it's done automagiclly by the compiler.

LER

--
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 359-1001
+  If your life is a hard drive,     |  13 Roberts Road
+  Christ can be your backup.        |  Newtown Square, Pennsylvania
19073

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749