https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79936
Bug ID: 79936 Summary: ICE with -Walloc-size-larger-than=32767 Product: gcc Version: 7.0.1 Status: UNCONFIRMED Keywords: diagnostic, ice-on-valid-code Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: egall at gwmail dot gwu.edu CC: msebor at gcc dot gnu.org Target Milestone: --- Host: x86_64-apple-darwin10.8.0 Target: x86_64-apple-darwin10.8.0 Build: x86_64-apple-darwin10.8.0 Created attachment 40902 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40902&action=edit system-generated crash report Found when compiling my fork of emacs: $ make sha256.o V=1 /usr/local/bin/gcc -DHAVE_CONFIG_H -D_IN_GNULIB -I. -I../src -I. -I/Users/ericgallager/emacs/lib -I../src -I/Users/ericgallager/emacs/src -DMAC_OSX=1 -DXASSERTS=1 -fno-common -Wabi -Waddress -Waggressive-loop-optimizations -Wall -Wattributes -Wbool-compare -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wcoverage-mismatch -Wcpp -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdesignated-init -Wdisabled-optimization -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wduplicated-cond -Wempty-body -Wendif-labels -Wenum-compare -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Wint-conversion -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-braces -Wmissing-declarations -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnonnull -Wnonnull-compare -Wnull-dereference -Wold-style-declaration -Wold-style-definition -Woverflow -Woverlength-strings -Woverride-init -Wpacked -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-final-methods -Wsuggest-final-types -Wswitch-bool -Wtautological-compare -Wtrampolines -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvolatile-register-var -Wwrite-strings -Warray-bounds=2 -Wnormalized=nfc -Wshift-overflow=2 -Wunused-const-variable=2 -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -Wno-switch -Wno-unused-parameter -Wno-format-nonliteral -Wno-logical-op -Wnonportable-cfstrings -Wstrict-overflow=1 -Wdeclaration-after-statement -Wmissing-noreturn -Wunreachable-code -Woverride-init-side-effects -Wshift-overflow=2 -Wdangling-else -Wduplicate-decl-specifier -Wmemset-elt-size -Wswitch-unreachable -Wimplicit-fallthrough -Wformat-overflow=2 -Wformat-truncation=2 -Wstringop-overflow=2 -Wexpansion-to-defined -Wrestrict -Wint-in-bool-context -Wpointer-compare -Wbool-operation -Wduplicated-branches -Walloca-larger-than=16384 -Wvla-larger-than=16384 -Walloc-size-larger-than=32767 -Walloc-zero -Wpsabi -Wbuiltin-declaration-mismatch -ggdb3 -Og -gdwarf-2 -gfull -mfix-and-continue -MT sha256.o -MD -MP -MF .deps/sha256.Tpo -c -o sha256.o sha256.c sha256.c: In function 'sha256_stream': sha256.c:181:9: warning: argument 1 value '32840' exceeds maximum object size 32767 [-Walloc-size-larger-than=] char *buffer = malloc (BLOCKSIZE + 72); ^~~~~~ In file included from ./stdlib.h:36:0, from ../src/conf_post.h:226, from ../src/config.h:3616, from sha256.c:23: /usr/include/stdlib.h:169:7: note: in a call to allocation function 'malloc' declared here void *malloc(size_t); ^~~~~~ sha256.c: In function 'sha224_stream': sha256.c:252:9: internal compiler error: tree check: expected tree that contains 'typed' structure, have 'block' in extended_tree, at tree.h:5286 char *buffer = malloc (BLOCKSIZE + 72); ^~~~~~ sha256.c:252:9: internal compiler error: Abort trap gcc: internal compiler error: Abort trap (program cc1) Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. make: *** [sha256.o] Error 4 Interestingly, the ICE seems to go away when I try to save the preprocessed source to attach to this bug: $ /usr/local/bin/gcc -DHAVE_CONFIG_H -D_IN_GNULIB -I. -I../src -I. -I/Users/ericgallager/emacs/lib -I../src -I/Users/ericgallager/emacs/src -DMAC_OSX=1 -DXASSERTS=1 -fno-common -Wabi -Waddress -Waggressive-loop-optimizations -Wall -Wattributes -Wbool-compare -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wcoverage-mismatch -Wcpp -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdesignated-init -Wdisabled-optimization -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wduplicated-cond -Wempty-body -Wendif-labels -Wenum-compare -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Wint-conversion -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-braces -Wmissing-declarations -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnonnull -Wnonnull-compare -Wnull-dereference -Wold-style-declaration -Wold-style-definition -Woverflow -Woverlength-strings -Woverride-init -Wpacked -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-final-methods -Wsuggest-final-types -Wswitch-bool -Wtautological-compare -Wtrampolines -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvolatile-register-var -Wwrite-strings -Warray-bounds=2 -Wnormalized=nfc -Wshift-overflow=2 -Wunused-const-variable=2 -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -Wno-switch -Wno-unused-parameter -Wno-format-nonliteral -Wno-logical-op -Wnonportable-cfstrings -Wstrict-overflow=1 -Wdeclaration-after-statement -Wmissing-noreturn -Wunreachable-code -Woverride-init-side-effects -Wshift-overflow=2 -Wdangling-else -Wduplicate-decl-specifier -Wmemset-elt-size -Wswitch-unreachable -Wimplicit-fallthrough -Wformat-overflow=2 -Wformat-truncation=2 -Wstringop-overflow=2 -Wexpansion-to-defined -Wrestrict -Wint-in-bool-context -Wpointer-compare -Wbool-operation -Wduplicated-branches -Walloca-larger-than=16384 -Wvla-larger-than=16384 -Walloc-size-larger-than=32767 -Walloc-zero -Wpsabi -Wbuiltin-declaration-mismatch -ggdb3 -Og -gdwarf-2 -gfull -mfix-and-continue -MT sha256.o -MD -MP -MF .deps/sha256.Tpo -save-temps -freport-bug -c -o sha256.o sha256.c sha256.c: In function 'sha256_stream': sha256.c:181:9: warning: argument 1 value '32840' exceeds maximum object size 32767 [-Walloc-size-larger-than=] char *buffer = malloc (BLOCKSIZE + 72); ^~~~~~ In file included from ./stdlib.h:36:0, from ../src/conf_post.h:226, from ../src/config.h:3616, from sha256.c:23: /usr/include/stdlib.h:169:7: note: in a call to allocation function 'malloc' declared here void *malloc(size_t); ^~~~~~ sha256.c: In function 'sha224_stream': sha256.c:252:9: warning: argument 1 value '32840' exceeds maximum object size 32767 [-Walloc-size-larger-than=] char *buffer = malloc (BLOCKSIZE + 72); ^~~~~~ In file included from ./stdlib.h:36:0, from ../src/conf_post.h:226, from ../src/config.h:3616, from sha256.c:23: /usr/include/stdlib.h:169:7: note: in a call to allocation function 'malloc' declared here void *malloc(size_t); ^~~~~~ The file being compiled, sha256.c, is from gnulib, commit 94d81adc2f56c048b7872cd8ae2dd8568aef6dcf. gcc version info: $ /usr/local/bin/gcc -v Using built-in specs. COLLECT_GCC=/usr/local/bin/gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin10.8.0/7.0.1/lto-wrapper Target: x86_64-apple-darwin10.8.0 Configured with: ../configure --disable-werror --disable-werror-always --enable-languages=c,c++,objc,obj-c++,lto --enable-stage1-checking=release,rtl -C --with-system-libunwind --enable-secureplt --enable-frame-pointer --enable-debug --without-isl --disable-host-shared --enable-maintainer-mode --disable-default-pie --with-ld64 --without-pic --enable-target-optspace --disable-nls --with-system-zlib --with-libiconv-prefix=/opt/local --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --enable-lto --enable-libstcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --enable-objc-gc --enable-libada --enable-libssp CC=/opt/local/bin/gcc CXX=/opt/local/bin/g++ AR_FOR_TARGET=/opt/local/bin/ar AS_FOR_TARGET=/opt/local/bin/as LD_FOR_TARGET=/opt/local/bin/ld NM_FOR_TARGET=/opt/local/bin/nm RANLIB_FOR_TARGET=/opt/local/bin/ranlib STRIP_FOR_TARGET=/opt/local/bin/strip OTOOL=/opt/local/bin/otool OTOOL64=/opt/local/bin/otool AUTOCONF=/opt/local/bin/autoconf264 AUTOHEADER=/opt/local/bin/autoheader264 AUTOM4TE=/opt/local/bin/autom4te264 AUTORECONF=/opt/local/bin/autoreconf264 AUTOSCAN=/opt/local/bin/autoscan264 AUTOUPDATE=/opt/local/bin/autoupdate264 IFNAMES=/opt/local/bin/ifnames264 ACLOCAL=/sw/bin/aclocal-1.11 PERL=/opt/local/bin/perl Thread model: posix gcc version 7.0.1 20170301 (experimental) (GCC) cc-ing Martin because he introduced -Walloc-size-larger-than