$ /usr/bin/clang -E -dM -xc -m64 - < Array [20]int8 -> int8 array[20] char array1[20]; // Buggy: -> Array [20][20]int8 -> [20]int8 array[20] // Correct: -> Array [20][20]int8 -> int8 array[20][20] char array2[20][20]; // Buggy: -> Array [20]*int8 -> *int8 array[20] // Correct: -> Array [20]*int8 -> int8 *array[20] char *array3[20]; // Buggy: -> Array [20][20]*int8 -> [20]*int8 array[20] // Correct: -> Array [20]**int8 -> int8 *array[20][20] char *array4[20][20]; // Buggy: -> Array [20][20]**int8 -> [20]**int8 array[20] // Correct: -> Array [20][20]**int8 -> int8 **array[20][20] char **array5[20][20]; }; #include /* for size_t below */ /* Define intgo when compiling with GCC. */ #ifdef __PTRDIFF_TYPE__ typedef __PTRDIFF_TYPE__ intgo; #elif defined(_LP64) typedef long long intgo; #else typedef int intgo; #endif typedef struct { char *p; intgo n; } _GoString_; typedef struct { char *p; intgo n; intgo c; } _GoBytes_; _GoString_ GoString(char *p); _GoString_ GoStringN(char *p, int l); _GoBytes_ GoBytes(void *p, int n); char *CString(_GoString_); void *_CMalloc(size_t); EOF #define BIG_ENDIAN __BIG_ENDIAN #define BYTE_ORDER __BYTE_ORDER #define FD_CLR(fd,fdsetp) __FD_CLR (fd, fdsetp) #define FD_ISSET(fd,fdsetp) __FD_ISSET (fd, fdsetp) #define FD_SET(fd,fdsetp) __FD_SET (fd, fdsetp) #define FD_SETSIZE __FD_SETSIZE #define FD_ZERO(fdsetp) __FD_ZERO (fdsetp) #define LITTLE_ENDIAN __LITTLE_ENDIAN #define NFDBITS __NFDBITS #define NULL ((void*)0) #define PDP_ENDIAN __PDP_ENDIAN #define _ATFILE_SOURCE 1 #define _BITS_BYTESWAP_H 1 #define _BITS_PTHREADTYPES_H 1 #define _BITS_TYPESIZES_H 1 #define _BITS_TYPES_H 1 #define _BSD_SOURCE 1 #define _ENDIAN_H 1 #define _FEATURES_H 1 #define _LP64 1 #define _POSIX_C_SOURCE 200809L #define _POSIX_SOURCE 1 #define _PTRDIFF_T #define _SIGSET_H_types 1 #define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) #define _SIZE_T #define _STDC_PREDEF_H 1 #define _STRUCT_TIMEVAL 1 #define _SVID_SOURCE 1 #define _SYS_CDEFS_H 1 #define _SYS_SELECT_H 1 #define _SYS_SYSMACROS_H 1 #define _SYS_TYPES_H 1 #define _WCHAR_T #define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) #define __ASMNAME2(prefix,cname) __STRING (prefix) cname #define __ATOMIC_ACQUIRE 2 #define __ATOMIC_ACQ_REL 4 #define __ATOMIC_CONSUME 1 #define __ATOMIC_RELAXED 0 #define __ATOMIC_RELEASE 3 #define __ATOMIC_SEQ_CST 5 #define __BEGIN_DECLS #define __BEGIN_NAMESPACE_C99 #define __BEGIN_NAMESPACE_STD #define __BIG_ENDIAN 4321 #define __BIT_TYPES_DEFINED__ 1 #define __BLKCNT64_T_TYPE __SQUAD_TYPE #define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE #define __BLKSIZE_T_TYPE __SYSCALL_SLONG_TYPE #define __BYTE_ORDER __LITTLE_ENDIAN #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __CHAR16_TYPE__ unsigned short #define __CHAR32_TYPE__ unsigned int #define __CHAR_BIT__ 8 #define __CLOCKID_T_TYPE __S32_TYPE #define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE #define __CONCAT(x,y) x ## y #define __CONSTANT_CFSTRINGS__ 1 #define __DADDR_T_TYPE __S32_TYPE #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __DBL_DIG__ 15 #define __DBL_EPSILON__ 2.2204460492503131e-16 #define __DBL_HAS_DENORM__ 1 #define __DBL_HAS_INFINITY__ 1 #define __DBL_HAS_QUIET_NAN__ 1 #define __DBL_MANT_DIG__ 53 #define __DBL_MAX_10_EXP__ 308 #define __DBL_MAX_EXP__ 1024 #define __DBL_MAX__ 1.7976931348623157e+308 #define __DBL_MIN_10_EXP__ (-307) #define __DBL_MIN_EXP__ (-1021) #define __DBL_MIN__ 2.2250738585072014e-308 #define __DECIMAL_DIG__ 21 #define __DEV_T_TYPE __UQUAD_TYPE #define __ELF__ 1 #define __END_DECLS #define __END_NAMESPACE_C99 #define __END_NAMESPACE_STD #define __FDS_BITS(set) ((set)->__fds_bits) #define __FD_CLR(d,set) ((void) (__FDS_BITS (set)[__FD_ELT (d)] &= ~__FD_MASK (d))) #define __FD_ELT(d) ((d) / __NFDBITS) #define __FD_ISSET(d,set) ((__FDS_BITS (set)[__FD_ELT (d)] & __FD_MASK (d)) != 0) #define __FD_MASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS)) #define __FD_SET(d,set) ((void) (__FDS_BITS (set)[__FD_ELT (d)] |= __FD_MASK (d))) #define __FD_SETSIZE 1024 #define __FD_ZERO(fdsp) do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " __FD_ZERO_STOS : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&__FDS_BITS (fdsp)[0]) : "memory"); } while (0) #define __FD_ZERO_STOS "stosq" #define __FINITE_MATH_ONLY__ 0 #define __FLOAT_WORD_ORDER __BYTE_ORDER #define __FLT_DENORM_MIN__ 1.40129846e-45F #define __FLT_DIG__ 6 #define __FLT_EPSILON__ 1.19209290e-7F #define __FLT_EVAL_METHOD__ 0 #define __FLT_HAS_DENORM__ 1 #define __FLT_HAS_INFINITY__ 1 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MANT_DIG__ 24 #define __FLT_MAX_10_EXP__ 38 #define __FLT_MAX_EXP__ 128 #define __FLT_MAX__ 3.40282347e+38F #define __FLT_MIN_10_EXP__ (-37) #define __FLT_MIN_EXP__ (-125) #define __FLT_MIN__ 1.17549435e-38F #define __FLT_RADIX__ 2 #define __FSBLKCNT64_T_TYPE __UQUAD_TYPE #define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE #define __FSFILCNT64_T_TYPE __UQUAD_TYPE #define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE #define __FSID_T_TYPE struct { int __val[2]; } #define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE #define __GCC_ATOMIC_BOOL_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 #define __GCC_ATOMIC_CHAR_LOCK_FREE 2 #define __GCC_ATOMIC_INT_LOCK_FREE 2 #define __GCC_ATOMIC_LLONG_LOCK_FREE 2 #define __GCC_ATOMIC_LONG_LOCK_FREE 2 #define __GCC_ATOMIC_POINTER_LOCK_FREE 2 #define __GCC_ATOMIC_SHORT_LOCK_FREE 2 #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 #define __GID_T_TYPE __U32_TYPE #define __GLIBC_MINOR__ 18 #define __GLIBC_PREREQ(maj,min) ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) #define __GLIBC__ 2 #define __GNUC_MINOR__ 2 #define __GNUC_PATCHLEVEL__ 1 #define __GNUC_PREREQ(maj,min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) #define __GNUC_STDC_INLINE__ 1 #define __GNUC__ 4 #define __GNU_LIBRARY__ 6 #define __GXX_ABI_VERSION 1002 #define __GXX_RTTI 1 #define __ID_T_TYPE __U32_TYPE #define __INO64_T_TYPE __UQUAD_TYPE #define __INO_T_MATCHES_INO64_T 1 #define __INO_T_TYPE __SYSCALL_ULONG_TYPE #define __INT16_TYPE__ short #define __INT32_TYPE__ int #define __INT64_C_SUFFIX__ L #define __INT64_TYPE__ long int #define __INT8_TYPE__ char #define __INTMAX_MAX__ 9223372036854775807L #define __INTMAX_TYPE__ long int #define __INTMAX_WIDTH__ 64 #define __INTPTR_TYPE__ long int #define __INTPTR_WIDTH__ 64 #define __INT_MAX__ 2147483647 #define __KERNEL_STRICT_NAMES #define __KEY_T_TYPE __S32_TYPE #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L #define __LDBL_DIG__ 18 #define __LDBL_EPSILON__ 1.08420217248550443401e-19L #define __LDBL_HAS_DENORM__ 1 #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_HAS_QUIET_NAN__ 1 #define __LDBL_MANT_DIG__ 64 #define __LDBL_MAX_10_EXP__ 4932 #define __LDBL_MAX_EXP__ 16384 #define __LDBL_MAX__ 1.18973149535723176502e+4932L #define __LDBL_MIN_10_EXP__ (-4931) #define __LDBL_MIN_EXP__ (-16381) #define __LDBL_MIN__ 3.36210314311209350626e-4932L #define __LDBL_REDIR(name,proto) name proto #define __LDBL_REDIR1(name,proto,alias) name proto #define __LDBL_REDIR1_NTH(name,proto,alias) name proto __THROW #define __LDBL_REDIR_DECL(name) #define __LDBL_REDIR_NTH(name,proto) name proto __THROW #define __LEAF #define __LEAF_ATTR #define __LITTLE_ENDIAN 1234 #define __LITTLE_ENDIAN__ 1 #define __LONG_LONG_MAX__ 9223372036854775807LL #define __LONG_LONG_PAIR(HI,LO) LO, HI #define __LONG_MAX__ 9223372036854775807L #define __LP64__ 1 #define __MMX__ 1 #define __MODE_T_TYPE __U32_TYPE #define __NFDBITS (8 * (int) sizeof (__fd_mask)) #define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE #define __NO_INLINE__ 1 #define __NO_MATH_INLINES 1 #define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct #define __OFF64_T_TYPE __SQUAD_TYPE #define __OFF_T_MATCHES_OFF64_T 1 #define __OFF_T_TYPE __SYSCALL_SLONG_TYPE #define __ORDER_BIG_ENDIAN__ 4321 #define __ORDER_LITTLE_ENDIAN__ 1234 #define __ORDER_PDP_ENDIAN__ 3412 #define __P(args) args #define __PDP_ENDIAN 3412 #define __PID_T_TYPE __S32_TYPE #define __PMT(args) args #define __POINTER_WIDTH__ 64 #define __PRAGMA_REDEFINE_EXTNAME 1 #define __PTHREAD_MUTEX_HAVE_ELISION 1 #define __PTHREAD_MUTEX_HAVE_PREV 1 #define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1 #define __PTRDIFF_TYPE__ long int #define __PTRDIFF_WIDTH__ 64 #define __REDIRECT(name,proto,alias) name proto __asm__ (__ASMNAME (#alias)) #define __REDIRECT_LDBL(name,proto,alias) __REDIRECT (name, proto, alias) #define __REDIRECT_NTH(name,proto,alias) name proto __asm__ (__ASMNAME (#alias)) __THROW #define __REDIRECT_NTHNL(name,proto,alias) name proto __asm__ (__ASMNAME (#alias)) __THROWNL #define __REDIRECT_NTH_LDBL(name,proto,alias) __REDIRECT_NTH (name, proto, alias) #define __REGISTER_PREFIX__ #define __RLIM64_T_TYPE __UQUAD_TYPE #define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE #define __S16_TYPE short int #define __S32_TYPE int #define __S64_TYPE long int #define __SCHAR_MAX__ 127 #define __SHRT_MAX__ 32767 #define __SIG_ATOMIC_WIDTH__ 32 #define __SIZEOF_DOUBLE__ 8 #define __SIZEOF_FLOAT__ 4 #define __SIZEOF_INT128__ 16 #define __SIZEOF_INT__ 4 #define __SIZEOF_LONG_DOUBLE__ 16 #define __SIZEOF_LONG_LONG__ 8 #define __SIZEOF_LONG__ 8 #define __SIZEOF_POINTER__ 8 #define __SIZEOF_PTHREAD_ATTR_T 56 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4 #define __SIZEOF_PTHREAD_BARRIER_T 32 #define __SIZEOF_PTHREAD_CONDATTR_T 4 #define __SIZEOF_PTHREAD_COND_T 48 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4 #define __SIZEOF_PTHREAD_MUTEX_T 40 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 #define __SIZEOF_PTHREAD_RWLOCK_T 56 #define __SIZEOF_PTRDIFF_T__ 8 #define __SIZEOF_SHORT__ 2 #define __SIZEOF_SIZE_T__ 8 #define __SIZEOF_WCHAR_T__ 4 #define __SIZEOF_WINT_T__ 4 #define __SIZE_MAX__ 18446744073709551615UL #define __SIZE_TYPE__ long unsigned int #define __SIZE_WIDTH__ 64 #define __SLONG32_TYPE int #define __SLONGWORD_TYPE long int #define __SQUAD_TYPE long int #define __SSE2_MATH__ 1 #define __SSE2__ 1 #define __SSE_MATH__ 1 #define __SSE__ 1 #define __SSIZE_T_TYPE __SWORD_TYPE #define __STDC_HOSTED__ 1 #define __STDC_IEC_559_COMPLEX__ 1 #define __STDC_IEC_559__ 1 #define __STDC_ISO_10646__ 201103L #define __STDC_NO_THREADS__ 1 #define __STDC_VERSION__ 199901L #define __STDC__ 1 #define __STDDEF_H #define __STRING(x) #x #define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE #define __SWORD_TYPE long int #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __SYSCALL_WORDSIZE 64 #define __THROW __attribute__ ((__nothrow__ __LEAF)) #define __THROWNL __attribute__ ((__nothrow__)) #define __TIMER_T_TYPE void * #define __TIME_T_TYPE __SYSCALL_SLONG_TYPE #define __U16_TYPE unsigned short int #define __U32_TYPE unsigned int #define __U64_TYPE unsigned long int #define __UID_T_TYPE __U32_TYPE #define __UINTMAX_TYPE__ long unsigned int #define __ULONG32_TYPE unsigned int #define __ULONGWORD_TYPE unsigned long int #define __UQUAD_TYPE unsigned long int #define __USECONDS_T_TYPE __U32_TYPE #define __USER_LABEL_PREFIX__ #define __USE_ATFILE 1 #define __USE_BSD 1 #define __USE_FORTIFY_LEVEL 0 #define __USE_ISOC95 1 #define __USE_ISOC99 1 #define __USE_MISC 1 #define __USE_POSIX 1 #define __USE_POSIX199309 1 #define __USE_POSIX199506 1 #define __USE_POSIX2 1 #define __USE_POSIX_IMPLICITLY 1 #define __USE_SVID 1 #define __USE_XOPEN2K 1 #define __USE_XOPEN2K8 1 #define __USING_NAMESPACE_C99(name) #define __USING_NAMESPACE_STD(name) #define __UWORD_TYPE unsigned long int #define __VERSION__ "4.2.1 Compatible Clang 3.3 (tags/RELEASE_33/final)" #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 #define __WINT_TYPE__ unsigned int #define __WINT_UNSIGNED__ 1 #define __WINT_WIDTH__ 32 #define __WORDSIZE 64 #define __WORDSIZE_TIME64_COMPAT32 1 #define __always_inline __inline __attribute__ ((__always_inline__)) #define __amd64 1 #define __amd64__ 1 #define __attribute_alloc_size__(params) #define __attribute_artificial__ #define __attribute_const__ __attribute__ ((__const__)) #define __attribute_deprecated__ __attribute__ ((__deprecated__)) #define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) #define __attribute_format_strfmon__(a,b) __attribute__ ((__format__ (__strfmon__, a, b))) #define __attribute_malloc__ __attribute__ ((__malloc__)) #define __attribute_noinline__ __attribute__ ((__noinline__)) #define __attribute_pure__ __attribute__ ((__pure__)) #define __attribute_used__ __attribute__ ((__used__)) #define __attribute_warn_unused_result__ __attribute__ ((__warn_unused_result__)) #define __blkcnt_t_defined #define __blksize_t_defined #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) #define __bos0(ptr) __builtin_object_size (ptr, 0) #define __bswap_16(x) (__extension__ ({ unsigned short int __v, __x = (unsigned short int) (x); if (__builtin_constant_p (__x)) __v = __bswap_constant_16 (__x); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })) #define __bswap_32(x) (__extension__ ({ unsigned int __v, __x = (x); if (__builtin_constant_p (__x)) __v = __bswap_constant_32 (__x); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })) #define __bswap_64(x) (__extension__ ({ __uint64_t __v, __x = (x); if (__builtin_constant_p (__x)) __v = __bswap_constant_64 (__x); else __asm__ ("bswap %q0" : "=r" (__v) : "0" (__x)); __v; })) #define __bswap_constant_16(x) ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) #define __bswap_constant_32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) #define __bswap_constant_64(x) (__extension__ ((((x) & 0xff00000000000000ull) >> 56) | (((x) & 0x00ff000000000000ull) >> 40) | (((x) & 0x0000ff0000000000ull) >> 24) | (((x) & 0x000000ff00000000ull) >> 8) | (((x) & 0x00000000ff000000ull) << 8) | (((x) & 0x0000000000ff0000ull) << 24) | (((x) & 0x000000000000ff00ull) << 40) | (((x) & 0x00000000000000ffull) << 56))) #define __clang__ 1 #define __clang_major__ 3 #define __clang_minor__ 3 #define __clang_patchlevel__ 0 #define __clang_version__ "3.3 (tags/RELEASE_33/final)" #define __clock_t_defined 1 #define __clockid_t_defined 1 #define __daddr_t_defined #define __dev_t_defined #define __errordecl(name,msg) extern void name (void) #define __extern_always_inline extern __always_inline __attribute__ ((__gnu_inline__)) #define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) #define __flexarr [] #define __fortify_function __extern_always_inline __attribute_artificial__ #define __fsblkcnt_t_defined #define __fsfilcnt_t_defined #define __gid_t_defined #define __glibc_likely(cond) __builtin_expect ((cond), 1) #define __glibc_unlikely(cond) __builtin_expect ((cond), 0) #define __gnu_linux__ 1 #define __have_pthread_attr_t 1 #define __id_t_defined #define __ino_t_defined #define __int8_t_defined #define __intN_t(N,MODE) typedef int int##N##_t __attribute__ ((__mode__ (MODE))) #define __k8 1 #define __k8__ 1 #define __key_t_defined #define __linux 1 #define __linux__ 1 #define __llvm__ 1 #define __long_double_t long double #define __mode_t_defined #define __need_clockid_t #define __need_size_t #define __nlink_t_defined #define __nonnull(params) __attribute__ ((__nonnull__ params)) #define __off_t_defined #define __pid_t_defined #define __ptr_t void * #define __restrict_arr __restrict #define __sigset_t_defined #define __ssize_t_defined #define __stub_bdflush #define __stub_chflags #define __stub_fattach #define __stub_fchflags #define __stub_fdetach #define __stub_getmsg #define __stub_gtty #define __stub_lchmod #define __stub_putmsg #define __stub_revoke #define __stub_setlogin #define __stub_sigreturn #define __stub_sstk #define __stub_stty #define __suseconds_t_defined #define __time_t_defined 1 #define __timer_t_defined 1 #define __timespec_defined 1 #define __tune_k8__ 1 #define __u_char_defined #define __u_intN_t(N,MODE) typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE))) #define __uid_t_defined #define __unix 1 #define __unix__ 1 #define __warnattr(msg) #define __warndecl(name,msg) extern void name (void) #define __wur #define __x86_64 1 #define __x86_64__ 1 #define be16toh(x) __bswap_16 (x) #define be32toh(x) __bswap_32 (x) #define be64toh(x) __bswap_64 (x) #define htobe16(x) __bswap_16 (x) #define htobe32(x) __bswap_32 (x) #define htobe64(x) __bswap_64 (x) #define htole16(x) (x) #define htole32(x) (x) #define htole64(x) (x) #define le16toh(x) (x) #define le32toh(x) (x) #define le64toh(x) (x) #define linux 1 #define major(dev) gnu_dev_major (dev) #define makedev(maj,min) gnu_dev_makedev (maj, min) #define minor(dev) gnu_dev_minor (dev) #define offsetof(t,d) __builtin_offsetof(t, d) #define unix 1 $ /usr/bin/clang -w -Wno-error -o_obj/_cgo_.o -gdwarf-2 -c -xc -ferror-limit=0 -Wno-unknown-warning-option -Wno-unneeded-internal-declaration -Wno-unused-function -Qunused-arguments -fno-builtin -m64 - < Array [20]int8 -> int8 array[20] char array1[20]; // Buggy: -> Array [20][20]int8 -> [20]int8 array[20] // Correct: -> Array [20][20]int8 -> int8 array[20][20] char array2[20][20]; // Buggy: -> Array [20]*int8 -> *int8 array[20] // Correct: -> Array [20]*int8 -> int8 *array[20] char *array3[20]; // Buggy: -> Array [20][20]*int8 -> [20]*int8 array[20] // Correct: -> Array [20]**int8 -> int8 *array[20][20] char *array4[20][20]; // Buggy: -> Array [20][20]**int8 -> [20]**int8 array[20] // Correct: -> Array [20][20]**int8 -> int8 **array[20][20] char **array5[20][20]; }; #include /* for size_t below */ /* Define intgo when compiling with GCC. */ #ifdef __PTRDIFF_TYPE__ typedef __PTRDIFF_TYPE__ intgo; #elif defined(_LP64) typedef long long intgo; #else typedef int intgo; #endif typedef struct { char *p; intgo n; } _GoString_; typedef struct { char *p; intgo n; intgo c; } _GoBytes_; _GoString_ GoString(char *p); _GoString_ GoStringN(char *p, int l); _GoBytes_ GoBytes(void *p, int n); char *CString(_GoString_); void *_CMalloc(size_t); __typeof__(struct cdefsTest) *__cgo__0; long long __cgodebug_data[] = { 0, 1 }; EOF // Created by cgo -cdefs - DO NOT EDIT // cgo -cdefs -debug-gcc cdefstest.go typedef struct CdefsTest CdefsTest; #pragma pack on struct CdefsTest { int8 array1[20]; int8 array2[20][20]; byte Pad_cgo_0[4]; byte array3[0]; byte Pad_cgo_1[160]; byte array4[0]; byte Pad_cgo_2[3200]; byte array5[0]; byte Pad_cgo_3[3200]; }; #pragma pack off