public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gabi Voiculescu <boy3dfx2@yahoo.com>
To: gcc-help@gcc.gnu.org
Subject: Re: help understanding a gcc compilation issue
Date: Thu, 09 Jul 2009 11:05:00 -0000	[thread overview]
Message-ID: <367172.13741.qm@web37001.mail.mud.yahoo.com> (raw)


Thank you.

I would have spent some time figuring this out and might not have done it in the end.

Gabi Voiculescu

--- On Thu, 7/9/09, Ian Lance Taylor <iant@google.com> wrote:

> From: Ian Lance Taylor <iant@google.com>
> Subject: Re: help understanding a gcc compilation issue
> To: "Gabi Voiculescu" <boy3dfx2@yahoo.com>
> Cc: gcc-help@gcc.gnu.org
> Date: Thursday, July 9, 2009, 7:42 AM
> Gabi Voiculescu <boy3dfx2@yahoo.com>
> writes:
> 
> > When running, the function llrint() using and
> returning 64 bit variables fails to call rint(), and instead
> calls itself!?!.
> >
> > #include <stdio.h>
> > extern double rint(double x);
> >
> > long long llrint(double x);
> > long long llrint(double x)
> > {
> > printf("%s,%d llrint entry\n", __func__, __LINE__);
> //-gabi 07/08/2009 
> >     return (long long) rint(x);
> > }
> >
> > When calling llrint I see the print statement repeated
> forever, without calling rint() or returning from llrint().
> 
> gcc is outsmarting itself.  When it sees "(long long)
> rint(x)", it
> converts that into "llrint(x)".  This is normally a
> safe conversion, but
> of course it is unsafe when you are trying to implement
> llrint itself.
> You can avoid this problem by using the -fno-builtin-rint
> option.
> 
> Ian
> 



             reply	other threads:[~2009-07-09 11:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 11:05 Gabi Voiculescu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-07-08 22:06 Gabi Voiculescu
2009-07-09  4:42 ` Ian Lance Taylor

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=367172.13741.qm@web37001.mail.mud.yahoo.com \
    --to=boy3dfx2@yahoo.com \
    --cc=gcc-help@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).