autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."


From: Paul Eggert
Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Date: Fri, 29 Dec 2006 15:44:50 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

"Richard Guenther" <address@hidden> writes:

> Authors of the affected programs should adjust their makefiles

That is what the proposed patch is for.  It gives a way for
developers to adjust their makefiles.

A developer of portable software cannot simply put something
like this into a makefile:

  CFLAGS = -g -O2 -fwrapv

as -fwrapv won't work with most other compilers.  So the
developer needs some Autoconfish help anyway, to address the
problem.  The proposed help is only rudimentary, but it does
adjust makefiles to address the issue, and it's better than
nothing.  Further improvements would of course be welcome.

> the much more often reported problems are with
> -fstrict-aliasing, and this one also doesn't get any
> special treatment by autoconf.

That's a good point, and it somewhat counterbalances the
opposing point that -O2 does not currently imply
'-ffast-math'ish optimizations even though the C standard
would allow it to.

I don't feel a strong need for 'configure' to default to
-fstrict-aliasing with GCC.  Application code that violates
strict aliasing assumptions is often unportable in practice
for other reasons, and needs to be rewritten anyway, even if
optimization is disabled.  So -fstrict-aliasing wouldn't
help that much.

In contrast, the wrapv assumption is relatively safe and
does not need to be rewritten to be widely portable in
practice, under the assumptions documented in the proposed
patch.

Also, my admittedly anecdotal impression is that the wrapv
assumption is more pervasive.  I don't know of any strict
aliasing assumptions in coreutils, for example, but I know
of several wrapv assumptions.  I suspect the same thing is
true for many other GNU applications.

All that being said, I have no real objection to having
Autoconf default to -fstrict-aliasing too.  However, I'd
rather not propose that change right now; one battle at a time.

> -O2 is what gets the most testing,

Another good point, but if this change goes through Autoconf
-O2 -fwrapv will get a lot of testing in real-world C
applications, and that will help mitigate any problems in
this area.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]