[Bug 83995] CFLAGS & COPTFLAGS ambiguous behaviour

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Nov 10 12:59:58 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=83995

NGie Cooper <ngie at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugs.freebsd.org/bu
                   |                            |gzilla/show_bug.cgi?id=1901
                   |                            |03,
                   |                            |https://bugs.freebsd.org/bu
                   |                            |gzilla/show_bug.cgi?id=1937
                   |                            |68
                 CC|                            |bdrewery at FreeBSD.org,
                   |                            |imp at FreeBSD.org,
                   |                            |ngie at FreeBSD.org

--- Comment #1 from NGie Cooper <ngie at FreeBSD.org> ---
Agreed. This logic is broken/confusing:

 38 .if defined(DEBUG)
 39 _MINUS_O=       -O
 40 CTFFLAGS+=      -g
 41 .else
 42 .if ${MACHINE_CPUARCH} == "powerpc"
 43 _MINUS_O=       -O      # gcc miscompiles some code at -O2
 44 .else
 45 _MINUS_O=       -O2
 46 .endif
 47 .endif
 48 .if ${MACHINE_CPUARCH} == "amd64"
 49 .if ${COMPILER_TYPE} == "clang"
 50 COPTFLAGS?=-O2 -pipe
 51 .else
 52 COPTFLAGS?=-O2 -frename-registers -pipe
 53 .endif
 54 .else
 55 COPTFLAGS?=${_MINUS_O} -pipe
 56 .endif
 57 .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
 58 COPTFLAGS+= -fno-strict-aliasing
 59 .endif
 60 .if !defined(NO_CPU_COPTFLAGS)
 61 COPTFLAGS+= ${_CPUCFLAGS}
 62 .endif

In particular, clang's version of COPTFLAGS always override the ${_MINUS_O}, -O
on clang is synonymous with -O2, etc. brewery was complaining about this as
well the other day/week.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list