This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4.6 performance regressions


On Wed, Feb 9, 2011 at 2:42 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 9 February 2011 08:34, Sebastian Pop wrote:
>>
>> For example x264 defines CFLAGS="-O4 -ffast-math $CFLAGS", and so
>> building this benchmark with CFLAGS="-O2" would have no effect.
>
> Why not?
>
> Ignoring the fact -O3 is the highest level for GCC, the manual says:
> "If you use multiple -O options, with or without level numbers, the
> last such option is the one that is effective."
> http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
>
> And CFLAGS="-fno-fast-math -O2" would cancel the effects of -ffast-math too.
>
Because the makefile can override CFLAGS in the environment (or in a
make variable) at any time, and GCC wouldn't even see it.

$ cat makefile
t1:
       @echo passed in VENV=$$VENV VMAK=$(VMAK)
t2:
       @echo env oride; VENV=v1 make t1
       @echo mak oride; make VMAK=v2 t1
$ make
passed in VENV= VMAK=
$ VENV=env_from_cli make VMAK=make_from_cli
passed in VENV=env_from_cli VMAK=make_from_cli
$
$ make t2
env oride
make[1]: Entering directory `/tmp'
passed in VENV=v1 VMAK=
make[1]: Leaving directory `/tmp'
mak oride
make[1]: Entering directory `/tmp'
passed in VENV= VMAK=v2
make[1]: Leaving directory `/tmp'
$
$ VENV=env_from_cli make VMAK=make_from_cli t2
env oride
make[1]: Entering directory `/tmp'
passed in VENV=v1 VMAK=make_from_cli
make[1]: Leaving directory `/tmp'
mak oride
make[1]: Entering directory `/tmp'
passed in VENV=env_from_cli VMAK=v2
make[1]: Leaving directory `/tmp'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]