public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics
@ 2022-06-16 10:47 zsojka at seznam dot cz
  2022-06-16 13:12 ` [Bug c++/105998] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2022-06-16 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105998
           Summary: [10/11/12/13 Regression] ICE: in as_a, at
                    machmode.h:365 with vector arithmetics
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

Created attachment 53151
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53151&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-g++ testcase.C 
testcase.C: In function 'void foo()':
testcase.C:8:44: internal compiler error: in as_a, at machmode.h:365
    8 |   long l = (long) ((0 | v) - ((V) { } == 0));
      |                                            ^
0x90395f scalar_int_mode as_a<scalar_int_mode>(machine_mode)
        /repo/gcc-trunk/gcc/machmode.h:365
0x904edf scalar_int_mode as_a<scalar_int_mode>(machine_mode)
        /repo/gcc-trunk/gcc/tree.h:3630
0x904edf narrowing_initializer_constant_valid_p
        /repo/gcc-trunk/gcc/varasm.cc:4720
0x19d616e initializer_constant_valid_p_1
        /repo/gcc-trunk/gcc/varasm.cc:5022
0x19d70b1 initializer_constant_valid_p(tree_node*, tree_node*, bool)
        /repo/gcc-trunk/gcc/varasm.cc:5054
0xe493be reduced_constant_expression_p(tree_node*)
        /repo/gcc-trunk/gcc/cp/constexpr.cc:3100
0x109a807 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        /repo/gcc-trunk/gcc/cp/typeck2.cc:935
0xe9f6c7 check_initializer
        /repo/gcc-trunk/gcc/cp/decl.cc:7454
0xec5d41 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        /repo/gcc-trunk/gcc/cp/decl.cc:8439
0xfb7a5c cp_parser_init_declarator
        /repo/gcc-trunk/gcc/cp/parser.cc:22899
0xf914a3 cp_parser_simple_declaration
        /repo/gcc-trunk/gcc/cp/parser.cc:15315
0xf931ad cp_parser_declaration_statement
        /repo/gcc-trunk/gcc/cp/parser.cc:14394
0xf93a01 cp_parser_statement
        /repo/gcc-trunk/gcc/cp/parser.cc:12471
0xf9491d cp_parser_statement_seq_opt
        /repo/gcc-trunk/gcc/cp/parser.cc:12883
0xf949f8 cp_parser_compound_statement
        /repo/gcc-trunk/gcc/cp/parser.cc:12835
0xfb4f35 cp_parser_function_body
        /repo/gcc-trunk/gcc/cp/parser.cc:25184
0xfb4f35 cp_parser_ctor_initializer_opt_and_function_body
        /repo/gcc-trunk/gcc/cp/parser.cc:25235
0xfb6ada cp_parser_function_definition_after_declarator
        /repo/gcc-trunk/gcc/cp/parser.cc:31362
0xfb8060 cp_parser_function_definition_from_specifiers_and_declarator
        /repo/gcc-trunk/gcc/cp/parser.cc:31279
0xfb8060 cp_parser_init_declarator
        /repo/gcc-trunk/gcc/cp/parser.cc:22637
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-g++ -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-g++
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-1114-20220615202152-gdc9b92facf8-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/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-r13-1114-20220615202152-gdc9b92facf8-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220615 (experimental) (GCC)

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

* [Bug c++/105998] [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics
  2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
@ 2022-06-16 13:12 ` mpolacek at gcc dot gnu.org
  2022-06-16 14:34 ` [Bug middle-end/105998] [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-16 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2022-06-16
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |10.4

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with

commit 315aa691f486bfe71bae0a5fc8828db26daebb56
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Jul 23 09:48:56 2018 +0200

    re PR c++/86569 (-Wnonnull-compare affects code generation since r233684)

            PR c++/86569
            * cp-gimplify.c (cp_fold): Don't fold comparisons into other kind
            of expressions other than INTEGER_CST regardless of TREE_NO_WARNING
            or warn_nonnull_compare.

            * g++.dg/warn/Wnonnull-compare-9.C: New test.

    From-SVN: r262928

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

* [Bug middle-end/105998] [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf
  2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
  2022-06-16 13:12 ` [Bug c++/105998] " mpolacek at gcc dot gnu.org
@ 2022-06-16 14:34 ` jakub at gcc dot gnu.org
  2022-06-18  9:08 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-16 14:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
          Component|c++                         |middle-end

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

* [Bug middle-end/105998] [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf
  2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
  2022-06-16 13:12 ` [Bug c++/105998] " mpolacek at gcc dot gnu.org
  2022-06-16 14:34 ` [Bug middle-end/105998] [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf jakub at gcc dot gnu.org
@ 2022-06-18  9:08 ` cvs-commit at gcc dot gnu.org
  2022-06-18  9:14 ` [Bug middle-end/105998] [10/11/12 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-18  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r13-1163-gef662120177d39af5f88ffc622d90bb6ae0ca1d3
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Jun 18 11:07:13 2022 +0200

    varasm: Fix up ICE in narrowing_initializer_constant_valid_p [PR105998]

    The following testcase ICEs because there is NON_LVALUE_EXPR (location
    wrapper) around a VAR_DECL and has TYPE_MODE V2SImode and
    SCALAR_INT_TYPE_MODE on that ICEs.  Or for -m32 -march=i386 TYPE_MODE
    is DImode, but SCALAR_INT_TYPE_MODE still uses the raw V2SImode and ICEs
    too.

    2022-06-18  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/105998
            * varasm.cc (narrowing_initializer_constant_valid_p): Check
            SCALAR_INT_MODE_P instead of INTEGRAL_MODE_P, also break on
            ! INTEGRAL_TYPE_P and do the same check also on op{0,1}'s type.

            * c-c++-common/pr105998.c: New test.

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

* [Bug middle-end/105998] [10/11/12 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf
  2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2022-06-18  9:08 ` cvs-commit at gcc dot gnu.org
@ 2022-06-18  9:14 ` jakub at gcc dot gnu.org
  2022-06-19 10:09 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-18  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11/12/13 Regression]    |[10/11/12 Regression] ICE:
                   |ICE: in as_a, at            |in as_a, at machmode.h:365
                   |machmode.h:365 with vector  |with vector arithmetics
                   |arithmetics since           |since
                   |r9-1971-g315aa691f486bf     |r9-1971-g315aa691f486bf

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

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

* [Bug middle-end/105998] [10/11/12 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf
  2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2022-06-18  9:14 ` [Bug middle-end/105998] [10/11/12 " jakub at gcc dot gnu.org
@ 2022-06-19 10:09 ` cvs-commit at gcc dot gnu.org
  2022-06-20  6:37 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-19 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r12-8496-ge8df0d960b36146c8e193b269f9f7ae7dc76e08b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Jun 18 11:07:13 2022 +0200

    varasm: Fix up ICE in narrowing_initializer_constant_valid_p [PR105998]

    The following testcase ICEs because there is NON_LVALUE_EXPR (location
    wrapper) around a VAR_DECL and has TYPE_MODE V2SImode and
    SCALAR_INT_TYPE_MODE on that ICEs.  Or for -m32 -march=i386 TYPE_MODE
    is DImode, but SCALAR_INT_TYPE_MODE still uses the raw V2SImode and ICEs
    too.

    2022-06-18  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/105998
            * varasm.cc (narrowing_initializer_constant_valid_p): Check
            SCALAR_INT_MODE_P instead of INTEGRAL_MODE_P, also break on
            ! INTEGRAL_TYPE_P and do the same check also on op{0,1}'s type.

            * c-c++-common/pr105998.c: New test.

    (cherry picked from commit ef662120177d39af5f88ffc622d90bb6ae0ca1d3)

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

* [Bug middle-end/105998] [10/11/12 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf
  2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2022-06-19 10:09 ` cvs-commit at gcc dot gnu.org
@ 2022-06-20  6:37 ` cvs-commit at gcc dot gnu.org
  2022-06-20  6:38 ` cvs-commit at gcc dot gnu.org
  2022-06-20  9:49 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-20  6:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r11-10081-gf6b3ea602441ee870b6dd40cf8fa80fba127d99c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Jun 18 11:07:13 2022 +0200

    varasm: Fix up ICE in narrowing_initializer_constant_valid_p [PR105998]

    The following testcase ICEs because there is NON_LVALUE_EXPR (location
    wrapper) around a VAR_DECL and has TYPE_MODE V2SImode and
    SCALAR_INT_TYPE_MODE on that ICEs.  Or for -m32 -march=i386 TYPE_MODE
    is DImode, but SCALAR_INT_TYPE_MODE still uses the raw V2SImode and ICEs
    too.

    2022-06-18  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/105998
            * varasm.c (narrowing_initializer_constant_valid_p): Check
            SCALAR_INT_MODE_P instead of INTEGRAL_MODE_P, also break on
            ! INTEGRAL_TYPE_P and do the same check also on op{0,1}'s type.

            * c-c++-common/pr105998.c: New test.

    (cherry picked from commit ef662120177d39af5f88ffc622d90bb6ae0ca1d3)

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

* [Bug middle-end/105998] [10/11/12 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf
  2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2022-06-20  6:37 ` cvs-commit at gcc dot gnu.org
@ 2022-06-20  6:38 ` cvs-commit at gcc dot gnu.org
  2022-06-20  9:49 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-20  6:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:20bb976fb6a853d4f79577278ac2f01622946b61

commit r10-10857-g20bb976fb6a853d4f79577278ac2f01622946b61
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Jun 18 11:07:13 2022 +0200

    varasm: Fix up ICE in narrowing_initializer_constant_valid_p [PR105998]

    The following testcase ICEs because there is NON_LVALUE_EXPR (location
    wrapper) around a VAR_DECL and has TYPE_MODE V2SImode and
    SCALAR_INT_TYPE_MODE on that ICEs.  Or for -m32 -march=i386 TYPE_MODE
    is DImode, but SCALAR_INT_TYPE_MODE still uses the raw V2SImode and ICEs
    too.

    2022-06-18  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/105998
            * varasm.c (narrowing_initializer_constant_valid_p): Check
            SCALAR_INT_MODE_P instead of INTEGRAL_MODE_P, also break on
            ! INTEGRAL_TYPE_P and do the same check also on op{0,1}'s type.

            * c-c++-common/pr105998.c: New test.

    (cherry picked from commit ef662120177d39af5f88ffc622d90bb6ae0ca1d3)

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

* [Bug middle-end/105998] [10/11/12 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf
  2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2022-06-20  6:38 ` cvs-commit at gcc dot gnu.org
@ 2022-06-20  9:49 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-20  9:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-06-20  9:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 10:47 [Bug c++/105998] New: [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics zsojka at seznam dot cz
2022-06-16 13:12 ` [Bug c++/105998] " mpolacek at gcc dot gnu.org
2022-06-16 14:34 ` [Bug middle-end/105998] [10/11/12/13 Regression] ICE: in as_a, at machmode.h:365 with vector arithmetics since r9-1971-g315aa691f486bf jakub at gcc dot gnu.org
2022-06-18  9:08 ` cvs-commit at gcc dot gnu.org
2022-06-18  9:14 ` [Bug middle-end/105998] [10/11/12 " jakub at gcc dot gnu.org
2022-06-19 10:09 ` cvs-commit at gcc dot gnu.org
2022-06-20  6:37 ` cvs-commit at gcc dot gnu.org
2022-06-20  6:38 ` cvs-commit at gcc dot gnu.org
2022-06-20  9:49 ` rguenth 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).