public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113397] New: [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c
@ 2024-01-15 12:00 zsojka at seznam dot cz
  2024-01-15 12:03 ` [Bug tree-optimization/113397] " zsojka at seznam dot cz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-15 12:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113397
           Summary: [14 Regression] ICE: SIGSEGV in tree_check
                    (tree.h:3611) with -fdump-ada-spec-slim on
                    gcc.c-torture/execute/pr22061-2.c
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

This fails on the gcc.c-torture/execute/pr22061-2.c testcase with
-fdump-ada-spec-slim

Compiler output:
$ x86_64-pc-linux-gnu-gcc -fdump-ada-spec-slim
/repo/gcc-trunk/gcc/testsuite/gcc.c-torture/execute/pr22061-2.c -wrapper
valgrind,-q
==1560== Invalid read of size 2
==1560==    at 0xF0BC45: tree_check (tree.h:3611)
==1560==    by 0xF0BC45: check_type_name_conflict(pretty_printer*, tree_node*)
(c-ada-spec.cc:1570)
==1560==    by 0xF0E692: dump_ada_function_declaration(pretty_printer*,
tree_node*, bool, bool, bool, int) (c-ada-spec.cc:1654)
==1560==    by 0xF0FFA3: dump_ada_declaration(pretty_printer*, tree_node*,
tree_node*, int) (c-ada-spec.cc:3135)
==1560==    by 0xF11859: dump_ada_nodes (c-ada-spec.cc:826)
==1560==    by 0xF11859: dump_ads (c-ada-spec.cc:3525)
==1560==    by 0xF11859: dump_ada_specs(void (*)(char const*), int
(*)(tree_node*, cpp_operation)) (c-ada-spec.cc:3604)
==1560==    by 0xE0D6BF: c_parse_final_cleanups() (c-decl.cc:13416)
==1560==    by 0xEFAE00: c_common_parse_file() (c-opts.cc:1319)
==1560==    by 0x150D66D: compile_file() (toplev.cc:447)
==1560==    by 0xDE6B0B: do_compile (toplev.cc:2152)
==1560==    by 0xDE6B0B: toplev::main(int, char**) (toplev.cc:2308)
==1560==    by 0xDE82EA: main (main.cc:39)
==1560==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==1560== 
/repo/gcc-trunk/gcc/testsuite/gcc.c-torture/execute/pr22061-2.c:8:1: internal
compiler error: Segmentation fault
    8 | }
      | ^
0x150d36f crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:317
0xf0bc45 tree_check(tree_node*, char const*, int, char const*, tree_code)
        /repo/gcc-trunk/gcc/tree.h:3611
0xf0bc45 check_type_name_conflict
        /repo/gcc-trunk/gcc/c-family/c-ada-spec.cc:1570
0xf0e692 dump_ada_function_declaration
        /repo/gcc-trunk/gcc/c-family/c-ada-spec.cc:1654
0xf0ffa3 dump_ada_declaration
        /repo/gcc-trunk/gcc/c-family/c-ada-spec.cc:3135
0xf11859 dump_ada_nodes
        /repo/gcc-trunk/gcc/c-family/c-ada-spec.cc:826
0xf11859 dump_ads
        /repo/gcc-trunk/gcc/c-family/c-ada-spec.cc:3525
0xf11859 dump_ada_specs(void (*)(char const*), int (*)(tree_node*,
cpp_operation))
        /repo/gcc-trunk/gcc/c-family/c-ada-spec.cc:3604
0xe0d6bf c_parse_final_cleanups()
        /repo/gcc-trunk/gcc/c/c-decl.cc:13416
0xefae00 c_common_parse_file()
        /repo/gcc-trunk/gcc/c-family/c-opts.cc:1319
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-7239-20240115095837-g8a1927856a1-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-7239-20240115095837-g8a1927856a1-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240115 (experimental) (GCC)

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

* [Bug tree-optimization/113397] [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c
  2024-01-15 12:00 [Bug tree-optimization/113397] New: [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c zsojka at seznam dot cz
@ 2024-01-15 12:03 ` zsojka at seznam dot cz
  2024-01-15 12:39 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-15 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> ---
This actually fails the same way with plain -fdump-ada-spec, but I disabled
that flag due to PR107978 and PR107977

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

* [Bug tree-optimization/113397] [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c
  2024-01-15 12:00 [Bug tree-optimization/113397] New: [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c zsojka at seznam dot cz
  2024-01-15 12:03 ` [Bug tree-optimization/113397] " zsojka at seznam dot cz
@ 2024-01-15 12:39 ` rguenth at gcc dot gnu.org
  2024-01-15 15:49 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-15 12:39 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

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

* [Bug tree-optimization/113397] [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c
  2024-01-15 12:00 [Bug tree-optimization/113397] New: [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c zsojka at seznam dot cz
  2024-01-15 12:03 ` [Bug tree-optimization/113397] " zsojka at seznam dot cz
  2024-01-15 12:39 ` rguenth at gcc dot gnu.org
@ 2024-01-15 15:49 ` jakub at gcc dot gnu.org
  2024-01-15 16:31 ` [Bug ada/113397] " ebotcazou at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-15 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r14-1143-g42d1612eb5c3b2ee327bc3336bfcbc43a0d0fc5b
but I'd say check_type_name_conflict expectations are just wrong, even when a
type has a TYPE_NAME which is a TYPE_DECL, it doesn't imply it has a DECL_NAME,
in this case the TYPE_DECL has been created just to make the gimplifier happy.

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

* [Bug ada/113397] [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c
  2024-01-15 12:00 [Bug tree-optimization/113397] New: [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2024-01-15 15:49 ` jakub at gcc dot gnu.org
@ 2024-01-15 16:31 ` ebotcazou at gcc dot gnu.org
  2024-01-16 11:17 ` cvs-commit at gcc dot gnu.org
  2024-01-16 11:18 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-01-15 16:31 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-01-15

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Yes, probably just:

diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index 7d886c0f92e..4b245ed6975 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -1566,6 +1566,8 @@ check_type_name_conflict (pretty_printer *buffer, tree t)
        s = "";
       else if (TREE_CODE (TYPE_NAME (tmp)) == IDENTIFIER_NODE)
        s = IDENTIFIER_POINTER (TYPE_NAME (tmp));
+      else if (!DECL_NAME (TYPE_NAME (tmp)))
+       s = "";
       else
        s = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (tmp)));

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

* [Bug ada/113397] [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c
  2024-01-15 12:00 [Bug tree-optimization/113397] New: [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2024-01-15 16:31 ` [Bug ada/113397] " ebotcazou at gcc dot gnu.org
@ 2024-01-16 11:17 ` cvs-commit at gcc dot gnu.org
  2024-01-16 11:18 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-16 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:cf420e7b98d845323fad8280aea4ede60d3d96fe

commit r14-7275-gcf420e7b98d845323fad8280aea4ede60d3d96fe
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Jan 16 12:15:31 2024 +0100

    Fix crash of -fdump-ada-spec in a pathological case

    gcc/c-family/
            PR ada/113397
            * c-ada-spec.cc (check_type_name_conflict): Add guard for the
            presence of DECL_NAME on a TYPE_DECL.

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

* [Bug ada/113397] [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c
  2024-01-15 12:00 [Bug tree-optimization/113397] New: [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2024-01-16 11:17 ` cvs-commit at gcc dot gnu.org
@ 2024-01-16 11:18 ` ebotcazou at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-01-16 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

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

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
.

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

end of thread, other threads:[~2024-01-16 11:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-15 12:00 [Bug tree-optimization/113397] New: [14 Regression] ICE: SIGSEGV in tree_check (tree.h:3611) with -fdump-ada-spec-slim on gcc.c-torture/execute/pr22061-2.c zsojka at seznam dot cz
2024-01-15 12:03 ` [Bug tree-optimization/113397] " zsojka at seznam dot cz
2024-01-15 12:39 ` rguenth at gcc dot gnu.org
2024-01-15 15:49 ` jakub at gcc dot gnu.org
2024-01-15 16:31 ` [Bug ada/113397] " ebotcazou at gcc dot gnu.org
2024-01-16 11:17 ` cvs-commit at gcc dot gnu.org
2024-01-16 11:18 ` ebotcazou 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).