public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
@ 2004-05-25 22:19 flash at pobox dot com
2004-05-25 22:28 ` [Bug preprocessor/15642] " flash at pobox dot com
` (9 more replies)
0 siblings, 10 replies; 13+ messages in thread
From: flash at pobox dot com @ 2004-05-25 22:19 UTC (permalink / raw)
To: gcc-bugs
The following code give "error: initializer element is not constant" with gcc 3.4.0 in C99 mode on
OSX 10.3.3. It compiled as expected with gcc 3.3 from Apple's X-Code 1.2. Section 7.12[5] of the C99
spec says that NAN expands to a constant expression.
#include <math.h>
const volatile static float arg2_float_23 = NAN;
Similar results when I hard-coded the path to the 3.4.0 version of math.h; session below, and I'll
attach the preprocessed file, which did indeed fail to define NAN as a constant.
The problem seems to be that __APPLE_CC__ is no longer defined in 3.4.0 (though __APPLE__ still is);
but the math.h with 3.4.0 (built from the gnu sources) still depends on it:
#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)
#define NAN __builtin_nanf("0x7fc00000") /* Constant expression, can be used as initializer. */
#else
#define NAN __nan( )
#endif
Adding "-D__APPLE_CC__=1642" to the command line worked around the problem.
Here are the diffs between the predefined macros in the two versions; the other ones look fairly
innocuous, except perhaps for __GXX_ABI_VERSION, which I don't understand.
3d2
< #define __APPLE_CC__ 1640
10a10,11
> #define __DBL_HAS_INFINITY__ 1
> #define __DBL_HAS_QUIET_NAN__ 1
24a26,27
> #define __FLT_HAS_INFINITY__ 1
> #define __FLT_HAS_QUIET_NAN__ 1
33c36
< #define __GNUC_MINOR__ 3
---
> #define __GNUC_MINOR__ 4
36c39
< #define __GXX_ABI_VERSION 102
---
> #define __GXX_ABI_VERSION 1002
40a44,45
> #define __LDBL_HAS_INFINITY__ 1
> #define __LDBL_HAS_QUIET_NAN__ 1
63c68
< #define __VERSION__ "3.3 20030304 (Apple Computer, Inc. build 1640)"
---
> #define __VERSION__ "3.4.0"
- - -
/usr/local/gcc34/bin/gcc -std=c99 -pedantic -lmx -funsigned-char -v -save-temps -c ../c/noerror/
bugfiles/gcc_bugfiles/warn/NAN_not_const-full-path.c
Reading specs from /usr/local/gcc34/lib/gcc/powerpc-apple-darwin7.3.0/3.4.0/specs
Configured with: configure --prefix=/usr/local/gcc34
Thread model: posix
gcc version 3.4.0
/usr/local/gcc34/libexec/gcc/powerpc-apple-darwin7.3.0/3.4.0/cc1 -E -quiet -v -D__DYNAMIC__ ../
c/noerror/bugfiles/gcc_bugfiles/warn/NAN_not_const-full-path.c -fPIC -std=c99 -pedantic
-funsigned-char -o NAN_not_const-full-path.i
ignoring nonexistent directory "/usr/local/gcc34/lib/gcc/powerpc-apple-darwin7.3.0/3.4.0/../../../../
powerpc-apple-darwin7.3.0/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/gcc34/include
/usr/local/gcc34/lib/gcc/powerpc-apple-darwin7.3.0/3.4.0/include
/usr/include
End of search list.
/usr/local/gcc34/libexec/gcc/powerpc-apple-darwin7.3.0/3.4.0/cc1 -fpreprocessed NAN_not_const-
full-path.i -fPIC -quiet -dumpbase NAN_not_const-full-path.c -auxbase NAN_not_const-full-path
-pedantic -std=c99 -version -funsigned-char -o NAN_not_const-full-path.s
GNU C version 3.4.0 (powerpc-apple-darwin7.3.0)
compiled by GNU C version 3.3 20030304 (Apple Computer, Inc. build 1495).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
../c/noerror/bugfiles/gcc_bugfiles/warn/NAN_not_const-full-path.c:2: error: initializer element is not
constant
--
Summary: NAN Is Not a Constant Because __APPLE_CC__ is Not
Defined (OK in Apple 3.3.0)
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: flash at pobox dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin7.3.0/3.4.0
GCC host triplet: powerpc-apple-darwin7.3.0/3.4.0 (--
prefix=/usr/local/gcc34)
GCC target triplet: powerpc-apple-darwin7.3.0/3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug preprocessor/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
@ 2004-05-25 22:28 ` flash at pobox dot com
2004-05-25 23:31 ` [Bug target/15642] " pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: flash at pobox dot com @ 2004-05-25 22:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From flash at pobox dot com 2004-05-25 01:04 -------
Created an attachment (id=6375)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6375&action=view)
Pre-processed source, specifying full path to math.h
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
2004-05-25 22:28 ` [Bug preprocessor/15642] " flash at pobox dot com
@ 2004-05-25 23:31 ` pinskia at gcc dot gnu dot org
2004-05-25 23:43 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-25 23:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-25 01:19 -------
Confirmed, please report this to Apple also as this is a bug in Apple's headers, we can fixincludes them.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|preprocessor |target
Ever Confirmed| |1
GCC build triplet|powerpc-apple- |/3.4.0
|darwin7.3.0/3.4.0 |
GCC host triplet|powerpc-apple- |
|darwin7.3.0/3.4.0 (-- |
|prefix=/usr/local/gcc34) |
GCC target triplet|powerpc-apple- |powerpc-apple-darwin7.3.0
|darwin7.3.0/3.4.0 |
Last reconfirmed|0000-00-00 00:00:00 |2004-05-25 01:19:01
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
2004-05-25 22:28 ` [Bug preprocessor/15642] " flash at pobox dot com
2004-05-25 23:31 ` [Bug target/15642] " pinskia at gcc dot gnu dot org
@ 2004-05-25 23:43 ` pinskia at gcc dot gnu dot org
2004-05-26 2:59 ` flash at pobox dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-25 23:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-25 01:47 -------
We can replace the check for __APPLE_CC__ with a check for __GNUC__, and __GNUC_MINOR__.
--
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|/3.4.0 |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
` (2 preceding siblings ...)
2004-05-25 23:43 ` pinskia at gcc dot gnu dot org
@ 2004-05-26 2:59 ` flash at pobox dot com
2004-05-28 17:36 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: flash at pobox dot com @ 2004-05-26 2:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From flash at pobox dot com 2004-05-25 02:03 -------
Apple bug #3666675:
<https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/6/wo/MPeQbCnDgtJADiIQLAsBN0/
7.27>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
` (3 preceding siblings ...)
2004-05-26 2:59 ` flash at pobox dot com
@ 2004-05-28 17:36 ` pinskia at gcc dot gnu dot org
2005-05-27 0:01 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-28 17:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-28 00:16 -------
I think I have a fixincl fix but I cannot test it until I build autogen which it fails for me.
Here is the inclhack.def part which I created:
/*
* Fixup Darwin's broken check for __builtin_nanf.
*/
fix = {
hackname = broken_nan;
files = "architecture/ppc/math.h";
files = "architecture/i386/math.h";
select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)"
c_fix = format;
c_fxi_arg = "#if defined(__GNUC__) && ((__GNUC__ > 4)||((__GNUC__ > 3) && (__GNUC_MINOR__ >=
3)))"
test_text = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)"
};
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |geoffk at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
` (4 preceding siblings ...)
2004-05-28 17:36 ` pinskia at gcc dot gnu dot org
@ 2005-05-27 0:01 ` pinskia at gcc dot gnu dot org
2005-07-26 4:09 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-27 0:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-27 00:00 -------
I should try this patch soon again now I can regenerate fixincludes.
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2005-02-25 14:36:27 |2005-05-27 00:00:26
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
` (5 preceding siblings ...)
2005-05-27 0:01 ` pinskia at gcc dot gnu dot org
@ 2005-07-26 4:09 ` pinskia at gcc dot gnu dot org
2005-07-26 23:58 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-26 4:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-26 03:26 -------
I will take of this soon.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
` (6 preceding siblings ...)
2005-07-26 4:09 ` pinskia at gcc dot gnu dot org
@ 2005-07-26 23:58 ` pinskia at gcc dot gnu dot org
2005-07-27 0:47 ` pinskia at gcc dot gnu dot org
2005-08-09 18:12 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-26 23:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-26 23:54 -------
Hmm, this no longer works because we fixinclude architecture/ppc/math.h a different way now.
I can no longer fix this.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|pinskia at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
` (7 preceding siblings ...)
2005-07-26 23:58 ` pinskia at gcc dot gnu dot org
@ 2005-07-27 0:47 ` pinskia at gcc dot gnu dot org
2005-08-09 18:12 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-27 0:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-27 00:01 -------
This is also radar 4194286 now because I was tried of this not being fixed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
` (8 preceding siblings ...)
2005-07-27 0:47 ` pinskia at gcc dot gnu dot org
@ 2005-08-09 18:12 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-09 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-09 18:12 -------
I have a fix which I am about to submit.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
[not found] <bug-15642-8581@http.gcc.gnu.org/bugzilla/>
2006-01-19 17:18 ` pinskia at gcc dot gnu dot org
@ 2006-01-19 17:18 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-19 17:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from pinskia at gcc dot gnu dot org 2006-01-19 17:18 -------
Subject: Bug 15642
Author: pinskia
Date: Thu Jan 19 17:18:29 2006
New Revision: 109973
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109973
Log:
2006-01-19 Andrew Pinski <pinskia@physics.uc.edu>
PR target/15642
* inclhack.def (AAB_darwin7_9_long_double_funcs [replace]): Define
__APPLE_CC_ as 1345.
(broken_nan): New.
* fixincl.x: Regenerate.
Modified:
trunk/fixincludes/ChangeLog
trunk/fixincludes/fixincl.x
trunk/fixincludes/inclhack.def
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/15642] NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0)
[not found] <bug-15642-8581@http.gcc.gnu.org/bugzilla/>
@ 2006-01-19 17:18 ` pinskia at gcc dot gnu dot org
2006-01-19 17:18 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-19 17:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from pinskia at gcc dot gnu dot org 2006-01-19 17:18 -------
Fixed in 4.2.0.
--
pinskia 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=15642
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-01-19 17:18 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-25 22:19 [Bug preprocessor/15642] New: NAN Is Not a Constant Because __APPLE_CC__ is Not Defined (OK in Apple 3.3.0) flash at pobox dot com
2004-05-25 22:28 ` [Bug preprocessor/15642] " flash at pobox dot com
2004-05-25 23:31 ` [Bug target/15642] " pinskia at gcc dot gnu dot org
2004-05-25 23:43 ` pinskia at gcc dot gnu dot org
2004-05-26 2:59 ` flash at pobox dot com
2004-05-28 17:36 ` pinskia at gcc dot gnu dot org
2005-05-27 0:01 ` pinskia at gcc dot gnu dot org
2005-07-26 4:09 ` pinskia at gcc dot gnu dot org
2005-07-26 23:58 ` pinskia at gcc dot gnu dot org
2005-07-27 0:47 ` pinskia at gcc dot gnu dot org
2005-08-09 18:12 ` pinskia at gcc dot gnu dot org
[not found] <bug-15642-8581@http.gcc.gnu.org/bugzilla/>
2006-01-19 17:18 ` pinskia at gcc dot gnu dot org
2006-01-19 17:18 ` 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).