Ticket #1019 (closed defect: wontfix)
Possible cross-compiler bug involving type coercion
| Reported by: | mail@… | Owned by: | mickey |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | unknown | Version: | 2007.2 |
| Severity: | normal | Keywords: | |
| Cc: | buglog@…, balrogg@…, john_lee@… | Blocked By: | |
| Blocking: | Estimated Completion (week): | ||
| HasPatchForReview: | no | PatchReviewResult: | |
| Reproducible: |
Description
I'm not sure if this is actually a bug or is just due to some undefined behavior
in the program. Anyway, the following test code:
--
#include <stdio.h>
void P(unsigned int a, unsigned int b)
{
printf("%08X %08X\n", a, b);
}
int x = 0xfedcba98;
int main(int argc, char *argv[])
{
double Z = -2.0;
P( x +(int)(50*Z), x + 50 * Z);
return 0;
}
--
will print "FEDCBA34 FEDCBA34" when compiled and run on x86 Linux or on Powerpc
OSX. However, when cross-compiled and run on my Neo1973 it prints "FEDCBA34
00000000". This is the same with -O3 optimization or with no optimization. No
compiler warnings are produced.
$build/tmp/cross/bin/arm-angstrom-linux-gnueabi-gcc --version
arm-angstrom-linux-gnueabi-gcc (GCC) 4.1.2
The compiler was built today (2007-11-21) using 2007.2 MokoMakefile?.
