Bug 5753 - ieee754.h: wrong check __FLOAT_WORD_ORDER
Summary: ieee754.h: wrong check __FLOAT_WORD_ORDER
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Andreas Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-10 19:17 UTC by Aurelien Jarno
Modified: 2014-07-02 07:33 UTC (History)
1 user (show)

See Also:
Host: armv5tejl-unknown-linux-gnu
Target: armv5tejl-unknown-linux-gnu
Build: armv5tejl-unknown-linux-gnu
Last reconfirmed:
fweimer: security-


Attachments
Patch to fix the problem. (550 bytes, patch)
2008-02-10 19:18 UTC, Aurelien Jarno
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aurelien Jarno 2008-02-10 19:17:25 UTC
In /usr/include/ieee754.h you can find the following check:

# if    __FLOAT_WORD_ORDER == BIG_ENDIAN

However bits/endian.h defines __BIG_ENDIAN, not BIG_ENDIAN.
Comment 1 Aurelien Jarno 2008-02-10 19:18:03 UTC
Created attachment 2243 [details]
Patch to fix the problem.
Comment 2 Andreas Jaeger 2008-03-09 12:45:11 UTC
This should not be a problem at all.  The header <endian.h> defines:

#ifdef  __USE_BSD
# define LITTLE_ENDIAN  __LITTLE_ENDIAN
# define BIG_ENDIAN     __BIG_ENDIAN
# define PDP_ENDIAN     __PDP_ENDIAN
# define BYTE_ORDER     __BYTE_ORDER
#endif

Nevertheless, it might be cleaner to do as you propose.
Comment 3 Aurelien Jarno 2008-03-09 13:21:11 UTC
The bug is not present when __USE_BSD is used, that is by default. When you 
start to use some options like -ansi, it is not defined anymore, and the 
problem appears.
Comment 4 Sourceware Commits 2008-03-10 06:21:10 UTC
Subject: Bug 5753

CVSROOT:	/cvs/glibc
Module name:	ports
Changes by:	aj@sourceware.org	2008-03-10 06:20:30

Modified files:
	.              : ChangeLog.mips 
	sysdeps/mips   : ieee754.h 

Log message:
	[BZ #5753]
	* sysdeps/mips/ieee754.h: Use protected namespace
	__BIG_ENDIAN/__LITTLE_ENDIAN.
	Patch by Aurelien Jarno <aurelien@aurel32.net>.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/ports/ChangeLog.mips.diff?cvsroot=glibc&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/ports/sysdeps/mips/ieee754.h.diff?cvsroot=glibc&r1=1.2&r2=1.3

Comment 5 Sourceware Commits 2008-03-10 06:22:08 UTC
Subject: Bug 5753

CVSROOT:	/cvs/glibc
Module name:	libc
Changes by:	aj@sourceware.org	2008-03-10 06:21:22

Modified files:
	sysdeps/ia64   : ieee754.h 
	sysdeps/ieee754: ieee754.h 

Log message:
	[BZ #5753]
	* sysdeps/ia64/ieee754.h: Use protected namespace
	__BIG_ENDIAN/__LITTLE_ENDIAN.
	* sysdeps/ieee754/ieee754.h: Likewise.
	Patch by Aurelien Jarno <aurelien@aurel32.net>.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ia64/ieee754.h.diff?cvsroot=glibc&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ieee754.h.diff?cvsroot=glibc&r1=1.12&r2=1.13

Comment 6 Andreas Jaeger 2008-03-10 06:22:44 UTC
Fixed in glibc cvs HEAD.