On Fri, 29 Feb 2008, Mark Mitchell wrote: > Richard Guenther wrote: > > This is a request to depcrecate -ftrapv which has numerous problems > > making it not work as expected since a long time. As nobody seems > > to have the energy to ensure it is working I propose to deprecate it > > for GCC 4.3 to make it possible to remove it during 4.4 (and not > > block removing libcall notes by it). > > Why doesn't it work? Can it be made to work relatively easily? Do we need > functionality like this for Ada or Java?
The tree optimizers do not recognize +-* of singed integers as possibly trapping which causes functions to become const/pure that should not and causes 'dead' code to be removed that should not. We do expand +-* allowing LIBCALL_WIDEN which will for example use DImode on x86_64 where the libgcc implementation then of course traps on DImode overflow rather than whatever smaller mode we were interested in. We wrap the libcalls inside libcall notes using REG_EQUAL notes which indicate the libcalls compute non-trapping +-* (there's no RTX code for the trappingness), so we combine and simplify the operations making the libcall possibly dead and remove it again. Just to mention the few problems I stumbled over while looking at PR19020 some time ago. Richard.