[cfe-dev] Crash with complex integer promotion

Eli Friedman eli.friedman at gmail.com
Tue Jan 15 12:03:28 PST 2008


On Jan 15, 2008 11:37 AM, Steve Naroff <snaroff at apple.com> wrote:
> On Jan 15, 2008, at 12:48 AM, Eli Friedman wrote:
>
> > On Jan 12, 2008 8:31 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
> >> void a() {
> >> __complex__ int arr;
> >> __complex__ short brr;
> >> arr*brr;
> >> }
> >>
> >> Crashes clang -fsyntax-only.
> >
> > Oh, and here's another case I ran into:
> >
> > int aa = 1 + 1.0iF;
> >
>
> Fixed in r46005.

Let's be thorough and try all the combinations :)

void Tester() {
__complex short a1;
__complex int a2;
__complex float a3;
__complex double a4;
short a5;
int a6;
float a7;
double a8;
#define TestPair(m,n) int x##m##n = a##m+a##n;
#define TestPairs(m) TestPair(m,1) TestPair(m,2) \
                     TestPair(m,3) TestPair(m,4) \
                     TestPair(m,5) TestPair(m,6) \
                     TestPair(m,7) TestPair(m,8)
TestPairs(1); TestPairs(2);
TestPairs(3); TestPairs(4);
TestPairs(5); TestPairs(6);
TestPairs(7); TestPairs(8);
}

(At the very least, you missed the float + complex integer case.)

-Eli



More information about the cfe-dev mailing list