Discussion:
pcc vs musl: ISO C99 complex numbers not fully supported?
Isaac Dunham
2012-06-07 05:12:31 UTC
Permalink
I'm getting this error compiling current musl libc with pcc:
pcc -std=c99 -ffreestanding -nostdinc -D_XOPEN_SOURCE=700
-I./src/internal -I./include -I./arch/i386 -Os -pipe
-fno-stack-protector -c -o src/complex/__cexp.o src/complex/__cexp.c
src/complex/__cexp.c, line 72: operands of CAST have incompatible types
src/complex/__cexp.c, line 73: operands of CAST have incompatible types
make: *** [src/complex/__cexp.o] Error 1

The lines indicated are:

x = creal(z);
y = cimag(z);

Which should be casts from a complex number to respectively a real or
imaginary number; under ISO C99 this should mean the real or imaginary
parts of a complex number.

AFAICT, this is the only thing preventing the build of musl with CC=pcc
--when src/complex/ is removed, it compiles fine.

Thanks,
Isaac Dunham
Szabolcs Nagy
2012-06-07 07:49:51 UTC
Permalink
Post by Isaac Dunham
pcc -std=c99 -ffreestanding -nostdinc -D_XOPEN_SOURCE=700
-I./src/internal -I./include -I./arch/i386 -Os -pipe
-fno-stack-protector -c -o src/complex/__cexp.o src/complex/__cexp.c
src/complex/__cexp.c, line 72: operands of CAST have incompatible types
pcc does not support complex

http://pcc.ludd.ltu.se/jira/browse/PCC-331

the type is recognized but this fails:

_Complex z = 0;
double x = (double)z;

if you want to compile musl with pcc, just remove the src/complex dir
(the other modificatoin you need is to add the pcc lib dir and -lpcc
manually to the linker flags when compiling with -nostdlib)

Loading...