[Bug tree-optimization/45791] Missed devirtualization
matthijs at stdin dot nl
gcc-bugzilla@gcc.gnu.org
Mon Feb 24 09:44:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45791
Matthijs Kooijman <matthijs at stdin dot nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |matthijs at stdin dot nl
--- Comment #15 from Matthijs Kooijman <matthijs at stdin dot nl> ---
I ran into another variant of this problem, which I reduced to the following
testcase. I found the problem on 4.8.2, but it is already fixed in trunk /
gcc-4.9 (Debian 4.9-20140218-1). Still, it might be useful to have the testcase
here for reference.
class Base { };
class Sub : public Base {
public:
virtual void bar();
};
Sub foo;
Sub * const pointer = &foo;
Sub* function() { return &foo; };
int main() {
// Gcc 4.8.2 devirtualizes this:
pointer->bar();
// but not this:
function()->bar();
}
More information about the Gcc-bugs
mailing list