public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104302] New: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e
@ 2022-01-31 10:03 marxin at gcc dot gnu.org
  2022-01-31 10:03 ` [Bug c++/104302] " marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-31 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104302
           Summary: [12 Regression] ICE Segmentation fault since
                    r12-6825-g2da90ad39bf8fa9e
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: wjwray at gmail dot com
  Target Milestone: ---

The following crashes:

$ cat nes11.ii
typedef unsigned int __uint32_t;
typedef __uint32_t uint32_t;
extern "C++" typedef unsigned char uint8;
typedef uint32_t uint32;
namespace Mednafen {
struct StateMem;
struct SFORMAT {
  enum class FORM : uint8;
  ;
};
template <typename T>
static __attribute__((always_inline)) SFORMAT SFBASE_(T* const v,
                                                      const uint32 count,
                                                      const char* const name);
template <unsigned model, unsigned mem_size>
struct X24C0xP {
  Mednafen::SFORMAT __trans_tmp_1;
  int StateAction(StateMem* sm, int load, int data_only, const char* sname) {
    SFORMAT StateRegs[] = {
        SFBASE_(SF_FORCE_A8(mem), mem_size, "mem"),
        __trans_tmp_1,
        SFBASE_,
        SFBASE_,
        SFBASE_,
        SFBASE_,
        SFBASE_,
        SFBASE_,
        SFBASE_,
        SFBASE_,
    };

    return 0;
  }
  bool prev_sda_in, prev_scl_in;
  unsigned phase;
  uint8 mem[mem_size];
  uint8 buf;
  uint8 bitpos;
  int sda_out;
  uint8 slave_addr;
  bool rw_bit;
  uint8 mem_addr;
};
}  // namespace Mednafen

$ g++ nes11.ii -c
nes11.ii: In member function ‘int Mednafen::X24C0xP<model,
mem_size>::StateAction(Mednafen::StateMem*, int, int, const char*)’:
nes11.ii:30:5: internal compiler error: Segmentation fault
   30 |     };
      |     ^
0x17cb93a crash_signal
        /home/marxin/Programming/gcc/gcc/toplev.cc:322
0x7ffff789b41f ???
       
/usr/src/debug/glibc-2.34-4.3.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x1bf95bc strip_array_types(tree_node*)
        /home/marxin/Programming/gcc/gcc/tree.cc:7224
0xf664dc cp_type_quals(tree_node const*)
        /home/marxin/Programming/gcc/gcc/cp/typeck.cc:10950
0xf3a2ff cp_build_qualified_type_real(tree_node*, int, int)
        /home/marxin/Programming/gcc/gcc/cp/tree.cc:1355
0xf68924 same_type_ignoring_top_level_qualifiers_p(tree_node*, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/typeck.cc:1593
0xf68924 same_type_ignoring_top_level_qualifiers_p(tree_node*, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/typeck.cc:1585
0xc63294 reshape_init_r
        /home/marxin/Programming/gcc/gcc/cp/decl.cc:6801
0xc619c9 reshape_init_array_1
        /home/marxin/Programming/gcc/gcc/cp/decl.cc:6398
0xc61c13 reshape_init_array
        /home/marxin/Programming/gcc/gcc/cp/decl.cc:6437
0xc6381a reshape_init_r
        /home/marxin/Programming/gcc/gcc/cp/decl.cc:6894
0xc63c30 reshape_init(tree_node*, tree_node*, int)
        /home/marxin/Programming/gcc/gcc/cp/decl.cc:6974
0xc71c68 cp_complete_array_type(tree_node**, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/cp/decl.cc:9574
0xc5fdc6 maybe_deduce_size_from_array_init
        /home/marxin/Programming/gcc/gcc/cp/decl.cc:6027
0xc6b151 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        /home/marxin/Programming/gcc/gcc/cp/decl.cc:8117
0xde05a5 cp_parser_init_declarator
        /home/marxin/Programming/gcc/gcc/cp/parser.cc:22823
0xdd0ef1 cp_parser_simple_declaration
        /home/marxin/Programming/gcc/gcc/cp/parser.cc:15286
0xdd0a31 cp_parser_block_declaration
        /home/marxin/Programming/gcc/gcc/cp/parser.cc:15106
0xdcefc4 cp_parser_declaration_statement
        /home/marxin/Programming/gcc/gcc/cp/parser.cc:14367
0xdc9f5c cp_parser_statement
        /home/marxin/Programming/gcc/gcc/cp/parser.cc:12452
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.

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

* [Bug c++/104302] [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e
  2022-01-31 10:03 [Bug c++/104302] New: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e marxin at gcc dot gnu.org
@ 2022-01-31 10:03 ` marxin at gcc dot gnu.org
  2022-02-01  0:14 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-31 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
   Last reconfirmed|                            |2022-01-31
           Priority|P3                          |P1
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug c++/104302] [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e
  2022-01-31 10:03 [Bug c++/104302] New: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e marxin at gcc dot gnu.org
  2022-01-31 10:03 ` [Bug c++/104302] " marxin at gcc dot gnu.org
@ 2022-02-01  0:14 ` pinskia at gcc dot gnu.org
  2022-02-02 22:43 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-01  0:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced further:
struct ss {};
static ss ff(void* const v);
template <unsigned mem_size>
void f1(void) {
    int mem[mem_size];
    ss StateRegs[] = {
        ff(mem)
    };
}

---- CUT ---
mem's array size needs to be value dependent.

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

* [Bug c++/104302] [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e
  2022-01-31 10:03 [Bug c++/104302] New: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e marxin at gcc dot gnu.org
  2022-01-31 10:03 ` [Bug c++/104302] " marxin at gcc dot gnu.org
  2022-02-01  0:14 ` pinskia at gcc dot gnu.org
@ 2022-02-02 22:43 ` jason at gcc dot gnu.org
  2022-02-03  4:21 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2022-02-02 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/104302] [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e
  2022-01-31 10:03 [Bug c++/104302] New: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-02-02 22:43 ` jason at gcc dot gnu.org
@ 2022-02-03  4:21 ` cvs-commit at gcc dot gnu.org
  2022-02-03  4:21 ` jason at gcc dot gnu.org
  2022-02-03  9:21 ` m.cencora at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-03  4:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:501c4ee9fad68716497db4d96b63b801cc57b4a1

commit r12-7010-g501c4ee9fad68716497db4d96b63b801cc57b4a1
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Feb 2 17:49:02 2022 -0500

    c++: dependent array bounds completion [PR104302]

    The patch for PR55227 changed the minimal init-list handling in
    cp_complete_array_type to a call to reshape_init, which broke on the
    dependent initializer.  It occurred to me that trying to deduce the array
    size from a dependent init-list is wrong in general, so let's just not.  I
    also limited the reshape_init call to the case of a char array, as before
    the patch for 55227; that's the only case where we want to strip a level of
    braces from an array.

            PR c++/104302

    gcc/cp/ChangeLog:

            * decl.cc (maybe_deduce_size_from_array_init): Give up
            on type-dependent init.
            (cp_complete_array_type): Only call reshape_init for character
            array.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/array35.C: New test.
            * g++.dg/template/array36.C: New test.

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

* [Bug c++/104302] [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e
  2022-01-31 10:03 [Bug c++/104302] New: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-02-03  4:21 ` cvs-commit at gcc dot gnu.org
@ 2022-02-03  4:21 ` jason at gcc dot gnu.org
  2022-02-03  9:21 ` m.cencora at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2022-02-03  4:21 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |55227
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55227
[Bug 55227] designated initializer for char array by string constant

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

* [Bug c++/104302] [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e
  2022-01-31 10:03 [Bug c++/104302] New: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-02-03  4:21 ` jason at gcc dot gnu.org
@ 2022-02-03  9:21 ` m.cencora at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: m.cencora at gmail dot com @ 2022-02-03  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

m.cencora at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.cencora at gmail dot com

--- Comment #4 from m.cencora at gmail dot com ---
FWIW sometimes array size deduction fails even if init-list is not dependent,
see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93259

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

end of thread, other threads:[~2022-02-03  9:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 10:03 [Bug c++/104302] New: [12 Regression] ICE Segmentation fault since r12-6825-g2da90ad39bf8fa9e marxin at gcc dot gnu.org
2022-01-31 10:03 ` [Bug c++/104302] " marxin at gcc dot gnu.org
2022-02-01  0:14 ` pinskia at gcc dot gnu.org
2022-02-02 22:43 ` jason at gcc dot gnu.org
2022-02-03  4:21 ` cvs-commit at gcc dot gnu.org
2022-02-03  4:21 ` jason at gcc dot gnu.org
2022-02-03  9:21 ` m.cencora at gmail dot com

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).