This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22565] New: GCC 3.4.1 Complex cast error in a kernel module compilation
- From: "erwann dot houzay at laposte dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jul 2005 08:47:42 -0000
- Subject: [Bug c/22565] New: GCC 3.4.1 Complex cast error in a kernel module compilation
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I've found the following bug compiling the c code below:
/root/Interface_thread_buffered/RTAI_GYRO.c: In function `fill_data_gyro':
/root/Interface_thread_buffered/RTAI_GYRO.c:68: error: unrecognizable insn:
(insn:HI 87 86 88 0 (set (reg:DF 112)
(float:DF (reg:HI 113))) -1 (insn_list 86 (nil))
(expr_list:REG_DEAD (reg:HI 113)
(nil)))
/root/Interface_thread_buffered/RTAI_GYRO.c:68: internal compiler error: in
extract_insn, at recog.c:2083
Please submit a full bug report,
with preprocessed source if appropriate.
The "fill_data_gyro" function contain the following code:
int fill_data_gyro(unsigned char *buf, double *angle){
unsigned char c;
unsigned char R[2];
char cs; //CheckSum recupere
unsigned char cs_add; //Checkum calcule
//Constantes constructeur
double LSB_Angle=0.000305;
-----------
R[1] = (buf[5]<<6) | (buf[6]>>1); //c=R15-----R8
cs_add+=R[1] & 0xff ;
R[0] = buf[6]<<7 | buf[7]; //c=R7-----R0
cs_add+=R[0] & 0xff;
* angle= -LSB_Angle * (* (short *) &R);
-----------
return 0;
}
Commenting the "* angle= -LSB_Angle * (* (short *) &R);" the complilation work
perfectly
The makefile is the following:
SOURCES = RTAI_GYRO.c
obj-m := $(SOURCES:.c=.o)
RTAI = /usr/realtime
EXTRA_CFLAGS = -I$(RTAI)/include -I/usr/include/
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
(it's a kernel module for RTAI...)
I've compiled this code inside an other application and it works perfectly
even with the "* angle= -LSB_Angle * (* (short *) &R);" line...
The gcc options associated: gcc -Wall -g -lm ....
I'm a neaby in Linux and it's possible that this kind of cast (* (short *) &R)
is not very clear for the compiler (....the star represents alternatively a
pointeur and the multiplication symbol...)
I hope not to report a know bug...
My system is a Mdk 10.1 with a 2.6.7 kernel from kernel.org....(I need a
standard kernel for RTAI developping....)
bye
Erwann
--
Summary: GCC 3.4.1 Complex cast error in a kernel module
compilation
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: erwann dot houzay at laposte dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22565