public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug plugins/65817] New: libcc1: ICE: SEGV: c_incomplete_type_error()
@ 2015-04-20 18:33 jan.kratochvil at redhat dot com
  2015-04-20 18:38 ` [Bug plugins/65817] " jan.kratochvil at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2015-04-20 18:33 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5932 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65817

            Bug ID: 65817
           Summary: libcc1: ICE: SEGV: c_incomplete_type_error()
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: plugins
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
                CC: pmuldoon at redhat dot com
              Host: x86_64-linux-gnu
            Target: x86_64-linux-gnu

r222230

Current libcc1 uses just: make_node (RECORD_TYPE)
which crashes on:
      if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
as TYPE_NAME (type) == NULL .

Actual:
*** WARNING *** there are active plugins, do not report this as a bug unless
you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_PRE_GENERICIZE            | libcc1plugin
PLUGIN_GGC_MARKING               | libcc1plugin
PLUGIN_PRAGMAS                   | libcc1plugin
gdb command line:1:1: internal compiler error: Segmentation fault
0xb1c4af crash_signal
        ../../gccgitatsign/gcc/toplev.c:383
0x618794 c_incomplete_type_error(tree_node const*, tree_node const*)
        ../../gccgitatsign/gcc/c/c-typeck.c:282
0x623750 c_incomplete_type_error(tree_node const*, tree_node const*)
        ../../gccgitatsign/gcc/c/c-typeck.c:235
0x623750 build_component_ref(unsigned int, tree_node*, tree_node*)
        ../../gccgitatsign/gcc/c/c-typeck.c:2304
0x654fb3 c_parser_postfix_expression_after_primary
        ../../gccgitatsign/gcc/c/c-parser.c:7925
0x6478f6 c_parser_postfix_expression
        ../../gccgitatsign/gcc/c/c-parser.c:7715
0x649f5a c_parser_unary_expression
        ../../gccgitatsign/gcc/c/c-parser.c:6602
0x65122f c_parser_cast_expression
        ../../gccgitatsign/gcc/c/c-parser.c:6440
0x651412 c_parser_binary_expression
        ../../gccgitatsign/gcc/c/c-parser.c:6255
0x651f75 c_parser_conditional_expression
        ../../gccgitatsign/gcc/c/c-parser.c:6031
0x652560 c_parser_expr_no_commas
        ../../gccgitatsign/gcc/c/c-parser.c:5949

0x652c52 c_parser_expression
        ../../gccgitatsign/gcc/c/c-parser.c:8022
0x653689 c_parser_expression_conv
        ../../gccgitatsign/gcc/c/c-parser.c:8055
0x661978 c_parser_statement_after_labels
        ../../gccgitatsign/gcc/c/c-parser.c:5115
0x663173 c_parser_compound_statement_nostart
        ../../gccgitatsign/gcc/c/c-parser.c:4701
0x66399e c_parser_compound_statement
        ../../gccgitatsign/gcc/c/c-parser.c:4538
0x661a67 c_parser_statement_after_labels
        ../../gccgitatsign/gcc/c/c-parser.c:4964
0x663173 c_parser_compound_statement_nostart
        ../../gccgitatsign/gcc/c/c-parser.c:4701
0x66399e c_parser_compound_statement
        ../../gccgitatsign/gcc/c/c-parser.c:4538
0x65fc80 c_parser_declaration_or_fndef
        ../../gccgitatsign/gcc/c/c-parser.c:1982
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.
Compilation failed.

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

1586c8fbaf0116931ffacd1746a6540c81c2d438 GDB commit
>From gcc-bugs-return-484103-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Apr 20 18:35:23 2015
Return-Path: <gcc-bugs-return-484103-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 36529 invoked by alias); 20 Apr 2015 18:35:23 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 36496 invoked by uid 48); 20 Apr 2015 18:35:19 -0000
From: "jan.kratochvil at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug plugins/65817] libcc1: ICE: SEGV: c_incomplete_type_error()
Date: Mon, 20 Apr 2015 18:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: plugins
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jan.kratochvil at redhat dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-65817-4-QaTuslAfls@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65817-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65817-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-04/txt/msg01655.txt.bz2
Content-length: 786

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide817

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Created attachment 35368
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id5368&actioníit
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);'


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug plugins/65817] libcc1: ICE: SEGV: c_incomplete_type_error()
  2015-04-20 18:33 [Bug plugins/65817] New: libcc1: ICE: SEGV: c_incomplete_type_error() jan.kratochvil at redhat dot com
@ 2015-04-20 18:38 ` jan.kratochvil at redhat dot com
  2021-01-24 20:15 ` tromey at gcc dot gnu.org
  2022-01-09 22:35 ` [Bug libcc1/65817] " tromey at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2015-04-20 18:38 UTC (permalink / raw)
  To: gcc-bugs

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=35369&action=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::call<int, 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.
>From gcc-bugs-return-484105-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Apr 20 19:20:29 2015
Return-Path: <gcc-bugs-return-484105-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 61341 invoked by alias); 20 Apr 2015 19:20:28 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 61283 invoked by uid 48); 20 Apr 2015 19:20:24 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65801] [5/6 Regression] Allow -Wno-narrowing to silence stricter C++11 narrowing rules
Date: Mon, 20 Apr 2015 19:20:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65801-4-Jq9rcffAoW@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65801-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65801-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-04/txt/msg01657.txt.bz2
Content-length: 194

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide801

--- Comment #10 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm also attaching what I have for the forced pedantic-errors idea.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug plugins/65817] libcc1: ICE: SEGV: c_incomplete_type_error()
  2015-04-20 18:33 [Bug plugins/65817] New: libcc1: ICE: SEGV: c_incomplete_type_error() jan.kratochvil at redhat dot com
  2015-04-20 18:38 ` [Bug plugins/65817] " jan.kratochvil at redhat dot com
@ 2021-01-24 20:15 ` tromey at gcc dot gnu.org
  2022-01-09 22:35 ` [Bug libcc1/65817] " tromey at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at gcc dot gnu.org @ 2021-01-24 20:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65817

Tom Tromey <tromey at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu.org

--- Comment #3 from Tom Tromey <tromey at gcc dot gnu.org> ---
I think this was fixed by

commit 8db29d88f3e8d5fc43b25d9e0049c25f6bfb74d1
Author: Alexandre Oliva <aoliva@redhat.com>
Date:   Tue Jan 31 01:02:03 2017 +0000

    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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libcc1/65817] libcc1: ICE: SEGV: c_incomplete_type_error()
  2015-04-20 18:33 [Bug plugins/65817] New: libcc1: ICE: SEGV: c_incomplete_type_error() jan.kratochvil at redhat dot com
  2015-04-20 18:38 ` [Bug plugins/65817] " jan.kratochvil at redhat dot com
  2021-01-24 20:15 ` tromey at gcc dot gnu.org
@ 2022-01-09 22:35 ` tromey at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at gcc dot gnu.org @ 2022-01-09 22:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65817

Tom Tromey <tromey at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Tom Tromey <tromey at gcc dot gnu.org> ---
Tried it again today and it seems fine:

(gdb) compile code sv.p = &sv;printf("%p %p\n",&sv,sv.p);
gdb command line:1:12: warning: incompatible implicit declaration of built-in
function ‘printf’ [-Wbuiltin-declaration-mismatch]
gdb command line:1:1: note: include ‘<stdio.h>’ or provide a declaration of
‘printf’
0x402010 0x402010


Going to close the bug this time.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-09 22:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20 18:33 [Bug plugins/65817] New: libcc1: ICE: SEGV: c_incomplete_type_error() jan.kratochvil at redhat dot com
2015-04-20 18:38 ` [Bug plugins/65817] " jan.kratochvil at redhat dot com
2021-01-24 20:15 ` tromey at gcc dot gnu.org
2022-01-09 22:35 ` [Bug libcc1/65817] " tromey at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).