int main () { return (__builtin_types_compatible_p (char[1][], char[1][1])); } cc -Wall -O2 -g bug.c -o bug bug.c: In function 'main': bug.c:3: error: array type has incomplete element type bug.c:3: confused by earlier errors, bailing out Preprocessed source stored into /tmp/ccPgaiXX.out file, please attach this to your bugreport. make: *** [bug] Error 1 // /usr/libexec/gcc/x86_64-redhat-linux/4.4.4/cc1 -quiet bug.c -quiet -dumpbase bug.c -mtune=generic -auxbase bug -g -O2 -Wall -o - -frandom-seed=0 # 1 "bug.c" # 1 "/home/smash/development/hello//" # 1 "<built-in>" # 1 "<command-line>" # 1 "bug.c" int main () { return (__builtin_types_compatible_p (char[1][], char[1][1])); }
gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC)
t34.c: In function ‘main’: t34.c:3:2: error: array type has incomplete element type t34.c:3:2: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_parser_postfix_expression, at c-parser.c:6572 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Confirmed.
Semi-obvious patch: Index: c-parser.c =================================================================== --- c-parser.c (revision 181796) +++ c-parser.c (working copy) @@ -6568,9 +6568,16 @@ c_parser_postfix_expression (c_parser *p "expected %<)%>"); { tree e1, e2; + e1 = groktypename (t1, NULL, NULL); + e2 = groktypename (t2, NULL, NULL); + if (e1 == error_mark_node || e2 == error_mark_node) + { + expr.value = error_mark_node; + break; + } - e1 = TYPE_MAIN_VARIANT (groktypename (t1, NULL, NULL)); - e2 = TYPE_MAIN_VARIANT (groktypename (t2, NULL, NULL)); + e1 = TYPE_MAIN_VARIANT (e1); + e2 = TYPE_MAIN_VARIANT (e2); expr.value = comptypes (e1, e2) ? integer_one_node : integer_zero_node;
Author: pinskia Date: Wed Nov 30 19:55:36 2011 New Revision: 181857 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181857 Log: 2011-11-30 Andrew Pinski <apinski@cavium.com> PR c/51321 * c-parser.c (c_parser_postfix_expression): Check groktypename results before looking at the main variant. 2011-11-30 Andrew Pinski <apinski@cavium.com> * gcc.dg/pr51321.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/pr51321.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-parser.c trunk/gcc/testsuite/ChangeLog
Fixed.