From: Theodore Ts'o Date: Mon, 13 Nov 2006 03:22:00 +0000 (-0500) Subject: Work around GCC bug on the Arm platform X-Git-Tag: E2FSPROGS-1_40-WIP-1114~11 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=413a78f657d0f095037ea60eb0236a28da1f7e7f;p=tools%2Fe2fsprogs.git Work around GCC bug on the Arm platform Addresses Debian Bug: #397044 Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 8e5e8c0..b0084ea 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,5 +1,14 @@ 2006-11-12 Theodore Tso + * badblocks.c (make_u32_list): Add workaround for GCC bug (ARM, + gcc version 4.1.1-17). The inline function involved is + used all over the e2fsprogs sources, so hopefully this bug + won't hit us in other places, but with this one change the + e2fsprogs regression test suite is passing, so we'll cross + our fingers, report the GCC bug, and hope that it doesn't + cause any data corruption/loss. (Addresses Debian Bug: + #397044; Gcc bug reported as Debian Bug #398316) + * unix_io.c (unix_flush): Allow offsets greater than 2G. (Addresses SourceForge Bug #1547922) diff --git a/lib/ext2fs/badblocks.c b/lib/ext2fs/badblocks.c index 4b76ef0..42e33bf 100644 --- a/lib/ext2fs/badblocks.c +++ b/lib/ext2fs/badblocks.c @@ -26,6 +26,10 @@ #include "ext2_fs.h" #include "ext2fsP.h" +#ifdef __arm__ +#define BUGGY_ARM_GCC +#endif + /* * Helper function for making a badblocks list */ @@ -42,11 +46,19 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, bb->magic = EXT2_ET_MAGIC_BADBLOCKS_LIST; bb->size = size ? size : 10; bb->num = num; +#ifdef BUGGY_ARM_GCC + bb->list = malloc(bb->size * sizeof(blk_t)); + if (!bb->list) { + free(bb); + return EXT2_ET_NO_MEMORY; + } +#else retval = ext2fs_get_mem(bb->size * sizeof(blk_t), &bb->list); if (!bb->list) { ext2fs_free_mem(&bb); return retval; } +#endif if (list) memcpy(bb->list, list, bb->size * sizeof(blk_t)); else