http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57085
Bug #: 57085 Summary: Segmentation Fault when building a c file Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc AssignedTo: unassig...@gcc.gnu.org ReportedBy: syner...@codefi.re GCC head is at "PR go/57045." I receive the following segmentation fault while building system/extras of android. The flags gcc was built with are as follows: --with-float=soft --with-fpu=neon --with-arch=armv7-a --enable-target-optspace --with-abi=aapcs --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --disable-libquadmath --disable-libatomic. Here's the error and backtrace: system/extras/ext4_utils/contents.c:162:1: internal compiler error: Segmentation fault } 0x974095 crash_signal ../../../build/../gcc/gcc-4.9/gcc/toplev.c:333 0x8d68ea reload_cse_simplify_operands ../../../build/../gcc/gcc-4.9/gcc/postreload.c:655 0x8d6f3c reload_cse_simplify ../../../build/../gcc/gcc-4.9/gcc/postreload.c:123 0x8d6f3c reload_cse_regs_1 ../../../build/../gcc/gcc-4.9/gcc/postreload.c:220 0x8d71a8 reload_cse_regs ../../../build/../gcc/gcc-4.9/gcc/postreload.c:75 0x8d71a8 rest_of_handle_postreload ../../../build/../gcc/gcc-4.9/gcc/postreload.c:2294 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. The code in contents.c is as follows: u32 make_directory(u32 dir_inode_num, u32 entries, struct dentry *dentries, u32 dirs) { struct ext4_inode *inode; u32 blocks; u32 len; u32 offset = 0; u32 inode_num; u8 *data; unsigned int i; struct ext4_dir_entry_2 *dentry; blocks = DIV_ROUND_UP(dentry_size(entries, dentries), info.block_size); len = blocks * info.block_size; if (dir_inode_num) { inode_num = allocate_inode(info); } else { dir_inode_num = EXT4_ROOT_INO; inode_num = EXT4_ROOT_INO; } if (inode_num == EXT4_ALLOCATE_FAILED) { error("failed to allocate inode\n"); return EXT4_ALLOCATE_FAILED; } add_directory(inode_num); inode = get_inode(inode_num); if (inode == NULL) { error("failed to get inode %u", inode_num); return EXT4_ALLOCATE_FAILED; } data = inode_allocate_data_extents(inode, len, len); if (data == NULL) { error("failed to allocate %u extents", len); return EXT4_ALLOCATE_FAILED; } inode->i_mode = S_IFDIR; inode->i_links_count = dirs + 2; inode->i_flags |= aux_info.default_i_flags; dentry = NULL; dentry = add_dentry(data, &offset, NULL, inode_num, ".", EXT4_FT_DIR); if (!dentry) { error("failed to add . directory"); return EXT4_ALLOCATE_FAILED; } for (i = 0; i < entries; i++) { dentry = add_dentry(data, &offset, dentry, 0, dentries[i].filename, dentries[i].file_type); if (offset > len || (offset == len && i != entries - 1)) critical_error("internal error: dentry for %s ends at %d, past %d\n", dentries[i].filename, offset, len); dentries[i].inode = &dentry->inode; if (!dentry) { error("failed to add directory"); return EXT4_ALLOCATE_FAILED; } } /* pad the last dentry out to the end of the block */ dentry->rec_len += len - offset; return inode_num; } ^^^^ The last line is line 162. Thank you