https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61455
Bug ID: 61455 Summary: Internal compiler error, and other confused errors, when using array notation Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: nick.tomlinson at arm dot com Created attachment 32911 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32911&action=edit A minimal reproducer When building a simple, though incorrect, CilkPlus program using array notation, it is possible to trigger an internal compiler error. ==== Steps to reproduce ==== [*] Build this file with: g++ -fcilkplus -O3 -c bug.cpp [*] Comment out incorrect_error() and unprintable_error(), and retry. Notes: [*] Observed on ArchLinux with a locally built x86_64 GCC: r211050 (x86_64-unknown-linux-gnu-g++) as an internal fault. [*] Observed on ArchLinux with package maintainer's x86_64 GCC 4.9 (g++) as a confused by previous errors message. [*] I have confirmed the bug is still present in revision r211365. ==== What I expected to happen ==== [*] No internal compiler error. [*] A (non-internal fault) error should be produced for internal_fault(), as it should not be possible to assign an int[2] expression to an int lvalue. [*] The compilation of incorrect_error() should not result in an error suggesting the rhs is an expression of type int. [*] The compilation of unprintable_error() should not result in "not supported by dump_decl" output. ==== What actually happened ==== I get the following output: ==== r211050 gcc output with all three ==== $ x86_64-unknown-linux-gnu-g++ -fcilkplus -O3 -c bug.cpp bug.cpp: In function 'void incorrect_error()': bug.cpp:46:5: error: incompatible types in assignment of 'int' to 'int [2]' b = a[:]; ^ bug.cpp: In function 'void unprintable_error()': bug.cpp:57:8: error: 'b' cannot be scalar when 'a[#'integer_cst' not supported by dump_decl#<declaration error>:#'integer_cst' not supported by dump_decl#<declaration error>:#'integer_cst' not supported by dump_decl#<declaration error>]' is not b = a[:]; ^ bug.cpp: In function 'void internal_fault()': bug.cpp:38:12: internal compiler error: in gimplify_expr, at gimplify.c:8263 int b = a[:]; ^ 0xa03a58 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:8263 0x9ff8b0 gimplify_modify_expr /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:4529 0xa01758 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:7547 0xa05776 gimplify_stmt(tree_node**, gimple_statement_base**) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:5375 0xa13fc9 gimplify_and_add /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:384 0xa13fc9 gimplify_decl_expr /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:1378 0xa02065 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:7740 0xa05776 gimplify_stmt(tree_node**, gimple_statement_base**) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:5375 0xa02303 gimplify_statement_list /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:1431 0xa02303 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:7962 0xa05776 gimplify_stmt(tree_node**, gimple_statement_base**) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:5375 0xa06646 gimplify_bind_expr /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:1098 0xa01d17 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:7744 0xa05776 gimplify_stmt(tree_node**, gimple_statement_base**) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:5375 0xa06f76 gimplify_body(tree_node*, bool) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:8654 0xa07576 gimplify_function_tree(tree_node*) /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/gimplify.c:8807 0x887a37 analyze_function /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/cgraphunit.c:650 0x888ce9 analyze_functions /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/cgraphunit.c:1028 0x88a575 finalize_compilation_unit() /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/cgraphunit.c:2331 0x679aee cp_write_global_declarations() /home/nicholas/GCCCilk/native/native/gcc-4.9.0/gcc/cp/decl2.c:4632 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. ==== 4.9 gcc output with all three ==== $ g++ -fcilkplus -O3 -c bug.cpp bug.cpp: In function 'void incorrect_error()': bug.cpp:46:5: error: incompatible types in assignment of 'int' to 'int [2]' b = a[:]; ^ bug.cpp: In function 'void unprintable_error()': bug.cpp:57:8: error: 'b' cannot be scalar when 'a[#'integer_cst' not supported by dump_decl#<declaration error>:#'integer_cst' not supported by dump_decl#<declaration error>:#'integer_cst' not supported by dump_decl#<declaration error>]' is not b = a[:]; ^ bug.cpp:38: confused by earlier errors, bailing out ==== r211050 gcc output with only unprintable_error() ==== $ x86_64-unknown-linux-gnu-g++ -fcilkplus -O3 -c bug.cpp bug.cpp: In function 'void unprintable_error()': bug.cpp:57:8: error: 'b' cannot be scalar when 'a[#'integer_cst' not supported by dump_decl#<declaration error>:#'integer_cst' not supported by dump_decl#<declaration error>:#'integer_cst' not supported by dump_decl#<declaration error>]' is not b = a[:]; ^ ==== 4.9 gcc output with all only unprintable_error() ==== $ g++ -fcilkplus -O3 -c bug.cpp bug.cpp: In function 'void unprintable_error()': bug.cpp:57:8: error: 'b' cannot be scalar when 'a[#'integer_cst' not supported by dump_decl#<declaration error>:#'integer_cst' not supported by dump_decl#<declaration error>:#'integer_cst' not supported by dump_decl#<declaration error>]' is not b = a[:]; ^ ==== uname ==== $ uname -a Linux squamata 3.14.4-1-ARCH #1 SMP PREEMPT Tue May 13 16:41:39 CEST 2014 x86_64 GNU/Linux ==== r211050 gcc version ==== $ x86_64-unknown-linux-gnu-g++ -v Using built-in specs. COLLECT_GCC=x86_64-unknown-linux-gnu-g++ COLLECT_LTO_WRAPPER=/home/nicholas/GCCCilk/native/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/nicholas/GCCCilk/native/native/gcc-4.9.0/configure --prefix=/home/nicholas/GCCCilk/native/gcc --enable-languages=c,c++,fortran Thread model: posix gcc version 4.10.0 20140529 (experimental) (GCC) ==== 4.9 gcc version ==== $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/gcc-multilib/src/gcc-4.9-20140507/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 4.9.0 20140507 (prerelease) (GCC)