From: Wolfgang Denk Date: Sun, 06 Jul 2008 00:32:02 +0200 Subject: [U-Boot-Users] [PATCH] Squash warnings from pointer aliasing in dlmalloc In-Reply-To: Your message of "Wed, 04 Jun 2008 23:37:42 CDT." Message-ID: <20080705223202.A51BA248DE@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message you wrote: > When we building with gcc-4.3.x on a ppc host we get the following warnings: > > dlmalloc.c: In function 'malloc_extend_top': > dlmalloc.c:1971: warning: dereferencing type-punned pointer will break strict-aliasing rules > dlmalloc.c:1999: warning: dereferencing type-punned pointer will break strict-aliasing rules ... > This is due to pointer aliasing that the dlmalloc code does and depends on. Can you please explain why the dlmalloc code depends on this? In my experience so far it has always been possible to avoid such warnings by trivial changes to the code (the tricky part was usually to understand what the exact problem was and what changes were necessary). > Instead of trying trying to work around the warnings, we use the per file > CFLAGs to disable the warnings via -fno-strict-aliasing. I tend to reject this patch. I would much rather have the problem fixed in the sources. Hushing up compiler warnings has never been a good idea. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Our business is run on trust. We trust you will pay in advance.