Patch 9.0.1517
Problem:    MacOS: configure removes -O2 from $CFLAGS.
Solution:   Only adjust $CFLAGS for gcc. (closes #12351)
Files:      src/configure.ac, src/auto/configure


*** ../vim-9.0.1516/src/configure.ac    2023-04-13 19:15:50.019391985 +0100
--- src/configure.ac    2023-05-06 18:02:21.887683986 +0100
***************
*** 93,106 ****
    CFLAGS="-O"
    test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall 
-Wno-deprecated-declarations"
  fi
  if test "$GCC" = yes; then
!   dnl method that should work for nearly all versions
    gccversion=`$CC -dumpversion`
    if test "x$gccversion" = "x"; then
      dnl old method; fall-back for when -dumpversion doesn't work
      gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 
's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
    fi
!   dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin 
Dalecki
    if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" 
= "4.0.1"; then
      echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
      CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
--- 93,111 ----
    CFLAGS="-O"
    test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall 
-Wno-deprecated-declarations"
  fi
+ 
  if test "$GCC" = yes; then
!   dnl Method that should work for nearly all gcc versions.
    gccversion=`$CC -dumpversion`
    if test "x$gccversion" = "x"; then
      dnl old method; fall-back for when -dumpversion doesn't work
      gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 
's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
    fi
! 
!   dnl Gcc version 4.0.1 was reported to cause trouble on Macintosh by Marcin
!   dnl Dalecki.  For Mac with Intel the symptom reported is: malloc() reports
!   dnl double free.  This happens in expand_filename(), because the optimizer
!   dnl swaps two blocks of code, both using "repl", that can't be swapped.
    if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" 
= "4.0.1"; then
      echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
      CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
***************
*** 299,312 ****
        with_x=no
       fi
    fi
- 
-   dnl Avoid a bug with -O2 with gcc 4.0.1.  Symptom: malloc() reports double
-   dnl free.  This happens in expand_filename(), because the optimizer swaps
-   dnl two blocks of code, both using "repl", that can't be swapped.
-   if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
-     CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
-   fi
- 
  else
    AC_MSG_RESULT(no)
  fi
--- 304,309 ----
*** ../vim-9.0.1516/src/auto/configure  2023-04-13 19:15:50.023391985 +0100
--- src/auto/configure  2023-05-06 18:02:52.739640327 +0100
***************
*** 4477,4488 ****
    CFLAGS="-O"
    test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall 
-Wno-deprecated-declarations"
  fi
  if test "$GCC" = yes; then
      gccversion=`$CC -dumpversion`
    if test "x$gccversion" = "x"; then
          gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 
's/^[^0-9]*\([0-9]\.[0-9.]*\).*$/\1/g'`
    fi
!     if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o 
"$gccversion" = "4.0.1"; then
      echo 'GCC [34].0.[12] has a bug in the optimizer, disabling "-O#"'
      CFLAGS=`echo "$CFLAGS" | sed 's/-O[23456789]/-O/'`
    else
--- 4477,4490 ----
    CFLAGS="-O"
    test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall 
-Wno-deprecated-declarations"
  fi
+ 
  if test "$GCC" = yes; then
      gccversion=`$CC -dumpversion`
    if test "x$gccversion" = "x"; then
          gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 
's/^[^0-9]*\([0-9]\.[0-9.]*\).*$/\1/g'`
    fi
! 
!           if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o 
"$gccversion" = "4.0.1"; then
      echo 'GCC [34].0.[12] has a bug in the optimizer, disabling "-O#"'
      CFLAGS=`echo "$CFLAGS" | sed 's/-O[23456789]/-O/'`
    else
***************
*** 4777,4787 ****
        with_x=no
       fi
    fi
- 
-         if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
-     CFLAGS=`echo "$CFLAGS" | sed 's/-O[23456789]/-Oz/'`
-   fi
- 
  else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  $as_echo "no" >&6; }
--- 4779,4784 ----
*** ../vim-9.0.1516/src/version.c       2023-05-06 16:21:59.598537266 +0100
--- src/version.c       2023-05-06 18:04:42.783487380 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1517,
  /**/

-- 
A)bort, R)etry, P)lease don't bother me again

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230506170739.69CA21C1B21%40moolenaar.net.

Raspunde prin e-mail lui