Patchwork Fix up CFLAGS/CXXFLAGS gcc/configure adjustment (PR other/54692)

login
register
mail settings
Submitter Jakub Jelinek
Date Sept. 25, 2012, 11:19 a.m.
Message ID <20120925111948.GJ1787@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/186775/
State New
Headers show

Comments

Jakub Jelinek - Sept. 25, 2012, 11:19 a.m.
Hi!

On Thu, Sep 13, 2012 at 06:24:14PM +0200, Paolo Bonzini wrote:
> Il 13/09/2012 17:57, Jakub Jelinek ha scritto:
> >>> > > Can we get this change in?  The current state is terribly annoying.
> >> > 
> >> > Yes, please go ahead.
> > Here it is, bootstrapped/regtested on x86_64-linux and i686-linux,
> > additionally tested on --disable-bootstrap tree, both by make cc1 inside of
> > gcc subdir (no -O2) and make all-gcc above it (with -O2).
> 
> Ok.

Seems the sed command was using " *" at the end, so it happily changed
e.g. "-Og " into just "g " instead of either keeping "-Og " in, or
removing it altogether.  This patches fixes it, now
-Ofast, -Og, -Os, -O, -O[0-9]* are removed when followed by whitespace
and not otherwise.  Bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

2012-09-25  Jakub Jelinek  <jakub@redhat.com>

	PR other/54692
	* configure.ac (CFLAGS, CXXFLAGS): Remove -Ofast or -Og
	properly.
	* configure: Regenerated.



	Jakub
Richard Guenther - Sept. 25, 2012, 11:27 a.m.
On Tue, Sep 25, 2012 at 1:19 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> On Thu, Sep 13, 2012 at 06:24:14PM +0200, Paolo Bonzini wrote:
>> Il 13/09/2012 17:57, Jakub Jelinek ha scritto:
>> >>> > > Can we get this change in?  The current state is terribly annoying.
>> >> >
>> >> > Yes, please go ahead.
>> > Here it is, bootstrapped/regtested on x86_64-linux and i686-linux,
>> > additionally tested on --disable-bootstrap tree, both by make cc1 inside of
>> > gcc subdir (no -O2) and make all-gcc above it (with -O2).
>>
>> Ok.
>
> Seems the sed command was using " *" at the end, so it happily changed
> e.g. "-Og " into just "g " instead of either keeping "-Og " in, or
> removing it altogether.  This patches fixes it, now
> -Ofast, -Og, -Os, -O, -O[0-9]* are removed when followed by whitespace
> and not otherwise.  Bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?

Looks good to me.

Thanks,
Richard.

> 2012-09-25  Jakub Jelinek  <jakub@redhat.com>
>
>         PR other/54692
>         * configure.ac (CFLAGS, CXXFLAGS): Remove -Ofast or -Og
>         properly.
>         * configure: Regenerated.
>
> --- gcc/configure.ac.jj 2012-09-13 18:29:46.000000000 +0200
> +++ gcc/configure.ac    2012-09-24 21:47:41.606278259 +0200
> @@ -296,8 +296,8 @@ AC_SUBST(OUTPUT_OPTION)
>  # optimizations to be activated explicitly by the toplevel.
>  case "$CC" in
>    */prev-gcc/xgcc*) ;;
> -  *) CFLAGS=`echo $CFLAGS | sed "s/-O[[s0-9]]* *//" `
> -     CXXFLAGS=`echo $CXXFLAGS | sed "s/-O[[s0-9]]* *//" ` ;;
> +  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[      ]]//" -e "s/-O[[gs]][[  ]]//" -e "s/-O[[0-9]]*[[        ]]//" `
> +     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[  ]]//" -e "s/-O[[gs]][[  ]]//" -e "s/-O[[0-9]]*[[        ]]//" ` ;;
>  esac
>  AC_SUBST(CFLAGS)
>  AC_SUBST(CXXFLAGS)
> --- gcc/configure.jj    2012-09-17 11:13:13.119075354 +0200
> +++ gcc/configure       2012-09-24 21:49:02.900837573 +0200
> @@ -4863,8 +4863,8 @@ fi
>  # optimizations to be activated explicitly by the toplevel.
>  case "$CC" in
>    */prev-gcc/xgcc*) ;;
> -  *) CFLAGS=`echo $CFLAGS | sed "s/-O[s0-9]* *//" `
> -     CXXFLAGS=`echo $CXXFLAGS | sed "s/-O[s0-9]* *//" ` ;;
> +  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[       ]//" -e "s/-O[gs][      ]//" -e "s/-O[0-9]*[    ]//" `
> +     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[   ]//" -e "s/-O[gs][      ]//" -e "s/-O[0-9]*[    ]//" ` ;;
>  esac
>
>
>
>
>         Jakub
Paolo Bonzini - Sept. 25, 2012, 3:59 p.m.
Il 25/09/2012 13:19, Jakub Jelinek ha scritto:
> Hi!
> 
> On Thu, Sep 13, 2012 at 06:24:14PM +0200, Paolo Bonzini wrote:
>> Il 13/09/2012 17:57, Jakub Jelinek ha scritto:
>>>>>>> Can we get this change in?  The current state is terribly annoying.
>>>>>
>>>>> Yes, please go ahead.
>>> Here it is, bootstrapped/regtested on x86_64-linux and i686-linux,
>>> additionally tested on --disable-bootstrap tree, both by make cc1 inside of
>>> gcc subdir (no -O2) and make all-gcc above it (with -O2).
>>
>> Ok.
> 
> Seems the sed command was using " *" at the end, so it happily changed
> e.g. "-Og " into just "g " instead of either keeping "-Og " in, or
> removing it altogether.  This patches fixes it, now
> -Ofast, -Og, -Os, -O, -O[0-9]* are removed when followed by whitespace
> and not otherwise.  Bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?

Yes, thanks.  Would it make sense to leave -Og in?

Paolo
Jakub Jelinek - Sept. 25, 2012, 4:42 p.m.
On Tue, Sep 25, 2012 at 05:59:28PM +0200, Paolo Bonzini wrote:
> Il 25/09/2012 13:19, Jakub Jelinek ha scritto:
> Yes, thanks.  Would it make sense to leave -Og in?

Maybe once it matures more.  E.g. the scheduler isn't currently
tweaked for -Og (should either not schedule at all, or only
within group of insns with the same location (source loc + block),
possibly allowing no location/block insns to be moved around at will).

	Jakub

Patch

--- gcc/configure.ac.jj	2012-09-13 18:29:46.000000000 +0200
+++ gcc/configure.ac	2012-09-24 21:47:41.606278259 +0200
@@ -296,8 +296,8 @@  AC_SUBST(OUTPUT_OPTION)
 # optimizations to be activated explicitly by the toplevel.
 case "$CC" in
   */prev-gcc/xgcc*) ;;
-  *) CFLAGS=`echo $CFLAGS | sed "s/-O[[s0-9]]* *//" `
-     CXXFLAGS=`echo $CXXFLAGS | sed "s/-O[[s0-9]]* *//" ` ;;
+  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/-O[[0-9]]*[[ 	]]//" `
+     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/-O[[0-9]]*[[ 	]]//" ` ;;
 esac
 AC_SUBST(CFLAGS)
 AC_SUBST(CXXFLAGS)
--- gcc/configure.jj	2012-09-17 11:13:13.119075354 +0200
+++ gcc/configure	2012-09-24 21:49:02.900837573 +0200
@@ -4863,8 +4863,8 @@  fi
 # optimizations to be activated explicitly by the toplevel.
 case "$CC" in
   */prev-gcc/xgcc*) ;;
-  *) CFLAGS=`echo $CFLAGS | sed "s/-O[s0-9]* *//" `
-     CXXFLAGS=`echo $CXXFLAGS | sed "s/-O[s0-9]* *//" ` ;;
+  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/-O[0-9]*[ 	]//" `
+     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/-O[0-9]*[ 	]//" ` ;;
 esac