errors running clang/test testcases

Hi,

I am trying to learn a bit more about working on clang C++ support. I think the test setup is quite nice and I made a stab at a test/cxx-extern.cpp which emit some errors for C++ uses of the extern keyword that I will try to fix parsing and AST for. Preprossessing of extern and assosiated tokens seems to be Ok.

However, there are other tests that fail on my platform (RedHat FC4 and GCC 4.0.2)

make | grep FAILED! | uniq | sed "s%*%%g"
TEST 'CodeGen/mandel.c' FAILED!
TEST 'Parser/cxx-extern.cpp' FAILED!
TEST 'Sema/undecl-objc-h.m' FAILED!
TEST 'Sema/protocol-rewrite-1.m' FAILED!
TEST 'Sema/objc-comptypes-2.m' FAILED!
TEST 'Sema/objc-comptypes-6.m' FAILED!
TEST 'Sema/undef-field-reference-1.m' FAILED!
TEST 'Sema/rewrite-protocol-type-1.m' FAILED!
TEST 'Sema/objc-super-test.m' FAILED!
TEST 'Sema/objc-comptypes-1.m' FAILED!
TEST 'Sema/objc-comptypes-3.m' FAILED!
TEST 'Sema/objc-comptypes-5.m' FAILED!
TEST 'Sema/objc-comptypes-7.m' FAILED!
TEST 'Sema/rewrite-api-bug.m' FAILED!
TEST 'Sema/id-test-3.m' FAILED!

see attached clang-test.txt for details. Many of the objc problems have the same root cause, but I do not feel like hacking evrywhere in clang yet ;-). Don't really know anything about Objective-C anyway. I am kind of in the dark here. Are these known issues that I should ignore or not?

Are there any status available, nightly build report or similar, for various platforms? I found http://llvm.org/nightlytest/index.php. But are these relevant for clang?

clang-test.txt (21.8 KB)

I am trying to learn a bit more about working on clang C++ support. I think the test setup is quite nice and I made a stab at a test/cxx-extern.cpp which emit some errors for C++ uses of the extern keyword that I will try to fix parsing and AST for. Preprossessing of extern and assosiated tokens seems to be Ok.

Ok.

Are there any status available, nightly build report or similar, for various platforms? I found http://llvm.org/nightlytest/index.php. But are these relevant for clang?

Nope, not yet.

******************** TEST 'CodeGen/mandel.c' FAILED! ********************
Command:
clang -emit-llvm CodeGen/mandel.c
Output:
CodeGen/mandel.c:49:13: error: variable has incomplete type 'typeof(*(0 ? (typeof(0 ? (double *)0 : (void *)((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 - 1)))))0 : (typeof(0 ? (typeof((__real z) + (__imag z)) *)0 : (void *)(!((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 - 1))))))0))'
       if (hypot(__real__ z, __imag__ z) >= ESCAPE)

Please make a .i file for mandel.c (clang -E mandel.c > mandel.i) and send it to the list.

******************** TEST 'Parser/cxx-extern.cpp' FAILED! ********************
Command:
clang -fsyntax-only Parser/cxx-extern.cpp
Output:
Parser/cxx-extern.cpp:19:8: error: expected identifier or '('

This isn't in the clang tree.

******************** TEST 'Sema/undecl-objc-h.m' FAILED! ********************
Command:
clang -rewrite-test Sema/undecl-objc-h.m | clang
Output:
In file included from <stdin>:23:
/usr/lib/gcc/i386-redhat-linux/4.0.2/include/objc/objc.h:145:3: error: redefinition of 'Protocol'
} Protocol;
^
<stdin>:7:28: error: previous definition is here
typedef struct objc_object Protocol;
                          ^

This looks like a platform specific difference between your objc.h and hte mac one, can you please attach your objc.h so that we can see what it looks like?

******************** TEST 'Sema/objc-comptypes-2.m' FAILED! ********************
Command:
clang -fsyntax-only -verify Sema/objc-comptypes-2.m
Output:
Errors seen but not expected:
Line 63: incomplete definition of type 'objc_selector'

Likewise, looks like your objc.h doesn't have objc_selector in it?

-Chris

Chris Lattner wrote:

Thanks for your reply Chris,

******************** TEST 'CodeGen/mandel.c' FAILED! ********************
Command:
clang -emit-llvm CodeGen/mandel.c
Output:
CodeGen/mandel.c:49:13: error: variable has incomplete type 'typeof(*(0 ? (typeof(0 ? (double *)0 : (void *)((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 - 1)))))0 : (typeof(0 ? (typeof((__real z) + (__imag z)) *)0 : (void *)(!((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 - 1))))))0))'
       if (hypot(__real__ z, __imag__ z) >= ESCAPE)

Please make a .i file for mandel.c (clang -E mandel.c > mandel.i) and send it to the list.

attached

******************** TEST 'Parser/cxx-extern.cpp' FAILED! ********************
Command:
clang -fsyntax-only Parser/cxx-extern.cpp
Output:
Parser/cxx-extern.cpp:19:8: error: expected identifier or '('

This isn't in the clang tree.

It is if you add it :-). All tests pass after Mike's extern patch. File attached.

******************** TEST 'Sema/undecl-objc-h.m' FAILED! ********************
Command:
clang -rewrite-test Sema/undecl-objc-h.m | clang
Output:
In file included from <stdin>:23:
/usr/lib/gcc/i386-redhat-linux/4.0.2/include/objc/objc.h:145:3: error: redefinition of 'Protocol'
} Protocol;
^
<stdin>:7:28: error: previous definition is here
typedef struct objc_object Protocol;
                          ^

This looks like a platform specific difference between your objc.h and hte mac one, can you please attach your objc.h so that we can see what it looks like?

done.

objc.h (5.6 KB)

mandel.i (43.4 KB)

cxx-extern.cpp (1.74 KB)

Okay, this ugliness seems to be because your system hypot expands out into some amazingly nasty stuff. Here is a reduced testcase:

void foo() {
   *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
}

cond.c:2:3: warning: dereferencing void pointer
   *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cond.c:2:51: error: incomplete type 'void' is not assignable
   *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

This is because of this fixme in sema:

       // The pointer types are compatible.
       // C99 6.5.15p6: If both operands are pointers to compatible types *or* to
       // differently qualified versions of compatible types, the result type is
       // a pointer to an appropriately qualified version of the *composite*
       // type.
       // FIXME: Need to return the composite type.
       return lexT;

Steve, can you please take a look at this? Also, the code isn't handling a number of other cases explicitly mentioned in the standard, such as "const int *" + "volatile int *" -> "const volatile int*".

Thanks,

-Chris

Chris Lattner wrote:

Thanks for your reply Chris,

******************** TEST 'CodeGen/mandel.c' FAILED!
********************
Command:
clang -emit-llvm CodeGen/mandel.c
Output:
CodeGen/mandel.c:49:13: error: variable has incomplete type
'typeof(*(0 ? (typeof(0 ? (double *)0 : (void *)((((typeof((__real
z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 -
1)))))0 : (typeof(0 ? (typeof((__real z) + (__imag z)) *)0 : (void
*)(!((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real
z) + (__imag z)))0.25 - 1))))))0))'
     if (hypot(__real__ z, __imag__ z) >= ESCAPE)

Please make a .i file for mandel.c (clang -E mandel.c > mandel.i)
and send it to the list.

attached

Okay, this ugliness seems to be because your system hypot expands out
into some amazingly nasty stuff. Here is a reduced testcase:

void foo() {
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
}

cond.c:2:3: warning: dereferencing void pointer
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cond.c:2:51: error: incomplete type 'void' is not assignable
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

This is because of this fixme in sema:

      // The pointer types are compatible.
      // C99 6.5.15p6: If both operands are pointers to compatible
types *or* to
      // differently qualified versions of compatible types, the
result type is
      // a pointer to an appropriately qualified version of the
*composite*
      // type.
      // FIXME: Need to return the composite type.
      return lexT;

Steve, can you please take a look at this? Also, the code isn't
handling a number of other cases explicitly mentioned in the standard,
such as "const int *" + "volatile int *" -> "const volatile int*".

I'll look into this first thing tomorrow morning...

snaroff

Chris Lattner wrote:

Thanks for your reply Chris,

******************** TEST 'CodeGen/mandel.c' FAILED!
********************
Command:
clang -emit-llvm CodeGen/mandel.c
Output:
CodeGen/mandel.c:49:13: error: variable has incomplete type
'typeof(*(0 ? (typeof(0 ? (double *)0 : (void *)((((typeof((__real
z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 -
1)))))0 : (typeof(0 ? (typeof((__real z) + (__imag z)) *)0 : (void
*)(!((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real
z) + (__imag z)))0.25 - 1))))))0))'
     if (hypot(__real__ z, __imag__ z) >= ESCAPE)

Please make a .i file for mandel.c (clang -E mandel.c > mandel.i)
and send it to the list.

attached

Okay, this ugliness seems to be because your system hypot expands out
into some amazingly nasty stuff. Here is a reduced testcase:

void foo() {
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
}

cond.c:2:3: warning: dereferencing void pointer
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cond.c:2:51: error: incomplete type 'void' is not assignable
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

This is because of this fixme in sema:

      // The pointer types are compatible.
      // C99 6.5.15p6: If both operands are pointers to compatible
types *or* to
      // differently qualified versions of compatible types, the
result type is
      // a pointer to an appropriately qualified version of the
*composite*
      // type.
      // FIXME: Need to return the composite type.
      return lexT;

Steve, can you please take a look at this? Also, the code isn't
handling a number of other cases explicitly mentioned in the standard,
such as "const int *" + "volatile int *" -> "const volatile int*".

I just submitted a fix for this. The FIXME still remains (it didn't have anything to do with this particular bug).

I will handle the remaining issues in a separate commit...

snaroff

Steve Naroff wrote:

Chris Lattner wrote:

Thanks for your reply Chris,

******************** TEST 'CodeGen/mandel.c' FAILED!
********************
Command:
clang -emit-llvm CodeGen/mandel.c
Output:
CodeGen/mandel.c:49:13: error: variable has incomplete type
'typeof(*(0 ? (typeof(0 ? (double *)0 : (void *)((((typeof((__real
z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 -
1)))))0 : (typeof(0 ? (typeof((__real z) + (__imag z)) *)0 : (void
*)(!((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real
z) + (__imag z)))0.25 - 1))))))0))'
     if (hypot(__real__ z, __imag__ z) >= ESCAPE)

Please make a .i file for mandel.c (clang -E mandel.c > mandel.i)
and send it to the list.

attached

Okay, this ugliness seems to be because your system hypot expands out
into some amazingly nasty stuff. Here is a reduced testcase:

void foo() {
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
}

cond.c:2:3: warning: dereferencing void pointer
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cond.c:2:51: error: incomplete type 'void' is not assignable
  *((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

This is because of this fixme in sema:

      // The pointer types are compatible.
      // C99 6.5.15p6: If both operands are pointers to compatible
types *or* to
      // differently qualified versions of compatible types, the
result type is
      // a pointer to an appropriately qualified version of the
*composite*
      // type.
      // FIXME: Need to return the composite type.
      return lexT;

Steve, can you please take a look at this? Also, the code isn't
handling a number of other cases explicitly mentioned in the standard,
such as "const int *" + "volatile int *" -> "const volatile int*".

I just submitted a fix for this. The FIXME still remains (it didn't have anything to do with this particular bug).

I did svn update of both llvm and clang, and rebuild all

[bjorn@frodo clang]$ svn update
At revision 45757.

I still seem to have the same problem in test/CodeGen/mantel.c. I have
provided mantel.i before, so if you compiled successfully with that as
input there must be something else? I am not sure if you expected this
to go away. If you tested the limitet testcase Chris made, that may not
have done it.

CodeGen/mandel.c
******************** TEST 'CodeGen/mandel.c' FAILED! ********************
Command:
clang -emit-llvm CodeGen/mandel.c
Output:
CodeGen/mandel.c:49:13: error: variable has incomplete type 'typeof(*(0
? (typeof(0 ? (double *)0 : (void *)((((typeof((__real z) + (__imag
z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 - 1)))))0 :
(typeof(0 ? (typeof((__real z) + (__imag z)) *)0 : (void
*)(!((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real z) +
(__imag z)))0.25 - 1))))))0))'
        if (hypot(__real__ z, __imag__ z) >= ESCAPE)
            ^
CodeGen/mandel.c:49:43: error: invalid operands to binary expression
('void' and 'int')
        if (hypot(__real__ z, __imag__ z) >= ESCAPE)
            ~~~~~ ^ ~~~~~~
2 diagnostics generated.
; ModuleID = 'foo'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i686-pc-linux-gnu"
@accum = global { double, double } zeroinitializer ; <{ double,
double }*> [#uses=0]
******************** TEST 'CodeGen/mandel.c' FAILED! ********************

This is not critical issue or platform for me, this platform is only
used out of convenience as it is up and running in my home. As of right
now it is really only noise in the test output while I am experimenting
with clang, I can live with that until I get a new box most likly with
ubuntu up and running. The harddrive on my old laptop died recently, so
that give me excuse to get a new laptop :slight_smile:

I could look into this problem more if you like me to, I am happy to try
to help.

Also, it should be noted thay my working copy is not clean, see svn
status under. Is there a smart way of working with svn so I can pull my
own working copy changes temporarilly out for testing, then put them
back in. Having two working copies may be the obivious solution, but
having to rebuild all llvm stuff all the time is not all that smooth. I
have tried svk before, and that may be better for me as a none-comitter
in the clang repository. It provide me with local repository, local
branches, and good merge tools. But I am not sure if that really helps
me. Extra working copies may be just as usefull. Any ideas?

[bjorn@frodo clang]$ svn status
? TAGS
? BROWSE
? test/%t1
? test/Lexer/Output
? test/Lexer/c90pedantic.c
M test/Lexer/c90.c
M test/TestRunner.sh
? test/Parser/cxx-extern.cpp
? test/Parser/Output
? test/Parser/c99-cxx-aggregate-initialisers.cpp
M include/clang/Basic/DiagnosticKinds.def
M include/clang/CodeGen/ModuleBuilder.h
M include/clang/AST/ASTContext.h
M include/clang/AST/Decl.h
M include/clang/AST/Type.h
M include/clang/Parse/Parser.h
M include/clang/Parse/Action.h
M Sema/Sema.h
M Sema/SemaDecl.cpp
? AST/Decl.cpp.mine
? AST/Decl.cpp.orig
? AST/Decl.cpp.r45745
? AST/Decl.cpp.r45593
C AST/Decl.cpp
? Driver/ASTConsumers.cpp.r45745
? Driver/ASTConsumers.cpp.r45593
? Driver/ASTConsumers.cpp.mine
? Driver/ASTConsumers.cpp.orig
M Driver/clang.cpp
C Driver/ASTConsumers.cpp
? CodeGen/ModuleBuilder.cpp.orig
M CodeGen/ModuleBuilder.cpp
M Parse/ParseDeclCXX.cpp
M Parse/Parser.cpp

The two conflicts are manually synched with repository version.

[bjorn@frodo clang]$ svn status | grep "^C"
C AST/Decl.cpp
C Driver/ASTConsumers.cpp
[bjorn@frodo clang]$ svn update AST/Decl.cpp
At revision 45759.
[bjorn@frodo clang]$ svn update Driver/ASTConsumers.cpp
At revision 45759.

I only tested Chris's reduced test case (as you suggest).

I am able to reproduce this using your .i file. Unfortunately, the expression is still hard to work with (since it's nearly 1000 characters long).

If you could provide a reduced test case, it would help me localize/nail this bug.

Thanks,

snaroff

Steve Naroff skrev:

Steve Naroff wrote:

Chris Lattner wrote:

Thanks for your reply Chris,

******************** TEST 'CodeGen/mandel.c' FAILED!
********************
Command:
clang -emit-llvm CodeGen/mandel.c
Output:
CodeGen/mandel.c:49:13: error: variable has incomplete type
'typeof(*(0 ? (typeof(0 ? (double *)0 : (void *)((((typeof((__real
z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 -
1)))))0 : (typeof(0 ? (typeof((__real z) + (__imag z)) *)0 : (void
*)(!((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real
z) + (__imag z)))0.25 - 1))))))0))'
    if (hypot(__real__ z, __imag__ z) >= ESCAPE)

Please make a .i file for mandel.c (clang -E mandel.c > mandel.i)
and send it to the list.

attached

Okay, this ugliness seems to be because your system hypot expands out
into some amazingly nasty stuff. Here is a reduced testcase:

void foo() {
*((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
}

cond.c:2:3: warning: dereferencing void pointer
*((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cond.c:2:51: error: incomplete type 'void' is not assignable
*((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

This is because of this fixme in sema:

     // The pointer types are compatible.
     // C99 6.5.15p6: If both operands are pointers to compatible
types *or* to
     // differently qualified versions of compatible types, the
result type is
     // a pointer to an appropriately qualified version of the
*composite*
     // type.
     // FIXME: Need to return the composite type.
     return lexT;

Steve, can you please take a look at this? Also, the code isn't
handling a number of other cases explicitly mentioned in the standard,
such as "const int *" + "volatile int *" -> "const volatile int*".

I just submitted a fix for this. The FIXME still remains (it didn't have anything to do with this particular bug).

I did svn update of both llvm and clang, and rebuild all

[bjorn@frodo clang]$ svn update
At revision 45757.

I still seem to have the same problem in test/CodeGen/mantel.c. I have
provided mantel.i before, so if you compiled successfully with that as
input there must be something else? I am not sure if you expected this
to go away. If you tested the limitet testcase Chris made, that may not
have done it.

I only tested Chris's reduced test case (as you suggest).

I am able to reproduce this using your .i file. Unfortunately, the expression is still hard to work with (since it's nearly 1000 characters long).

If you could provide a reduced test case, it would help me localize/nail this bug.

Ok, I will see when I get some time. That will not happen in the first few days, but if this only directly affects me now, then that is probably ok.

For the records: it affects me too.

Ok, I will see when I get some time. That will not happen in the first
few days, but if this only directly affects me now, then that is
probably ok.

For the records: it affects me too.

Good to know. As soon as I get a simplified test case, I will work on a fix.

Thanks,

snaroff

Bjørn Roald skrev:

Steve Naroff skrev:
  

Steve Naroff wrote:
      

Chris Lattner wrote:

Thanks for your reply Chris,
            

******************** TEST 'CodeGen/mandel.c' FAILED!
********************
Command:
clang -emit-llvm CodeGen/mandel.c
Output:
CodeGen/mandel.c:49:13: error: variable has incomplete type
'typeof(*(0 ? (typeof(0 ? (double *)0 : (void *)((((typeof((__real
z) + (__imag z)))0.25) && ((typeof((__real z) + (__imag z)))0.25 -
1)))))0 : (typeof(0 ? (typeof((__real z) + (__imag z)) *)0 : (void
*)(!((((typeof((__real z) + (__imag z)))0.25) && ((typeof((__real
z) + (__imag z)))0.25 - 1))))))0))'
    if (hypot(__real__ z, __imag__ z) >= ESCAPE)
                

Please make a .i file for mandel.c (clang -E mandel.c > mandel.i)
and send it to the list.
              

attached
            

Okay, this ugliness seems to be because your system hypot expands out
into some amazingly nasty stuff. Here is a reduced testcase:

void foo() {
*((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
}

cond.c:2:3: warning: dereferencing void pointer
*((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cond.c:2:51: error: incomplete type 'void' is not assignable
*((__typeof__ (0 ? (double *)0 : (void *)0)) 0) = 0;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

This is because of this fixme in sema:

     // The pointer types are compatible.
     // C99 6.5.15p6: If both operands are pointers to compatible
types *or* to
     // differently qualified versions of compatible types, the
result type is
     // a pointer to an appropriately qualified version of the
*composite*
     // type.
     // FIXME: Need to return the composite type.
     return lexT;

Steve, can you please take a look at this? Also, the code isn't
handling a number of other cases explicitly mentioned in the standard,
such as "const int *" + "volatile int *" -> "const volatile int*".

I just submitted a fix for this. The FIXME still remains (it didn't have anything to do with this particular bug).
        

I did svn update of both llvm and clang, and rebuild all

[bjorn@frodo clang]$ svn update
At revision 45757.

I still seem to have the same problem in test/CodeGen/mantel.c. I have
provided mantel.i before, so if you compiled successfully with that as
input there must be something else? I am not sure if you expected this
to go away. If you tested the limitet testcase Chris made, that may not
have done it.

I only tested Chris's reduced test case (as you suggest).

I am able to reproduce this using your .i file. Unfortunately, the expression is still hard to work with (since it's nearly 1000 characters long).

If you could provide a reduced test case, it would help me localize/nail this bug.
    
Ok, I will see when I get some time. That will not happen in the first few days, but if this only directly affects me now, then that is probably ok.
  

Ok, here is one function which give the error in clang and is accepted by gcc.
Then there is a function that is accepted by both compilers. Hope this helps.

void f3_2_0() {
   __typeof__ (* (__typeof__ (0 ? (double *) 0 : (void *) (double*) 0 ) ) 0 ) a; // gcc: Ok , clang error ^^^^^^^^^
}

void f3_2_0_1() {
   __typeof__ (* (__typeof__ (0 ? (double *) 0 : (void *) 0 ) ) 0 ) a;
   // gcc/clang: Ok ^^^^^^^^
}

Simplifying further caused the two compilerd to behave in the same way, accepting or rejecting the code.

Thanks much for the test case. Commit r45951 should fix this problem.

Please let me know if you have any problems,

snaroff

Steve Naroff skrev:

Thanks much for the test case. Commit r45951 should fix this problem.

Please let me know if you have any problems,

The testcase I sendt was solved by r45951 :-). However clang is still not happy with test/CodeGen/mandel.c. This macro expanded code is nuts, so don't ask me what it mean or whether it make sence to support this stuff. Looking at it closer I think the last one I sendt may have been a side-step from the original problem, but nevertheless a clang/gcc diff. I now get the following set of interesting tast cases. The two first testcases involve casting boolean value to (void*), which seems to cause different behaviour than gcc. The last 3 simply show that the compilers does the same thing if dealing with int directly or if the conditional operation is removed.

void f3_2_3_0() { __typeof__(* (__typeof__ (0 ? (double*) 0 : (void *) (!(((double) 0.25) && ((double) 0.25 - 1))))) 0 ) a;} // gcc: Ok , clang error: variable has incomplete type ...
void f3_2_3_1() { __typeof__(* (__typeof__ (0 ? (double*) 0 : (void *) (!(int) 1))) 0 ) a;} // gcc: Ok , clang error: variable has incomplete type ...
void f3_2_3_2() { __typeof__(* (__typeof__ (0 ? (double*) 0 : (void *) ( (int) 0))) 0 ) a;} // gcc/clang: Ok
void f3_2_3_3() { __typeof__(* (__typeof__ (0 ? (double*) 0 : (void *) ( (int) 1))) 0 ) a;} // gcc/clang: error
void f3_2_3_4() { __typeof__(* (__typeof__ ( (void *) (!(int) 1))) 0 ) a;} // gcc/clang: error

regards,