Skip to content

Commit 36df28d

Browse files
authored
v.builder: always apply -fno-strict-aliasing too, on -cc gcc -prod to avoid the need for the -cflags -fno-inline-small-functions workaround with gcc > 12.0 (fix #26512) (#26552)
1 parent 5b2db04 commit 36df28d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎vlib/v/builder/cc.v‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
281281
if have_flto {
282282
optimization_options << '-flto'
283283
}
284+
// gcc versions newer than 10.2, produce buggy programs, usually triggered by optimising inlined small functions, when both -flto and -O3 are used.
285+
// Using -fno-strict-aliasing prevents that. See https://github.com/vlang/v/issues/26512 .
286+
optimization_options << '-fno-strict-aliasing'
284287
}
285288
if ccoptions.cc == .icc {
286289
if ccoptions.debug_mode {

0 commit comments

Comments
 (0)