http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55477
--- Comment #6 from Matt Hargett <matt at use dot net> 2013-02-11 01:55:51 UTC --- I just tested with latest trunk (4.8.0 20130210). inline-devirt-2.C does indeed pass when adding an outer loop, but only at -O3. That is probably fine, but I could have sworn it used to work with the outer loop with just -O2. inline-devirt-3.C has seemingly regressed further since my last test, for some reason. I *have* to supply both -O3 *and* -funroll-loops now to see the correct number of inlined printf statements in main(): #include <stdio.h> class Calculable { public: virtual unsigned char calculate() const = 0; virtual ~Calculable() {} }; class X : public Calculable { public: virtual unsigned char calculate() const { return 0; } }; class Y : public Calculable { public: virtual unsigned char calculate() const { return 3; } }; static void print(const Calculable& c) { for (int i = 0; i < c.calculate(); i++) { printf("%d\n", c.calculate()); } } int main() { X x; Y y; for (int i=3; i > 0; i--) { print(x); print(y); } return 0; }