Hello, while porting FICL, I noticed an aliasing bug which manifests (at least) with gcc 4.4.2 and 4.4.3 when strict-aliasing is enabled. The root cause is #define LVALUEtoCELL(v) (*(CELL *)&v) in sys/boot/ficl/ficl.h. CELL is a union: typedef union _cell { FICL_INT i; FICL_UNS u; [...] void *p; void (*fn)(void); } CELL; If you compile the attached C file with gcc-4.4.3 and -O3, all stores to i are optimized out and the result is bogus. A ficl built with this gcc is inoperable. Giving the union the may_alias attribute works around this, but is GCC specific (patch is attached). Just using ((CELL)v) does not work without casting all over the place or extending the union. Regards, Julian -- "Actually I made up the term 'object-oriented', and I can tell you I did not have C++ in mind." - Alan Kay (OOPSLA 1997 Keynote)
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:00 UTC