public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115623] New: ICE: Segmentation fault  ( in contains_struct_check and finish_for_cond for cpp)
@ 2024-06-25  0:17 iamanonymous.cs at gmail dot com
  2024-06-25  0:33 ` [Bug c++/115623] ICE: Segmentation fault in finish_for_cond with novector and almost infinite loop pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: iamanonymous.cs at gmail dot com @ 2024-06-25  0:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115623
           Summary: ICE: Segmentation fault  ( in contains_struct_check
                    and finish_for_cond for cpp)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---
            Target: x86_64

*******************************************************************************
The compiler produces a segfault during contains_struct_check  when compiling
the provided code with the specified options. 
The issue can also be reproduced on Compiler Explorer.

*******************************************************************************
OS and Platform:
# uname -a
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-15/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /root/gdbtest/gcc/obj/../gcc/configure
--prefix=/root/gdbtest/gcc/gcc-15 --enable-languages=c,c++,fortran,go
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240509 (experimental) (GCC) 
*******************************************************************************
Program:
# cat 1.c

void f (char *a, int i)
{
#pragma GCC novector
  for (;;i++)
    a[i] *= 2;
}




*******************************************************************************
Command Lines:
# g++ 1.c -O3 -Wpedantic -Wall -Wextra -Wconversion -Wshadow -Wunused
-Woverloaded-virtual -Wpedantic -Wsign-conversion -Wmisleading-indentation
-Wduplicated-cond -Wnull-dereference -Wdouble-promotion -c -o 1.o
1.c: In function ‘void f(char*, int)’:
1.c:4:8: internal compiler error: Segmentation fault
    4 |   for (;;i++)
      |        ^
0x13a93af crash_signal
        /root/gdbtest/gcc/obj/../gcc/gcc/toplev.cc:319
0xd22180 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        /root/gdbtest/gcc/obj/../gcc/gcc/tree.h:3769
0xd22180 finish_for_cond(tree_node*, tree_node*, bool, tree_node*, bool)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/semantics.cc:1506
0xc840c4 cp_parser_c_for
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:14088
0xc840c4 cp_parser_for
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:14056
0xc840c4 cp_parser_iteration_statement
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:14690
0xc50ec5 cp_parser_pragma
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:51340
0xc84977 cp_parser_statement
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:12843
0xc59807 cp_parser_statement_seq_opt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13427
0xc59a2f cp_parser_compound_statement
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13281
0xc7ccd5 cp_parser_function_body
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26072
0xc7ccd5 cp_parser_ctor_initializer_opt_and_function_body
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26123
0xc8241e cp_parser_function_definition_after_declarator
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:32903
0xc835be cp_parser_function_definition_from_specifiers_and_declarator
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:32820
0xc835be cp_parser_init_declarator
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:23451
0xc5668f cp_parser_simple_declaration
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15958
0xc8ffea cp_parser_declaration
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15631
0xc90fea cp_parser_toplevel_declaration
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15652
0xc90fea cp_parser_translation_unit
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:5284
0xc90fea c_parse_file()
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:51440
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.


*******************************************************************************

Also ICE on trunk, compiler explorer:https://godbolt.org/z/zY8bvPj3T

*******************************************************************************

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

* [Bug c++/115623] ICE: Segmentation fault  in  finish_for_cond with novector and almost infinite loop
  2024-06-25  0:17 [Bug c++/115623] New: ICE: Segmentation fault ( in contains_struct_check and finish_for_cond for cpp) iamanonymous.cs at gmail dot com
@ 2024-06-25  0:33 ` pinskia at gcc dot gnu.org
  2024-06-25  0:34 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-25  0:33 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |tnfchris at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-25

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/115623] ICE: Segmentation fault  in  finish_for_cond with novector and almost infinite loop
  2024-06-25  0:17 [Bug c++/115623] New: ICE: Segmentation fault ( in contains_struct_check and finish_for_cond for cpp) iamanonymous.cs at gmail dot com
  2024-06-25  0:33 ` [Bug c++/115623] ICE: Segmentation fault in finish_for_cond with novector and almost infinite loop pinskia at gcc dot gnu.org
@ 2024-06-25  0:34 ` pinskia at gcc dot gnu.org
  2024-06-25  4:10 ` tnfchris at gcc dot gnu.org
  2024-06-25  4:12 ` tnfchris at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-25  0:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note `#pragma GCC unroll(1)` gives an error message:

<source>: In function 'void f(char*, int)':
<source>:5:9: error: missing loop condition in loop with 'GCC unroll' pragma
before ';' token
    5 |   for (;;i++)
      |         ^

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

* [Bug c++/115623] ICE: Segmentation fault  in  finish_for_cond with novector and almost infinite loop
  2024-06-25  0:17 [Bug c++/115623] New: ICE: Segmentation fault ( in contains_struct_check and finish_for_cond for cpp) iamanonymous.cs at gmail dot com
  2024-06-25  0:33 ` [Bug c++/115623] ICE: Segmentation fault in finish_for_cond with novector and almost infinite loop pinskia at gcc dot gnu.org
  2024-06-25  0:34 ` pinskia at gcc dot gnu.org
@ 2024-06-25  4:10 ` tnfchris at gcc dot gnu.org
  2024-06-25  4:12 ` tnfchris at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-06-25  4:10 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |tnfchris at gcc dot gnu.org

--- Comment #3 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
It looks like cp_parser_c_for is missing the handling for novector.

Mine.

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

* [Bug c++/115623] ICE: Segmentation fault  in  finish_for_cond with novector and almost infinite loop
  2024-06-25  0:17 [Bug c++/115623] New: ICE: Segmentation fault ( in contains_struct_check and finish_for_cond for cpp) iamanonymous.cs at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-25  4:10 ` tnfchris at gcc dot gnu.org
@ 2024-06-25  4:12 ` tnfchris at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-06-25  4:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
novect3.c: In function 'void f(char*, int)':
novect3.c:4:9: error: missing loop condition in loop with 'GCC novector' pragma
before ';' token
    4 |   for (;;i++)
      |         

should do it, will send patch later today.

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

end of thread, other threads:[~2024-06-25  4:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25  0:17 [Bug c++/115623] New: ICE: Segmentation fault ( in contains_struct_check and finish_for_cond for cpp) iamanonymous.cs at gmail dot com
2024-06-25  0:33 ` [Bug c++/115623] ICE: Segmentation fault in finish_for_cond with novector and almost infinite loop pinskia at gcc dot gnu.org
2024-06-25  0:34 ` pinskia at gcc dot gnu.org
2024-06-25  4:10 ` tnfchris at gcc dot gnu.org
2024-06-25  4:12 ` tnfchris 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).