EmbDev.net

Forum: ARM programming with GCC/GNU tools Seg fault building Newlib


von Clifford S. (clifford)


Rate this post
useful
not useful
This is the error message:

gcc -I/e/projects/newlib/newlib-1.14.0/newlib/targ-include
-I/e/projects/newlib/newlib-1.14.0/newlib/libc/include
-DPACKAGE=\"newlib\" -DVERSION=\"1.14.0\"  -I. -I.  -I./../common -O2
-D__NO_SYSCALLS__ -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY -fno-builtin
-mfpu=vfp -mfloat-abi=softfp -mhard-float -mthumb-interwork
-mlittle-endian    -g -c s_floor.c
s_floor.c: In function 'floor':
s_floor.c:90: internal compiler error: Segmentation fault

Compiler: gcc version 4.0.2 (WinARM)

This fault occurs specifically with -mfpu=vfp -mfloat-abi=softfp
(suggested here:
http://www.codesourcery.com/gnu_toolchains/arm/faq.html#q_usage_use_vfp).
The occurance of the fault is influenced by the source being compiled,
since other sources with floating point code have compiled. I have also
seen this error in code I used for evaluating the Philips LPC3180, teh
problem went away when I modified the code. Unfortunately I do not have
the details.

I understand that few of you have need for VFP code, but if anybody has
any ideas, solutions, or knows if it persists in 4.1.1 I'd be
interested.

Thanks,

Clifford

von Clifford S. (clifford)


Rate this post
useful
not useful
I have narrowed it down and can reproduce the error with the following:

arm-elf-gcc -c -O2 -mfpu=vfp -mfloat-abi=softfp test.c

where test.c contains:

void test( double x )
{
  return( x >= 0 ? 0 : -1.0 ) ;
}

In fact any expression in the return involving an inequality against x
seems to cause the problem. This code was simply a hack of the code in
mathfp\s_floor.c until I got the smallest code that failed without any
dependencies.

It is the combination -mfpu=vfp and any level of optimisation other than
zero (i.e. no optimisation) that causes the problem. Now I've simplified
it, if someone could try this on GCC 4.1.1 before I risk an upgrade I'd
appreciate it.


Thanks

Clifford

von Clifford S. (clifford)


Rate this post
useful
not useful
Clifford Slocombe wrote:
> ... if someone could try this on GCC 4.1.1 before I risk an upgrade I'd
> appreciate it.

I have now done this myself and can verify the 4.1.1 does not exhibit
this problem.

Clifford

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.