Hi. Try this program:
#include <stdlib.h>
void f(long double a)
{
if (a != 1.0) abort();
}
int g(long double b)
{
f(b);
return 0;
}
int main(void)
{
g(1.0);
return 0;
}
Compile it with "-O2 -mpush-args -mno-accumulate-outgoing-args
-fomit-frame-pointer -fno-inline"
In gcc 4.3.2 it works, in gcc-4.4.1 it aborts. If you add -m128bit-long-double,
both gcc 4.3 and 4.4 fail. The reason is that push of long double in the
function "g" is badly generated --- it is pushing value that is already on the
stack and while it is pushing it, the stack pointer changes. Gcc tries to
compensate for it, but the code is buggy and it ends up pushing wrong words.
--
Summary: Wrong code generated for push of long double
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40906