Gentoo Archives: gentoo-dev

From: Luca Barbato <lu_zero@g.o>
To: ppc@g.o, gentoo-dev@l.g.o
Subject: [gentoo-dev] strict-aliasing rules, don't break them
Date: Sat, 17 Jun 2006 10:24:17
Message-Id: 4493D6D5.60109@gentoo.org
1 You may aware or not that there is a nice optimization (more effective
2 if you have some registers to spare) based on how you access memory
3 thought variables. Since it wasn't that effective and didn't break
4 anything it is enabled since -O2.
5
6 Problem: recent gcc are doing some quite smart tricks with aliasing and
7 as result they will break in subtle way your code if you use
8 strict-aliasing rules optimization on type puns.
9
10 Quick solution: enforce -fno-strict-aliasing as global cflag.
11
12 Side effect: you may lose a bit in performance, but better safe than
13 sorry: the first package showing issues was openssl[1] mismatching
14 hashes, guess how discovered that and how (hint: ssh was refusing logins...)
15
16 Long term solution:
17 1- check your new package for aliasing compliance, and if you have time
18 fix it in the code or in the makefile, if you haven't append
19 -fno-strict-aliasing to the cflags and maybe send a notice about it upstream
20
21 2- append -fno-strict-aliasing to every source known to have such issue.
22
23 I'll do 2 on all packages in the tree showing the issue if you think is
24 ok, arches not yet affected will be in the future.
25
26 lu
27
28 [1]http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14725
29
30
31 --
32
33 Luca Barbato
34
35 Gentoo/linux Gentoo/PPC
36 http://dev.gentoo.org/~lu_zero
37
38 --
39 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] strict-aliasing rules, don't break them "Diego 'Flameeyes' Pettenò" <flameeyes@g.o>
Re: [gentoo-dev] strict-aliasing rules, don't break them "Kevin F. Quinn" <kevquinn@g.o>
Re: [gentoo-dev] strict-aliasing rules, don't break them Mike Frysinger <vapier@g.o>
Re: [gentoo-dev] strict-aliasing rules, don't break them Mike Frysinger <vapier@g.o>