Hello, When compiling the following: $ cat t.c typedef __simd64_float16_t float16x4_t; with: $ arm-none-eabi-g++ -S t.c -mfloat-abi=hard -march=armv7-a -g t.c:1:28: internal compiler error: Segmentation fault 0xd33a1f crash_signal src/gcc/gcc/toplev.c:336 0x881b8f tree_class_check src/gcc/gcc/tree.h:3148 0x881b8f c_pretty_printer::simple_type_specifier(tree_node*) src/gcc/gcc/c-family/c-pretty-print.c:351 0x7ce46e cxx_pretty_printer::simple_type_specifier(tree_node*) src/gcc/gcc/cp/cxx-pretty-print.c:1324 0x884dec pp_c_specifier_qualifier_list(c_pretty_printer*, tree_node*) src/gcc/gcc/c-family/c-pretty-print.c:478 0x884dde pp_c_specifier_qualifier_list(c_pretty_printer*, tree_node*) src/gcc/gcc/c-family/c-pretty-print.c:474 0x7ccbe2 pp_cxx_type_specifier_seq src/gcc/gcc/cp/cxx-pretty-print.c:1379 0x6b4cd4 dump_type src/gcc/gcc/cp/error.c:467 0x6be905 dump_type_prefix src/gcc/gcc/cp/error.c:811 0x6b26b2 dump_simple_decl src/gcc/gcc/cp/error.c:970 0x6b2e00 dump_decl src/gcc/gcc/cp/error.c:1057 0x6beaf1 decl_as_string(tree_node*, int) src/gcc/gcc/cp/error.c:2882 0x6beb1f decl_as_dwarf_string(tree_node*, int) src/gcc/gcc/cp/error.c:2871 0x59a171 cxx_dwarf_name src/gcc/gcc/cp/cp-lang.c:119 0x97f8be type_tag src/gcc/gcc/dwarf2out.c:19191 0x9a1369 gen_array_type_die src/gcc/gcc/dwarf2out.c:19367 0x9a1369 gen_type_die_with_usage src/gcc/gcc/dwarf2out.c:23080 0x9a1c8b gen_type_die src/gcc/gcc/dwarf2out.c:23142 0x9ab9d7 modified_type_die src/gcc/gcc/dwarf2out.c:11469 0x9abf9c add_type_attribute src/gcc/gcc/dwarf2out.c:19123 Removing -g makes it compile without errors.
When I say without errors I meant without segfaulting. It will print out the following error for version 5 if you dont include '-mfpu=neon': t.c:1:9: error: '__simd64_float16_t' does not name a type typedef __simd64_float16_t float16x4_t;
Confirmed
Just to make it clear: The command I showed without the '-g' did use to error on gcc-5, but it doesnt on 6 and 7: $ gcc-5/arm-none-eabi-g++ -S t.c -mfloat-abi=hard -march=armv7-a t.c:1:9: error: '__simd64_float16_t' does not name a type typedef __simd64_float16_t float16x4_t; $ gcc-6/arm-none-eabi-g++ -S t.c -mfloat-abi=hard -march=armv7-a $ gcc-7/arm-none-eabi-g++ -S t.c -mfloat-abi=hard -march=armv7-a Adding -mfpu=neon to gcc-5 gets rid of the error: $ gcc-5/arm-none-eabi-g++ -S t.c -mfloat-abi=hard -march=armv7-a -mfpu=neon Adding -mfpu=neon to eitehr gcc-6 or 7 is irrelevant to both compilations with or without '-g'.
Created attachment 39901 [details] proposed patch
simple_type_specificer() is dereferencing a NULL result from c_common_type_for_mode and segfaulting: int prec = TYPE_PRECISION (t); if (ALL_FIXED_POINT_MODE_P (TYPE_MODE (t))) t = c_common_type_for_mode (TYPE_MODE (t), TYPE_SATURATING (t)); else t = c_common_type_for_mode (TYPE_MODE (t), TYPE_UNSIGNED (t)); if (TYPE_NAME (t)) The type in question is: <real_type 0x7fffefdeb150 HF size <integer_cst 0x7fffefd002a0 type <integer_type 0x7fffefcf0150 bitsizetype> constant 16> unit size <integer_cst 0x7fffefd002b8 type <integer_type 0x7fffefcf00a8 sizetype> constant 2> align 16 symtab 0 alias set -1 canonical type 0x7fffefdeb150 precision 16 pointer_to_this <pointer_type 0x7fffefeab7e0>> which corresponds to HFmode, which AFAICT does not have a type by design. The attached patch fixes the problem.
Author: aldyh Date: Fri Oct 28 16:41:29 2016 New Revision: 241653 URL: https://gcc.gnu.org/viewcvs?rev=241653&root=gcc&view=rev Log: PR debug/77773 * c-pretty-print.c (simple_type_specifier): Do not dereference `t' if NULL. Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-pretty-print.c
Fixed in mainline. Removed tags for GCC 7 regression.
Author: aldyh Date: Fri Oct 28 18:34:25 2016 New Revision: 241657 URL: https://gcc.gnu.org/viewcvs?rev=241657&root=gcc&view=rev Log: PR debug/77773 * c-pretty-print.c (simple_type_specifier): Do not dereference `t' if NULL. Modified: branches/gcc-6-branch/gcc/c-family/ChangeLog branches/gcc-6-branch/gcc/c-family/c-pretty-print.c
Fixed in gcc6 branch as well. Closing.