[Bug plugins/65817] libcc1: ICE: SEGV: c_incomplete_type_error()

2021-01-24 Thread tromey at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65817

Tom Tromey  changed:

   What|Removed |Added

 CC||tromey at gcc dot gnu.org

--- Comment #3 from Tom Tromey  ---
I think this was fixed by

commit 8db29d88f3e8d5fc43b25d9e0049c25f6bfb74d1
Author: Alexandre Oliva 
Date:   Tue Jan 31 01:02:03 2017 +

Introduce C++ support in libcc1


in particular the code now does

  tree node = make_node (code);
  tree type_decl = build_decl (input_location, TYPE_DECL, NULL_TREE, node);
  TYPE_NAME (node) = type_decl;

[Bug plugins/65817] libcc1: ICE: SEGV: c_incomplete_type_error()

2015-04-20 Thread jan.kratochvil at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65817

--- Comment #1 from Jan Kratochvil jan.kratochvil at redhat dot com ---
Created attachment 35368
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35368action=edit
GDB patch

GDB patch to crash GCC.

together with:
cat 1.c EOH
// b tree.c:build_qualified_type
// p TYPE_SIZE (type)
volatile struct sv { volatile struct sv *p; } sv; // CRASH: compile code sv.p =
sv;
volatile struct s { int i; } s, *sp; // OK: compile code sp = s;
int main(void) { return 0; }
EOH
gcc -o 1 1.c -Wall -g;noGDBHOOK=1
PATH=/home/jkratoch/redhat/gccgitatsign-root/bin:$PATH
LD_LIBRARY_PATH=/home/jkratoch/redhat/gccgitatsign-root/lib64 ../gdb ./1 -ex
start -ex 'set debug compile 0' -ex 'compile code sv.p = sv;printf(%p
%p\n,sv,sv.p);'


[Bug plugins/65817] libcc1: ICE: SEGV: c_incomplete_type_error()

2015-04-20 Thread jan.kratochvil at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65817

--- Comment #2 from Jan Kratochvil jan.kratochvil at redhat dot com ---
Created attachment 35369
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35369action=edit
Attempted GCC fix.

With this GCC fix and the GDB reproducer it looks as fixed:

gdb command line:1:1: error: invalid use of incomplete typedef ‘({anonymous})’

But after running gdb.compile/compile.exp one gets another crash so this GCC
fix is probably not right.

compile code struct_object.selffield = struct_object^M
gdb command line:1:1: error: cannot convert gdb type to gcc type^M
*** WARNING *** there are active plugins, do not report this as a bug unless
you can reproduce it without enabling any plugins.^M
Event| Plugins^M
PLUGIN_PRE_GENERICIZE| libcc1plugin^M
PLUGIN_GGC_MARKING   | libcc1plugin^M
PLUGIN_PRAGMAS   | libcc1plugin^M
gdb command line:1:1: internal compiler error: tree check: expected class
'type', have 'exceptional' (error_mark) in plugin_build_add_field, at
libcc1/plugin.cc:533^M
0xd7d007 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)^M
../../gccgitatsign/gcc/tree.c:9350^M
0x7f61d20f1084 tree_class_check(tree_node*, tree_code_class, char const*, int,
char const*)^M
../../gccgitatsign/libcc1/../gcc/tree.h:2969^M
0x7f61d20ef461 plugin_build_add_field(cc1_plugin::connection*, unsigned long
long, char const*, unsigned long long, unsigned long, unsigned long)^M
../../gccgitatsign/libcc1/plugin.cc:533^M
0x7f61d20f6407 cc1_plugin::connection::do_wait(bool)^M
../../gccgitatsign/libcc1/connection.cc:144^M
0x7f61d20f12be cc1_plugin::connection::wait_for_result()^M
../../gccgitatsign/libcc1/connection.hh:72^M
0x7f61d20f1edd cc1_plugin::status cc1_plugin::callint, gcc_c_oracle_request,
char const*(cc1_plugin::connection*, char const*, int*, gcc_c_oracle_request,
char const*)^M
../../gccgitatsign/libcc1/rpc.hh:227^M
0x7f61d20ee778 plugin_binding_oracle^M
../../gccgitatsign/libcc1/plugin.cc:278^M
0x5fe398 i_symbol_binding^M
../../gccgitatsign/gcc/c/c-decl.c:268^M
0x5fe398 lookup_name(tree_node*)^M
../../gccgitatsign/gcc/c/c-decl.c:3896^M
0x645e44 c_lex_one_token^M
../../gccgitatsign/gcc/c/c-parser.c:363^M
0x663633 c_parser_peek_token^M
../../gccgitatsign/gcc/c/c-parser.c:440^M
0x663633 c_parser_next_token_is^M
../../gccgitatsign/gcc/c/c-parser.c:452^M
0x663633 c_parser_compound_statement_nostart^M
../../gccgitatsign/gcc/c/c-parser.c:4557^M
0x66399e c_parser_compound_statement^M
../../gccgitatsign/gcc/c/c-parser.c:4538^M
0x661a67 c_parser_statement_after_labels^M
../../gccgitatsign/gcc/c/c-parser.c:4964^M
0x663173 c_parser_compound_statement_nostart^M
../../gccgitatsign/gcc/c/c-parser.c:4701^M
0x66399e c_parser_compound_statement^M
../../gccgitatsign/gcc/c/c-parser.c:4538^M
0x65fc80 c_parser_declaration_or_fndef^M
../../gccgitatsign/gcc/c/c-parser.c:1982^M
0x669a97 c_parser_external_declaration^M
../../gccgitatsign/gcc/c/c-parser.c:1452^M
0x66a359 c_parser_translation_unit^M
../../gccgitatsign/gcc/c/c-parser.c:1339^M
Please submit a full bug report,^M
with preprocessed source if appropriate.^M
Please include the complete backtrace with any bug report.^M
See http://gcc.gnu.org/bugs.html for instructions.^M
Compilation failed.^M
(gdb) FAIL: gdb.compile/compile.exp: compile code struct_object.selffield =
struct_object

BTW the GDB patch is wrong, it is used only as a reproducer of the GCC crash.