Bug 5753

Summary: ieee754.h: wrong check __FLOAT_WORD_ORDER
Product: glibc Reporter: Aurelien Jarno <aurelien>
Component: mathAssignee: Andreas Jaeger <aj>
Status: RESOLVED FIXED    
Severity: normal CC: glibc-bugs
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: armv5tejl-unknown-linux-gnu Target: armv5tejl-unknown-linux-gnu
Build: armv5tejl-unknown-linux-gnu Last reconfirmed:
Attachments: Patch to fix the problem.

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.