Andrew Pinski wrote: > > On Jul 4, 2006, at 5:07 PM, Yuri Pudgorodsky wrote: > >> Can someone make the decision to reopen PR optimization/12085? > > And I posted a patch to do the same in Objective-C mode as C mode :). > http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01013.html >
That indeed will fix PR for all languages (btw why it was not commited to mainline?), but in a strange way. To get back to my original point, turning particular example of possibly undefined behavior is a bad practice. With current fix we have different syntaxes with identical semantic - calling function by casted pointer - doing things in a diverse way: 1) with direct cast: (int (*)(int)) foo - warn/trap since 3.x 2) with cast through void fptr: (int (*)(int)) (int(*)()) foo - warn/trap since 4.2 current 3) with assign: int (*bar)(int) = foo - no warn, no ICE, generates proper call, does not inline 4) with union assign: ... - no warn, no ICE, generates proper call, does not inline Isn't it logical to make fix for all constructions do the same: does not inline problematic call?