------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-16 01:23 ------- The issue here is more complex. We are not dected the function with the loop as constant so we don't mark it as the function a as not having side effects.
The most ovbvious way to fix this would do the ipa optimizations on the ssa level where we can get the loop information and check to see if the loops are finite. A simple example is even without -funsafe-loop-optimization: void a(int start, int finish) { for (; start < finish; ++start) { } } int main() { int x = 0, y = 99; a(x, y); } -- What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed| |1 Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2005-08-16 01:23:37 date| | Summary|function call not optimized |pure function is not |away after unsafe-loop- |dectected for functions with |optimizations |non infinite loops http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23414