:: commit 659a6afa18b9796c033f6f50c257fadc20e0f556

mintsuki <mintsuki@protonmail.com> — 2021-03-01 19:43

parents: 1e7ba95230

iso9660: Fix GCC 11 'array subscript partly outside array bounds' warning

diff --git a/make_toolchain.sh b/make_toolchain.sh
index 5455241c..e2345577 100755
--- a/make_toolchain.sh
+++ b/make_toolchain.sh
@@ -5,7 +5,7 @@ set -x
 
 TARGET=i386-elf
 BINUTILSVERSION=2.36.1
-GCCVERSION=10.2.0
+GCCVERSION=11-20210228
 NASMVERSION=2.15.05
 GZIPVERSION=1.10
 
@@ -19,8 +19,8 @@ export PATH="$PREFIX/bin:$PATH"
 if [ ! -f binutils-$BINUTILSVERSION.tar.gz ]; then
     wget https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILSVERSION.tar.gz
 fi
-if [ ! -f gcc-$GCCVERSION.tar.gz ]; then
-    wget https://ftp.gnu.org/gnu/gcc/gcc-$GCCVERSION/gcc-$GCCVERSION.tar.gz
+if [ ! -f gcc-$GCCVERSION.tar.xz ]; then
+    wget https://ftp.nluug.nl/languages/gcc/snapshots/$GCCVERSION/gcc-$GCCVERSION.tar.xz
 fi
 if [ ! -f nasm-$NASMVERSION.tar.gz ]; then
     wget https://www.nasm.us/pub/nasm/releasebuilds/$NASMVERSION/nasm-$NASMVERSION.tar.gz
@@ -34,7 +34,7 @@ mkdir build
 cd build
 
 tar -xf ../binutils-$BINUTILSVERSION.tar.gz
-tar -xf ../gcc-$GCCVERSION.tar.gz
+tar -xf ../gcc-$GCCVERSION.tar.xz
 tar -xf ../nasm-$NASMVERSION.tar.gz
 tar -xf ../gzip-$GZIPVERSION.tar.gz
 
diff --git a/stage23/fs/iso9660.c b/stage23/fs/iso9660.c
index 4bfc9198..c949d310 100644
--- a/stage23/fs/iso9660.c
+++ b/stage23/fs/iso9660.c
@@ -39,31 +39,34 @@ struct iso9660_volume_descriptor {
     uint8_t type;
     char identifier[5];
     uint8_t version;
-    uint8_t data[2041];
 } __attribute__((packed));
 
 struct iso9660_primary_volume {
-    uint8_t type;
-    char standard_identifier[5];
-    uint8_t version;
-    uint8_t unused0[1];
-    char system_identifier[32];
-    char volume_identifier[32];
-    uint8_t unused1[8];
-    struct BE32_t space_size;
-    uint8_t unused2[32];
-    struct BE16_t set_size;
-    struct BE16_t volume_seq;
-    struct BE16_t LBA_size;
-    struct BE32_t path_table_size;
-
-    uint32_t LBA_path_table_little;
-    uint32_t LBA_optional_path_table_little;
-    uint32_t LBA_path_table_big;
-    uint32_t LBA_optional_path_table_big;
-
-    struct iso9660_directory_entry root;
-    uint8_t no_one_cares[1858];
+    struct iso9660_volume_descriptor;
+
+    union {
+        struct {
+            uint8_t unused0[1];
+            char system_identifier[32];
+            char volume_identifier[32];
+            uint8_t unused1[8];
+            struct BE32_t space_size;
+            uint8_t unused2[32];
+            struct BE16_t set_size;
+            struct BE16_t volume_seq;
+            struct BE16_t LBA_size;
+            struct BE32_t path_table_size;
+
+            uint32_t LBA_path_table_little;
+            uint32_t LBA_optional_path_table_little;
+            uint32_t LBA_path_table_big;
+            uint32_t LBA_optional_path_table_big;
+
+            struct iso9660_directory_entry root;
+        } __attribute__((packed));
+
+        uint8_t padding[2041];
+    };
 } __attribute__((packed));
 
 
tab: 248 wrap: offon