[uClibc]Strange long long division problem with gcc-3.2.x/uclibc on ARM

root ch at murgatroid.com
Fri Mar 14 03:56:50 UTC 2003


The appended little program crashes with gcc-3.2.2 and uclibc 0.9.19
under 2.5.59-rmk1.  (It also failed on an earlier 3.2 and uclibc
combo.)  

To wit:

# /home/ch/src/arm/play/divtest-3.2.2-uclibc-0.9.19 
pgd = c3b08000
[0000000a] *pgd=c3de2011, *pte=00000000, *ppte=00000000
pc : [<000085f8>]    lr : [<00008588>]    Not tainted
sp : befffdb4  ip : 00000000  fp : 00000032
r10: 00010f74  r9 : 00000000  r8 : 00000001
r7 : 00000000  r6 : 0000000a  r5 : 00000000  r4 : 00000000
r3 : 00000000  r2 : 00000018  r1 : 00000000  r0 : 0000000a
Flags: Nzcv  IRQs on  FIQs on  Mode USER_32  Segment user
Control: C3B0B17F  Table: C3B0B17F  DAC: 00000015
Segmentation fault
# 

It works fine compiled with gcc-2.95.4.

The strange part -- if you uncomment the "div done" printf, it works
with 3.2.2:

# /home/ch/src/arm/play/divtest-3.2.2-uclibc-0.9.19 
div done
50 / 10 = 5
# 

Any thoughts?

-ch


#include <stdio.h>

int main (int arg, char **argv) 
{
	unsigned long long a, b, c;

	a = 50;
	b = 10;

	c = a / b;

	//printf("div done\n"); fflush(stdout);
	printf("%lld / %lld = %lld\n", a, b, c);
}



More information about the uClibc mailing list