From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18685 invoked by alias); 29 Jul 2009 17:04:30 -0000 Received: (qmail 15697 invoked by uid 48); 29 Jul 2009 17:04:13 -0000 Date: Wed, 29 Jul 2009 17:04:00 -0000 Subject: [Bug rtl-optimization/40906] New: Wrong code generated for push of long double X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mikulas at artax dot karlin dot mff dot cuni dot cz" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg02352.txt.bz2 Hi. Try this program: #include 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