Bug 19983 - __builtin_nan should allow 0X as well as 0x
Summary: __builtin_nan should allow 0X as well as 0x
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2005-02-15 21:03 UTC by Joseph S. Myers
Modified: 2006-02-27 20:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 3.3.3 3.4.0 4.0.0
Last reconfirmed: 2006-02-13 03:52:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2005-02-15 21:03:54 UTC
The __builtin_nan functions should allow 0X as well as 0x in their arguments.
real.c:real_nan only allows 0x at present.  In

double n1 = __builtin_nan("0x1");
double n2 = __builtin_nan("0X1");

only the first initializer is accepted, but both should be.
Comment 1 Andrew Pinski 2005-02-15 21:14:04 UTC
Confirmed.
Comment 2 Andrew Pinski 2005-02-15 21:28:05 UTC
The bug is very obvious from the code:
      if (*str == '0')
        {
          if (*++str == 'x')
            str++, base = 16;
          else
            base = 8;
        }

Note no check for the upercase version of 'X'.  (yes I know about the talk about -fwide-exec-charset= 
and -finput-charset=).
Comment 3 Roger Sayle 2006-02-27 02:26:03 UTC
Subject: Bug 19983

Author: sayle
Date: Mon Feb 27 02:25:57 2006
New Revision: 111470

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111470
Log:

	PR middle-end/19983
	* real.c (real_nan): Allow both 0x and 0X as hexadecimal prefixes.

	* gcc.c-torture/execute/ieee/builtin-nan-1.c: New test case.


Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/ieee/builtin-nan-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/real.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Andrew Pinski 2006-02-27 20:25:25 UTC
Fixed.