This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/33498] Optimizer (-O2) may convert a normal loop to infinite



------- Comment #15 from rakdver at gcc dot gnu dot org  2007-09-20 18:47 -------
> I see.  I thought we might be able to recognize the overflow in computing
> the final value of val and as val is signed, not use that for the exit 
> test.  Or simply give up in computing the final value for val if it 
> invokes signed overflow.  I agree the code invokes undefined behavior, 
> just from a QOI perspective it might be nice to not produce the endless
> loop here ;)

More appropriate place to "fix" this (assuming that we want to do something
about this) would be VRP, as it will use the assumption that val does not
overflow regardless (if something more complicated than just assigning it were
done with val).

We might also issue warnings for signed variables that provably overflow;
although it probably would not be very useful, as we are very rarely able to
prove that.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]