public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jbrandmeyer at earthlink dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/20353] New: GCC incorrectly issues calls to sinf, cosf
Date: Sun, 06 Mar 2005 23:48:00 -0000	[thread overview]
Message-ID: <20050306234801.20353.jbrandmeyer@earthlink.net> (raw)

When optimizing, GCC converts calls to cos() and sin() (and probably others,
these were the ones I saw) into calls to cosf() and sinf() when cos() and sin()
are called with a "float" argument.  The problem with this is that neither
libgcc nor uClibc provide cosf and sinf!  The bug can be worked around by
passing -fno-builtin-cos and -fno-builtin-sin.

The trivial code:
extern double cos(double);
float do_cos(float f)
{ return cos(f); }

Produces this assembly code output:
	.file	"test.c"
	.text
	.align	2
	.global	do_cos
	.type	do_cos, %function
do_cos:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	@ link register save eliminated.
	@ lr needed for prologue
	b	cosf
	.size	do_cos, .-do_cos
	.ident	"GCC: (GNU) 3.4.2"

When run as "arm-linux-gcc -S -O2 test.c"

Output of "arm-linux-gcc -v:"
Reading specs from
/home/jonathan/workspace/gumstix/gumstix-buildroot/build_arm_nofpu/staging_dir/bin-ccache/../lib/gcc/arm-linux-uclibc/3.4.2/specs
Configured with:
/home/jonathan/workspace/gumstix/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure
--prefix=/home/jonathan/workspace/gumstix/gumstix-buildroot/build_arm_nofpu/staging_dir
--build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc
--enable-languages=c,c++ --enable-shared --disable-__cxa_atexit
--enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft
--enable-sjlj-exceptions
Thread model: posix
gcc version 3.4.2

-- 
           Summary: GCC incorrectly issues calls to sinf, cosf
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jbrandmeyer at earthlink dot net
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: arm-linux-uclibc


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20353


             reply	other threads:[~2005-03-06 23:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-06 23:48 jbrandmeyer at earthlink dot net [this message]
2005-03-06 23:54 ` [Bug target/20353] uclibc does not provide C99 math functions pinskia at gcc dot gnu dot org
2005-03-10  0:59 ` jbrandmeyer at earthlink dot net
2005-03-10  1:08 ` pinskia at gcc dot gnu dot org
2005-07-15 21:30 ` pinskia at gcc dot gnu dot 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=20050306234801.20353.jbrandmeyer@earthlink.net \
    --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: link
Be 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).