To: vim-dev@vim.org
Subject: Patch 6.0.160
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.0.160
Problem:    When compiling with GCC 3.0.2 and using the "-O2" argument, the
	    optimizer causes a problem that makes Vim crash.
Solution:   Add a configure check to avoid "-O2" for this version of gcc.
Files:	    src/configure.in, src/auto/configure


*** ../vim60.159/src/configure.in	Tue Jan 22 15:38:17 2002
--- src/configure.in	Tue Jan 22 19:46:56 2002
***************
*** 26,31 ****
--- 26,38 ----
    CFLAGS="-O"
    test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
  fi
+ if test "$GCC" = yes; then
+   gccversion=`"$CC" --version`
+   if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2"; then
+     echo 'GCC 3.0.x has a bug in the optimizer, disabling "-O#"'
+     CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
+   fi
+ fi
  
  dnl If configure thinks we are cross compiling, there is probably something
  dnl wrong with the CC or CFLAGS settings, give an understandable error message
*** ../vim60.159/src/auto/configure	Tue Jan 22 15:38:17 2002
--- src/auto/configure	Wed Jan 30 16:19:19 2002
***************
*** 1112,1117 ****
--- 1112,1124 ----
    CFLAGS="-O"
    test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
  fi
+ if test "$GCC" = yes; then
+   gccversion=`"$CC" --version`
+   if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2"; then
+     echo 'GCC 3.0.x has a bug in the optimizer, disabling "-O#"'
+     CFLAGS=`echo "$CFLAGS" | sed 's/-O[23456789]/-O/'`
+   fi
+ fi
  
  if test "$cross_compiling" = yes; then
    { echo "configure: error: cannot compile a simple program, check CC and CFLAGS
*** ../vim60.159/src/version.c	Fri Feb  1 20:15:57 2002
--- src/version.c	Fri Feb  1 20:16:14 2002
***************
*** 608,609 ****
--- 608,611 ----
  {   /* Add new patch number below this line */
+ /**/
+     160,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
150. You find yourself counting emoticons to get to sleep.

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
(((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///