https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111946
Bug ID: 111946 Summary: bogus cast increases required alignment for a simple class Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: objc Assignee: unassigned at gcc dot gnu.org Reporter: rm at gnu dot org Target Milestone: --- Created attachment 56183 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56183&action=edit super-trivial class In the GNUstep project I noticed that I got very often a "warning: cast increases required alignment of target type [-Wcast-align]" in most files, but didn't see it always. The classes look fine. I tracked it down to be an architecture problem. It does not happen e.g. on x86 and amd64, but happens on sparc64, mips32-le. It happens since many GCC version and it is still present in 13.2 At the time of writing, I could quickly reproduce it on 7.5.0, 10.2.1 and 13.2.0. The problem can be reduced to an as trivial class like the attached file. On more current compiler versions an issue about no root class found is issued, but in practice this is not the case, we usually use the NSObject root class, this is just the most minimal trivial example. Since it happens even with old gcc versions and continues to, I could test on a variety of platforms. Compilation command: gcc Polygon.m -c -Wcast-align To sum up: x86 (32bit LE) : NO amd64 (64bit LE) : NO MIPS (32bit LE) : YES sparc (32bit BE) : YES sparc (64bit BE) : YES PPC (32bit BE) : NO I don't see an immediate pattern here