bug report for gcc

Atakan Gurkan ato@snowmass.phys.nwu.edu
Tue May 1 15:42:00 GMT 2001


Hi,
I am using a RedHat Linux box, uname -a gives:
	Linux sunlight 2.2.14-5.0 #1 Sun Aug 6 21:28:32 CDT 2000 i686 unknown
with gcc, gcc --version gives:
	egcs-2.91.66
i don't have gccbug installed in my system, sorry about that.
 
I want to report a bug. When one tries to compile the program below, gcc
fails giving:
	buggy.c: In function `main':
	buggy.c:12: type mismatch in conditional expression
there is a workaround this by putting the values in the conditional expression
into variables, as can be seen at the continuation of the program. I think
the problematic line is legal input but gcc is refusing it. If you comment
the line out the output of the program is what you (at least I) would expect.

I don't know how to use a debugger on complex vars so I can't give more 
detailed information. I hope you can reproduce this behaviour.
best regards,

atakan gurkan

#include <stdio.h>
#define _Imaginary_I (1.0fi)
#define I _Imaginary_I
#define complex __complex__
#define cimag(x) (__imag__ (x))
#define creal(x) (__real__ (x))

int main(){
	int i, j;
	complex double a, b, c;

	i = 5; j = 3;
	a = (i%j) ? (1.0+0.0*I) : (0.0+1.0*I);
	a = 1.0 + 0.0*I;
	b = 0.0 + 1.0*I;
	c = (i%j) ? a : b;
	printf("%f %f\n", creal(c), cimag(c));
	i = 5; j = 5;
	c = (i%j) ? a : b;
	printf("%f %f\n", creal(c), cimag(c));
	
	return(0);
}



More information about the Gcc-bugs mailing list