#37062 [NEW]: can't compile on armv5l due to endianity issues
| From: | jan dot rous at matfyz dot cz | Date: | Wed, 12 Apr 2006 23:52:07 +0000 |
| Subject: | #37062 [NEW]: can't compile on armv5l due to endianity issues | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-95722@lists.php.net to get a copy of this message | ||
From: jan dot rous at matfyz dot cz
Operating system: Linux/Debian
PHP version: 5.1.2
PHP Bug Type: Compile Failure
Bug description: can't compile on armv5l due to endianity issues
Description:
------------
Compilation on little endian arm (armv5l, XScale) fails on
Zend/zend_strtod.c due to IEEE_LITTLE_ENDIAN and IEE_BIG_ENDIAN both being
defined:
defines come from Zend/zend_strtod.c:
120 #ifdef WORDS_BIGENDIAN
121 #define IEEE_BIG_ENDIAN
122 #else
123 #define IEEE_LITTLE_ENDIAN
124 #endif
...
126 #if defined(__arm__) && !defined(__VFP_FP__)
127 /*
128 * Although the CPU is little endian the FP has different
129 * byte and word endianness. The byte order is still little
endian
130 * but the word order is big endian.
131 */
132 #define IEEE_BIG_ENDIAN
133 #endif
and result with errors later on:
238 #if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) +
defined(VAX) + \
239 defined(IBM) != 1
240 Exactly one of IEEE_LITTLE_ENDIAN IEEE_BIG_ENDIAN, VAX, or
241 IBM should be defined.
242 #endif
1. such invalid state should be reported using #warning,#error directives.
Writing it this way gives ugly errors:
/root/php5-5.1.2.debpkg/Zend/zend_strtod.c:240: error: syntax error before
"one"
/root/php5-5.1.2.debpkg/Zend/zend_strtod.c:241: error: syntax error before
"IBM"
/root/php5-5.1.2.debpkg/Zend/zend_strtod.c:247: error: syntax error before
'}' token
/root/php5-5.1.2.debpkg/Zend/zend_strtod.c:247: warning: data definition
has no type or storage class
/root/php5-5.1.2.debpkg/Zend/zend_strtod.c: In function `ulp':
/root/php5-5.1.2.debpkg/Zend/zend_strtod.c:935: error: syntax error before
"x"
...
2. commenting out offending section with #warning compilation went without
errors.
make test had some failures, but their relation to this is uncertain.
3. as i've looked through the code, I've noticed that although both
IEEE_BIG_ENDIAN IEEE_LITTLE_ENDIAN are defined,
#if defined(LITTLE_ENDIAN) ... #else ... #endif
are used for decisions.
Under the light of these observations I find lines 126-133 useless on
little endian arms without __VFP_FP__ as they only break compilation.
--
Edit bug report at http://bugs.php.net/?id=37062&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37062&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37062&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37062&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37062&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37062&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37062&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37062&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37062&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37062&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37062&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37062&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37062&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37062&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37062&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37062&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37062&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37062&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37062&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37062&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37062&r=mysqlcfg