public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20353] New: GCC incorrectly issues calls to sinf, cosf
@ 2005-03-06 23:48 jbrandmeyer at earthlink dot net
  2005-03-06 23:54 ` [Bug target/20353] uclibc does not provide C99 math functions pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: jbrandmeyer at earthlink dot net @ 2005-03-06 23:48 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
  2005-03-06 23:48 [Bug c/20353] New: GCC incorrectly issues calls to sinf, cosf jbrandmeyer at earthlink dot net
@ 2005-03-06 23:54 ` pinskia at gcc dot gnu dot org
  2005-03-10  0:59 ` jbrandmeyer at earthlink dot net
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-06 23:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-06 23:54 -------
Note Linux defaults to being glibc which implies that it has C99 math functions, really uclibc really 
should have a different configure file if it does not have C99 functions.  Well technicially it should 
provide them anyways as they are required by the C99 standard.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
          Component|c                           |target
            Summary|GCC incorrectly issues calls|uclibc does not provide C99
                   |to sinf, cosf               |math functions


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
  2005-03-06 23:48 [Bug c/20353] New: GCC incorrectly issues calls to sinf, cosf jbrandmeyer at earthlink dot net
  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
  3 siblings, 0 replies; 10+ messages in thread
From: jbrandmeyer at earthlink dot net @ 2005-03-10  0:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jbrandmeyer at earthlink dot net  2005-03-10 00:59 -------
uClibc has added these functions to SVN, and they will be available in the next
release of uClibc.  However, their presence is still a configurable option - the
user can configure uClibc to not include any of the C99 math functions.  What is
the best way to configure GCC in this case?  Is there a relevant configure-time
option?  Simply specifying -std=c++98 or -std=c89 is not enough to prevent this
behavior.

-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
  2005-03-06 23:48 [Bug c/20353] New: GCC incorrectly issues calls to sinf, cosf jbrandmeyer at earthlink dot net
  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
  3 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-10  1:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-10 01:08 -------
(In reply to comment #2)
> uClibc has added these functions to SVN, and they will be available in the next
> release of uClibc.  However, their presence is still a configurable option - the
> user can configure uClibc to not include any of the C99 math functions.  What is
> the best way to configure GCC in this case?  Is there a relevant configure-time
> option?  Simply specifying -std=c++98 or -std=c89 is not enough to prevent this
> behavior.

None of the above, this is not a runtime configurable thing, as the libc have will it or not at configure 
time.

-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
  2005-03-06 23:48 [Bug c/20353] New: GCC incorrectly issues calls to sinf, cosf jbrandmeyer at earthlink dot net
                   ` (2 preceding siblings ...)
  2005-03-10  1:08 ` pinskia at gcc dot gnu dot org
@ 2005-07-15 21:30 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-15 21:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-15 21:26 -------
uclibc needs its own target headers and triplet.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   GCC host triplet|i386-pc-linux-gnu           |
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-15 21:26:51
               date|                            |


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
       [not found] <bug-20353-6060@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-02-16 23:40 ` jsm28 at gcc dot gnu dot org
@ 2007-01-03 23:01 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-03 23:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2007-01-03 23:00 -------
Subject: Bug 20353

Author: pinskia
Date: Wed Jan  3 23:00:40 2007
New Revision: 120404

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120404
Log:
2007-01-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/20353
        * gimplify.c (gimplify_modify_expr_complex_part): Move below
        tree_to_gimple_tuple.  Call tree_to_gimple_tuple when we need
        the value.

2007-01-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/30353
        * gcc.c-torture/compile/complex-4.c: New test.



Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/complex-4.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
       [not found] <bug-20353-6060@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-02-16 23:39 ` jsm28 at gcc dot gnu dot org
@ 2006-02-16 23:40 ` jsm28 at gcc dot gnu dot org
  2007-01-03 23:01 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2006-02-16 23:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jsm28 at gcc dot gnu dot org  2006-02-16 23:40 -------
Fixed for 4.2.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
       [not found] <bug-20353-6060@http.gcc.gnu.org/bugzilla/>
  2006-02-10 20:14 ` jsm28 at gcc dot gnu dot org
  2006-02-16 23:29 ` jsm28 at gcc dot gnu dot org
@ 2006-02-16 23:39 ` jsm28 at gcc dot gnu dot org
  2006-02-16 23:40 ` jsm28 at gcc dot gnu dot org
  2007-01-03 23:01 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2006-02-16 23:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2006-02-16 23:38 -------
Subject: Bug 20353

Author: jsm28
Date: Thu Feb 16 23:38:44 2006
New Revision: 111161

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111161
Log:
        PR libstdc++/14939
        PR target/20353
        PR target/24578
        PR target/24837
        * gcc/config/linux.opt: New file.
        * gcc/config/linux.h (CHOOSE_DYNAMIC_LINKER,
        UCLIBC_DYNAMIC_LINKER, LINUX_DYNAMIC_LINKER): Define.
        (TARGET_C99_FUNCTIONS): Define depending on TARGET_GLIBC.
        * gcc/config.gcc (*-*-linux*): Define extra_options.
        (*-*-*uclibc*): Define UCLIBC_DEFAULT.
        (arm*-*-linux-gnueabi): Change to arm*-*-linux-*eabi.
        * gcc/config/arm/linux-eabi.h (LINUX_TARGET_INTERPRETER): Change
        to GLIBC_DYNAMIC_LINKER.
        * gcc/config/arm/linux-elf.h (LINUX_TARGET_INTERPRETER): Likewise.
        (LINUX_TARGET_LINK_SPEC): Use LINUX_DYNAMIC_LINKER.
        * gcc/config/mips/linux.h (GLIBC_DYNAMIC_LINKER): Define.
        (LINK_SPEC): Use LINUX_DYNAMIC_LINKER.
        * gcc/doc/invoke.texi (GNU/Linux Options): New section.
        * gcc/testsuite/gcc.dg/builtins-config.h (HAVE_C99_RUNTIME): Don't
        define if __UCLIBC__ is defined.
        * libstdc++-v3/config/os/uclibc/ctype_base.h,
        libstdc++-v3/config/os/uclibc/ctype_inline.h,
        libstdc++-v3/config/os/uclibc/ctype_noninline.h,
        libstdc++-v3/config/os/uclibc/os_defines.h: New.
        * libstdc++-v3/acinclude.m4 (GLIBCXX_CONFIGURE): Test whether
        using uClibc.
        * libstdc++-v3/configure.host: Use os/uclibc for uClibc.
        * libstdc++-v3/crossconfig.m4 (*-linux*): Use link tests.  Don't
        hardcode presence of math functions.
        * libstdc++-v3/configure: Regenerate.

Added:
    branches/csl/sourcerygxx-4_1/gcc/config/linux.opt
    branches/csl/sourcerygxx-4_1/libstdc++-v3/config/os/uclibc/
    branches/csl/sourcerygxx-4_1/libstdc++-v3/config/os/uclibc/ctype_base.h
    branches/csl/sourcerygxx-4_1/libstdc++-v3/config/os/uclibc/ctype_inline.h
   
branches/csl/sourcerygxx-4_1/libstdc++-v3/config/os/uclibc/ctype_noninline.h
    branches/csl/sourcerygxx-4_1/libstdc++-v3/config/os/uclibc/os_defines.h
Modified:
    branches/csl/sourcerygxx-4_1/ChangeLog.csl
    branches/csl/sourcerygxx-4_1/gcc/config.gcc
    branches/csl/sourcerygxx-4_1/gcc/config/arm/linux-eabi.h
    branches/csl/sourcerygxx-4_1/gcc/config/arm/linux-elf.h
    branches/csl/sourcerygxx-4_1/gcc/config/linux.h
    branches/csl/sourcerygxx-4_1/gcc/config/mips/linux.h
    branches/csl/sourcerygxx-4_1/gcc/doc/invoke.texi
    branches/csl/sourcerygxx-4_1/gcc/testsuite/gcc.dg/builtins-config.h
    branches/csl/sourcerygxx-4_1/libstdc++-v3/acinclude.m4
    branches/csl/sourcerygxx-4_1/libstdc++-v3/configure
    branches/csl/sourcerygxx-4_1/libstdc++-v3/configure.host
    branches/csl/sourcerygxx-4_1/libstdc++-v3/crossconfig.m4


-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
       [not found] <bug-20353-6060@http.gcc.gnu.org/bugzilla/>
  2006-02-10 20:14 ` jsm28 at gcc dot gnu dot org
@ 2006-02-16 23:29 ` jsm28 at gcc dot gnu dot org
  2006-02-16 23:39 ` jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2006-02-16 23:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jsm28 at gcc dot gnu dot org  2006-02-16 23:29 -------
Subject: Bug 20353

Author: jsm28
Date: Thu Feb 16 23:29:10 2006
New Revision: 111160

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111160
Log:
gcc:
        PR target/20353
        PR target/24578
        PR target/24837
        * config/linux.opt: New file.
        * config/linux.h (CHOOSE_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER,
        LINUX_DYNAMIC_LINKER): Define.
        (TARGET_C99_FUNCTIONS): Define depending on TARGET_GLIBC.
        * config.gcc (*-*-linux*): Define extra_options.
        (*-*-*uclibc*): Define UCLIBC_DEFAULT.
        (arm*-*-linux-gnueabi): Change to arm*-*-linux-*eabi.
        * config/arm/linux-eabi.h (LINUX_TARGET_INTERPRETER): Change to
        GLIBC_DYNAMIC_LINKER.
        * config/arm/linux-elf.h (LINUX_TARGET_INTERPRETER): Likewise.
        (LINUX_TARGET_LINK_SPEC): Use LINUX_DYNAMIC_LINKER.
        * config/mips/linux.h (GLIBC_DYNAMIC_LINKER): Define.
        (LINK_SPEC): Use LINUX_DYNAMIC_LINKER.
        * doc/invoke.texi (GNU/Linux Options): New section.

gcc/testsuite:
        * gcc.dg/builtins-config.h (HAVE_C99_RUNTIME): Don't define if
        __UCLIBC__ is defined.

libstdc++-v3:
        PR libstdc++/14939
        * config/os/uclibc/ctype_base.h, config/os/uclibc/ctype_inline.h,
        config/os/uclibc/ctype_noninline.h, config/os/uclibc/os_defines.h:
        New.
        * acinclude.m4 (GLIBCXX_CONFIGURE): Test whether using uClibc.
        * configure.host: Use os/uclibc for uClibc.
        * crossconfig.m4 (*-linux*): Use link tests.  Don't hardcode
        presence of math functions.
        * configure: Regenerate.

Added:
    trunk/gcc/config/linux.opt
    trunk/libstdc++-v3/config/os/uclibc/
    trunk/libstdc++-v3/config/os/uclibc/ctype_base.h
    trunk/libstdc++-v3/config/os/uclibc/ctype_inline.h
    trunk/libstdc++-v3/config/os/uclibc/ctype_noninline.h
    trunk/libstdc++-v3/config/os/uclibc/os_defines.h
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.gcc
    trunk/gcc/config/arm/linux-eabi.h
    trunk/gcc/config/arm/linux-elf.h
    trunk/gcc/config/linux.h
    trunk/gcc/config/mips/linux.h
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/builtins-config.h
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/acinclude.m4
    trunk/libstdc++-v3/configure
    trunk/libstdc++-v3/configure.host
    trunk/libstdc++-v3/crossconfig.m4


-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/20353] uclibc does not provide C99 math functions
       [not found] <bug-20353-6060@http.gcc.gnu.org/bugzilla/>
@ 2006-02-10 20:14 ` jsm28 at gcc dot gnu dot org
  2006-02-16 23:29 ` jsm28 at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2006-02-10 20:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2006-02-10 20:14 -------
Fixed by my patch <http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00843.html>,
pending review.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jsm28 at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-09-24 16:44:26         |2006-02-10 20:14:48
               date|                            |


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-01-03 23:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-06 23:48 [Bug c/20353] New: GCC incorrectly issues calls to sinf, cosf jbrandmeyer at earthlink dot net
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
     [not found] <bug-20353-6060@http.gcc.gnu.org/bugzilla/>
2006-02-10 20:14 ` jsm28 at gcc dot gnu dot org
2006-02-16 23:29 ` jsm28 at gcc dot gnu dot org
2006-02-16 23:39 ` jsm28 at gcc dot gnu dot org
2006-02-16 23:40 ` jsm28 at gcc dot gnu dot org
2007-01-03 23:01 ` pinskia at gcc dot gnu dot org

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).