[Ada] Avoid exponential complexity gimplifying checks

Eric Botcazou ebotcazou@adacore.com
Sat Nov 15 14:30:00 GMT 2008


While ideally it would be fine to have many shared trees, trees are unshared 
during gimplification.  In the case of run time checks on arithmetic 
operations, each check references its arguments multiple times.  Without 
save_expr, the number of trees may grow by a factor of 4 as a result of each 
checked operation.  With N nested expressions, the total number of trees 
becomes 4^N.

Fixed thusly, tested on i586-suse-linux, applied on the mainline.


2008-11-15  Geert Bosch  <bosch@adacore.com>

	* gcc-interface/trans.c (emit_check): Put back a final save_expr
	to prevent exponential expansion during gimplification.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 740 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081115/75da0ffa/attachment.bin>


More information about the Gcc-patches mailing list