[Bug c/87344] New: archival/libarchive/decompress_gunzip.c:1139:2: error: size of unnamed array is negative
yellowriver2010 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 18 06:49:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87344
Bug ID: 87344
Summary: archival/libarchive/decompress_gunzip.c:1139:2: error:
size of unnamed array is negative
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: yellowriver2010 at hotmail dot com
Target Milestone: ---
Created attachment 44710
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44710&action=edit
compile.sh
# ./compile.sh
archival/libarchive/decompress_gunzip.c:1:0: warning: this target machine does
not have delayed branches [enabled by default]
archival/libarchive/decompress_gunzip.c:1:0: warning: -fassociative-math
disabled; other options take precedence [enabled by default]
archival/libarchive/decompress_gunzip.c: In function ‘check_header_gzip’:
archival/libarchive/decompress_gunzip.c:1139:2: error: size of unnamed array is
negative
The orignal code is:
1126 static int check_header_gzip(STATE_PARAM transformer_state_t *xstate)
1127 {
1128 union {
1129 unsigned char raw[8];
1130 struct {
1131 uint8_t gz_method;
1132 uint8_t flags;
1133 uint32_t mtime;
1134 uint8_t xtra_flags_UNUSED;
1135 uint8_t os_flags_UNUSED;
1136 } PACKED formatted;
1137 } header;
1138
1139 BUILD_BUG_ON(sizeof(header) != 8);
The preprocessed code is:
11347 static int check_header_gzip(state_t *state, transformer_state_t *xstate)
11348 {
11349 union {
11350 unsigned char raw[8];
11351 struct {
11352 uint8_t gz_method;
11353 uint8_t flags;
11354 uint32_t mtime;
11355 uint8_t xtra_flags_UNUSED;
11356 uint8_t os_flags_UNUSED;
11357 } __attribute__ ((__packed__)) formatted;
11358 } header;
11359
11360 ((void)sizeof(char[1 - 2*!!(sizeof(header) != 8)]));
More information about the Gcc-bugs
mailing list