Kalle Olavi Niemitalo <kon@xxxxxx> writes: > I tried to work around that limitation by defining a function > that has the malloc attribute and then calls the function pointer: > However, "gcc (Debian 4.4.5-8) 4.4.5" -O2 on x86_64 generates > code that assumes the pointers may alias: > If I remove the definition of call_my_malloc, so that gcc cannot > inline it, then gcc respects the malloc attribute: > I wonder if this qualifies as a missed-optimization bug, > and whether later versions of gcc do the same. While one could make an argument that this is a missed-optimization (and I would expect that later versions of gcc act the same way), I think the correct, and in fact simpler, fix is to make these shenanigans unnnecessary, not to try to optimize them better. Ian