This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11772] Incorrect code generated with -mrtd and long long
- From: "mikulas at artax dot karlin dot mff dot cuni dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Aug 2003 17:17:17 -0000
- Subject: [Bug c/11772] Incorrect code generated with -mrtd and long long
- References: <20030802171123.11772.mikulas@artax.karlin.mff.cuni.cz>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11772
mikulas at artax dot karlin dot mff dot cuni dot cz changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|wrong-code |
------- Additional Comments From mikulas at artax dot karlin dot mff dot cuni dot cz 2003-08-02 17:17 -------
This is test code for the bug:
long long __divdi3(long long a, long long b)
{
return a + b;
}
f()
{
volatile int x = 1;
long long a1 = 4, a2 = 2;
/*long long a = __divdi3(a1, a2);*/
long long a = a1 / a2;
if (x != 1) abort();
return a;
}
main()
{
return f();
}
compile it with -fomit-frame-pointer -mrtd flags. When you run it, it fails in Abort function, because value of variable `x' changed because stack pointer is incorrect in function f.
When you look at assembler, you see that __divdi3 exits with ret $16 and there's additional addl $16, %esp after calling __divdi3.
Mikulas