https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117694

            Bug ID: 117694
           Summary: ICE: tree_class_check_failed(tree_node const*,
                    tree_code_class, char const*, int, char const*)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bic60176 at gmail dot com
  Target Milestone: ---

// Target: x86_64-linux
// Configured with: /root/compilers/gcc-project-trunk/configure
--prefix=/root/objects/gcc-project-trunk.obj/install --enable-languages=c,c++
--host=x86_64-linux --target=x86_64-linux --disable-bootstrap
--disable-multilib
// Thread model: posix
// Supported LTO compression algorithms: zlib
// gcc version 15.0.0 20240612 (experimental) (GCC) 
// 
// XJTsKjEoZHuy.c:37:12: error: size of array 'check' is negative
//    37 | extern int check[sizeof(union  s3) == 8 ? 1 : -1];
//       |            ^~~~~
// In file included from XJTsKjEoZHuy.c:6:
root@3976cac0d8a6:~/root/my-workspace-2/clang,0# cat cc0gF9lX.out 
// Target: x86_64-linux
// Configured with: /root/compilers/gcc-project-trunk/configure
--prefix=/root/objects/gcc-project-trunk.obj/install --enable-languages=c,c++
--host=x86_64-linux --target=x86_64-linux --disable-bootstrap
--disable-multilib
// Thread model: posix
// Supported LTO compression algorithms: zlib
// gcc version 15.0.0 20240612 (experimental) (GCC) 
// 
// XJTsKjEoZHuy.c:37:12: error: size of array 'check' is negative
//    37 | extern int check[sizeof(union  s3) == 8 ? 1 : -1];
//       |            ^~~~~
// In file included from XJTsKjEoZHuy.c:6:
// XJTsKjEoZHuy.c:38:34: error: 's3' defined as wrong kind of tag
//    38 | extern int check[offsetof(struct s3, f4) == 6 ? 1 : -1];
//       |                                  ^~
// XJTsKjEoZHuy.c:38:18: error: invalid use of undefined type 'struct s3'
//    38 | extern int check[offsetof(struct s3, f4) == 6 ? 1 : -1];
//       |                  ^~~~~~~~
// XJTsKjEoZHuy.c:45:32: internal compiler error: tree check: expected class
'type', have 'exceptional' (error_mark) in comptypes_verify, at
c/c-typeck.cc:1178
//    45 | extern int check[sizeof(struct s4) == 4 ? 1 : -1];
//       |                                ^~
// 0x84471d tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
//      /root/compilers/gcc-project-trunk/gcc/tree.cc:9051
// 0x6f4960 tree_class_check(tree_node*, tree_code_class, char const*, int,
char const*)
//      /root/compilers/gcc-project-trunk/gcc/tree.h:3787
// 0x6f4960 comptypes_verify
//      /root/compilers/gcc-project-trunk/gcc/c/c-typeck.cc:1178
// 0x970faa comptypes(tree_node*, tree_node*)
//      /root/compilers/gcc-project-trunk/gcc/c/c-typeck.cc:1212
// 0x94bdd5 pushdecl(tree_node*)
//      /root/compilers/gcc-project-trunk/gcc/c/c-decl.cc:3381
// 0x9604b1 start_decl(c_declarator*, c_declspecs*, bool, tree_node*, bool,
unsigned int*)
//      /root/compilers/gcc-project-trunk/gcc/c/c-decl.cc:5709
// 0x9cea71 c_parser_declaration_or_fndef
//      /root/compilers/gcc-project-trunk/gcc/c/c-parser.cc:2773
// 0x9daf43 c_parser_external_declaration
//      /root/compilers/gcc-project-trunk/gcc/c/c-parser.cc:2053
// 0x9dba0b c_parser_translation_unit
//      /root/compilers/gcc-project-trunk/gcc/c/c-parser.cc:1907
// 0x9dba0b c_parse_file()
//      /root/compilers/gcc-project-trunk/gcc/c/c-parser.cc:27303
// 0xa55419 c_common_parse_file()
//      /root/compilers/gcc-project-trunk/gcc/c-family/c-opts.cc:1322
// Please submit a full bug report, with preprocessed source.
// Please include the complete backtrace with any bug report.
// See <https://gcc.gnu.org/bugs/> for instructions.

//
/root/objects/gcc-project-trunk.obj/install/bin/../libexec/gcc/x86_64-linux/15.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu -iprefix
/root/objects/gcc-project-trunk.obj/install/bin/../lib/gcc/x86_64-linux/15.0.0/
XJTsKjEoZHuy.c -quiet -dumpdir a- -dumpbase XJTsKjEoZHuy.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -freport-bug -o - -frandom-seed=0 -fdump-noaddr

# 0 "XJTsKjEoZHuy.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "XJTsKjEoZHuy.c"





# 1
"/root/objects/gcc-project-trunk.obj/install/lib/gcc/x86_64-linux/15.0.0/include/stddef.h"
1 3 4
# 145
"/root/objects/gcc-project-trunk.obj/install/lib/gcc/x86_64-linux/15.0.0/include/stddef.h"
3 4

# 145
"/root/objects/gcc-project-trunk.obj/install/lib/gcc/x86_64-linux/15.0.0/include/stddef.h"
3 4
typedef long int ptrdiff_t;
# 214
"/root/objects/gcc-project-trunk.obj/install/lib/gcc/x86_64-linux/15.0.0/include/stddef.h"
3 4
typedef long unsigned int size_t;
# 329
"/root/objects/gcc-project-trunk.obj/install/lib/gcc/x86_64-linux/15.0.0/include/stddef.h"
3 4
typedef int wchar_t;
# 425
"/root/objects/gcc-project-trunk.obj/install/lib/gcc/x86_64-linux/15.0.0/include/stddef.h"
3 4
typedef struct {
  long long __max_align_ll __attribute__((__aligned__(__alignof__(long
long))));
  long double __max_align_ld __attribute__((__aligned__(__alignof__(long
double))));
# 436
"/root/objects/gcc-project-trunk.obj/install/lib/gcc/x86_64-linux/15.0.0/include/stddef.h"
3 4
} max_align_t;
# 7 "XJTsKjEoZHuy.c" 2
#pragma pack(2)


# 9 "XJTsKjEoZHuy.c"
struct s0 {
     char f1;
     unsigned f2 : 32;
     char f3;
};
extern int check[sizeof(struct s0) == 6 ? 1 : -1];

struct s1 {
     char f1;
     unsigned : 0;
     char f3;
};
extern int check[sizeof(struct s1) == 5 ? 1 : -1];

struct s2 {
     char f1;
     unsigned : 0;
     unsigned f3 : 8;
     char f4;
};
extern int check[sizeof(struct s2) == 6 ? 1 : -1];

union s3 {
     char f1;
     unsigned : 0;
     unsigned f3 : 16;
     char f4;
};
extern int check[sizeof(union s3) == 8 ? 1 : -1];
extern int check[
# 38 "XJTsKjEoZHuy.c" 3 4
                __builtin_offsetof (
# 38 "XJTsKjEoZHuy.c"
                struct s3
# 38 "XJTsKjEoZHuy.c" 3 4
                , 
# 38 "XJTsKjEoZHuy.c"
                f4
# 38 "XJTsKjEoZHuy.c" 3 4
                ) 
# 38 "XJTsKjEoZHuy.c"
                                        == 6 ? 1 : -1];

struct s4 {
     char f1;
     unsigned f2 : 8;
     char f3;
};
extern int check[sizeof(struct s4) == 4 ? 1 : -1];
extern int check[
# 46 "XJTsKjEoZHuy.c" 3 4
                __builtin_offsetof (
# 46 "XJTsKjEoZHuy.c"
                struct s4
# 46 "XJTsKjEoZHuy.c" 3 4
                , 
# 46 "XJTsKjEoZHuy.c"
                f3
# 46 "XJTsKjEoZHuy.c" 3 4
                ) 
# 46 "XJTsKjEoZHuy.c"
                                        == 2 ? 1 : -1];

Reply via email to