public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amker.cheng at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/51867] GCC generates inconsistent code for same sources calling builtin calls, like sqrtf
Date: Tue, 17 Jan 2012 10:43:00 -0000	[thread overview]
Message-ID: <bug-51867-4-rAr8NE3Mg1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51867-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from amker.cheng <amker.cheng at gmail dot com> 2012-01-17 10:35:14 UTC ---
test case c-c++-common/dfp/signbit-2.c depends on this check.
the case is like:
---------------------------------------------------------------------
/* { dg-options "-O0" } */

/* Check that the compiler uses builtins for signbit; if not the link
   will fail because library functions are in libm.  */

#include "dfp-dbg.h"

volatile _Decimal32 sd = 2.3df;
volatile _Decimal64 dd = -4.5dd;
volatile _Decimal128 tf = 5.3dl;
volatile float f = 1.2f;
volatile double d = -7.8;
volatile long double ld = 3.4L;

EXTERN int signbitf (float);
EXTERN int signbit (double);
EXTERN int signbitl (long double);
EXTERN int signbitd32 (_Decimal32);
EXTERN int signbitd64 (_Decimal64);
EXTERN int signbitd128 (_Decimal128);

int
main ()
{
  if (signbitf (f) != 0) FAILURE
  if (signbit (d) == 0) FAILURE
  if (signbitl (ld) != 0) FAILURE
  if (signbitd32 (sd) != 0) FAILURE
  if (signbitd64 (dd) == 0) FAILURE
  if (signbitd128 (tf) != 0) FAILURE

  FINISH
}

It is compiled without optimization and will fail if no builtin_* functions are
used.
Not sure it is intended or not.


  parent reply	other threads:[~2012-01-17 10:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 10:15 [Bug middle-end/51867] New: " amker.cheng at gmail dot com
2012-01-16 10:19 ` [Bug middle-end/51867] " amker.cheng at gmail dot com
2012-01-16 14:45 ` rguenth at gcc dot gnu.org
2012-01-17 10:43 ` amker.cheng at gmail dot com [this message]
2012-02-09  9:38 ` amker at gcc dot gnu.org
2012-06-18  2:03 ` amker.cheng at gmail dot com
2022-01-06  3:42 ` 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-51867-4-rAr8NE3Mg1@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: 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).