* lrint / lrintf functions
@ 2001-10-20 19:29 Erik de Castro Lopo
2001-10-20 22:25 ` lrint / lrintf functions (slipping OT) Tim Prince
0 siblings, 1 reply; 4+ messages in thread
From: Erik de Castro Lopo @ 2001-10-20 19:29 UTC (permalink / raw)
To: gcc
Hi all,
I am currently using the above two C99 functions. If I turn off optimisation
( -O0) I get an error stating that the functions can't be found. If optimisation
is turned on everything is fine.
On my Linux system, these function are in <bits/mathinline.h> which is
automatically included when I include <math.h>. With optimisation switch off
it looks like the compiler fails to compile in a static version of the lrint
and lrintf functions.
Is this the fault of gcc, the C library of something else?
Using Linux 2.4.10 kernel, gcc-2.95, glibc-2.2.4.
Thanks in advance,
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"I ran it on my DeathStation 9000 and demons flew out of my nose." --Kaz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: lrint / lrintf functions (slipping OT)
2001-10-20 19:29 lrint / lrintf functions Erik de Castro Lopo
@ 2001-10-20 22:25 ` Tim Prince
2001-10-20 22:39 ` Erik de Castro Lopo
0 siblings, 1 reply; 4+ messages in thread
From: Tim Prince @ 2001-10-20 22:25 UTC (permalink / raw)
To: Erik de Castro Lopo, gcc
----- Original Message -----
From: "Erik de Castro Lopo" <nospam@mega-nerd.com>
To: <gcc@gcc.gnu.org>
Sent: Saturday, October 20, 2001 7:29 PM
Subject: lrint / lrintf functions
> Hi all,
>
> I am currently using the above two C99 functions. If I turn off
optimisation
> ( -O0) I get an error stating that the functions can't be
found. If optimisation
> is turned on everything is fine.
>
> On my Linux system, these function are in <bits/mathinline.h>
which is
> automatically included when I include <math.h>. With
optimisation switch off
> it looks like the compiler fails to compile in a static version
of the lrint
> and lrintf functions.
Last I looked, glibc had its math.h set up not to include
<mathinline.h> when -O0 or -Os is selected.
>
> Is this the fault of gcc, the C library of something else?
>
> Using Linux 2.4.10 kernel, gcc-2.95, glibc-2.2.4.
I believe I recall that the C standard used to require the
availability of an external copy of each standard function, so
this would be a bug in glibc, even if gcc were to have a complete
internal implementation.
No, don't blame the kernel, or gcc; modify your glibc setup to do
it the way you want. Can't you make a linkable version (using
options which invoke the inlines) like:
#include <math.h>
long int (lrint)(double x){return lrint(x);}
Hand optimize the .s file if you like, but I see advantages in
assuring that the in-lines and the external linkable versions
should be more consistent than they currently are. This is not to
deny that the external versions require more error checking than
the in-lines. All OT for gcc, even though the organizational
disconnect between the compiler and the library is contrary to
the standards. But, glibc won't change unless a number of
influential users have demonstrated and agree upon an
improvement.
I'm considering doing a more complete libm of my own (GPL of
course), at least all the functions where I find something
lacking in one of the libraries commonly used with gcc, but I
don't expect anyone to adopt it.
>
> Thanks in advance,
> Erik
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: lrint / lrintf functions (slipping OT)
2001-10-20 22:25 ` lrint / lrintf functions (slipping OT) Tim Prince
@ 2001-10-20 22:39 ` Erik de Castro Lopo
0 siblings, 0 replies; 4+ messages in thread
From: Erik de Castro Lopo @ 2001-10-20 22:39 UTC (permalink / raw)
To: gcc
It really blew my mind when "Tim Prince" <tprince@computer.org> said:
>
> I believe I recall that the C standard used to require the
> availability of an external copy of each standard function, so
> this would be a bug in glibc, even if gcc were to have a complete
> internal implementation.
I'm embarassed to admit it but I raised a bug against Debian's libc6.
The maintainer and I had a bit of back an forth we realised that when
I switched optimisation off I have to add -lm to the link command.
Like I said, I am embarrased :-).
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
#!/bin/sh
unzip ; strip; touch ; finger ; mount ; gasp ;
yes ; more ; umount ; sleep ;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: lrint / lrintf functions
@ 2001-10-20 20:08 mike stump
0 siblings, 0 replies; 4+ messages in thread
From: mike stump @ 2001-10-20 20:08 UTC (permalink / raw)
To: gcc, nospam
> Date: Sun, 21 Oct 2001 12:29:31 +1000
> From: Erik de Castro Lopo <nospam@mega-nerd.com>
> To: gcc@gcc.gnu.org
> I am currently using the above two C99 functions. If I turn off optimisation
> ( -O0) I get an error stating that the functions can't be found.
> Is this the fault of gcc, the C library of something else?
If a symbol that should be defined in your C library, isn't, then
usually it is a library problem.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-10-20 22:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-20 19:29 lrint / lrintf functions Erik de Castro Lopo
2001-10-20 22:25 ` lrint / lrintf functions (slipping OT) Tim Prince
2001-10-20 22:39 ` Erik de Castro Lopo
2001-10-20 20:08 lrint / lrintf functions mike stump
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).