This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/40036] Initializer incorrectly reordering arguments
- From: "jwbates at mac dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 May 2009 05:25:07 -0000
- Subject: [Bug c++/40036] Initializer incorrectly reordering arguments
- References: <bug-40036-17680@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from jwbates at mac dot com 2009-05-06 05:25 -------
Not sure at all, as I have very little experience dealing with this kind of
issue. To clarify one point of ambiguity: when I mentioned swapping the order
of the arguments to match the correct evaluation behaviour. So, my constructor
Expression(lhs, rhs) calls the initializer _potential(rhs, lhs), which is
correct for my math. However, that's not the problem that I'm seeing.
When I set the breakpoint at Expression(lhs, rhs) and check the locations, lhs
is at 0x######6c, and rhs is at 0x######00 (or some such). When I step into
_potential(p, other), I should expect p to be rhs and other to be lhs, so
_potential(0x######00, 0x######6c), but what I see is _potential(0x######6c,
0x######00), which is pretty unambiguously incorrect.
I'm perfectly willing to believe that my code is wrong, but I don't understand
what kind of code I could write (or fail to write) that could lead to a direct
call to an initializer with the argument addresses (but not the argument types)
swapped. If there's any place else that I can look, or any potential
workarounds I can try, I'll be happy to. It just looks, feels, and quacks like
a bug to me.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40036