public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "d.a.gonzalez.marquez at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/66164] New: Strange behaviour calling functions with float as parameter Date: Fri, 15 May 2015 19:24:00 -0000 [thread overview] Message-ID: <bug-66164-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66164 Bug ID: 66164 Summary: Strange behaviour calling functions with float as parameter Product: gcc Version: 4.8.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: d.a.gonzalez.marquez at gmail dot com Target Milestone: --- Created attachment 35550 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35550&action=edit Source code for reproduce the bug The following bug is for x86 architecture on a i386 compilation: -m32 I took a code that is part of an implementation of the libc. In order to obtain a new one with some changes. The problem was that I found a bug. The code is easy to follow: It makes calls in this order: main ---> AUXsin ---> __sinf ---> __ieee754_rem_pio2f int main() { float ra = AUXsin(100); return 0; } float AUXsin(float x) { return __sinf(x); } float __sinf(float x) { float y[2],z=0.0; int32_t n, ix; n = __ieee754_rem_pio2f(x,y); return (float)n; } int32_t __ieee754_rem_pio2f(float x, float *y) { y[0] = 0.0; return 0; } When the function __ieee754_rem_pio2f tries to read the parameter y, it finds that the stack is: esp - 4 | ........ esp + 0 | return addr esp + 4 | value x esp + 8 | value x esp + 12 | pointer to y The problem was that the function __sinf store a double on the stack for the x value. And, when the function tries to read the pointer to y, it reads a wrong value. I attached a zip with the code to test. Thanks in advance, David
next reply other threads:[~2015-05-15 19:24 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-05-15 19:24 d.a.gonzalez.marquez at gmail dot com [this message] 2015-05-15 21:57 ` [Bug middle-end/66164] " msebor at gcc dot gnu.org 2015-05-16 2:03 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-66164-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).