public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94385] New: Internal compiler error for __builtin_convertvector + statement expr
@ 2020-03-28 21:45 evan@coeus-group.com
  2020-03-28 23:04 ` [Bug c++/94385] [10 Regression] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: evan@coeus-group.com @ 2020-03-28 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94385
           Summary: Internal compiler error for __builtin_convertvector +
                    statement expr
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: evan@coeus-group.com
  Target Milestone: ---

One of my projects is hitting an internal compiler error on GCC 10.  It works
for g++ 9, and it works in C mode.

Here is a test case:

  #include <stdint.h>

  typedef int32_t vec32 __attribute__((__vector_size__(16)));
  typedef float vecf __attribute__((__vector_size__(16)));

  vec32 foo(vecf bar) {
    return (__extension__({
      __builtin_convertvector(bar, vec32);
    }));
  }

Compiler Explorer link: https://godbolt.org/z/FMbXgs

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

* [Bug c++/94385] [10 Regression] Internal compiler error for __builtin_convertvector + statement expr
  2020-03-28 21:45 [Bug c++/94385] New: Internal compiler error for __builtin_convertvector + statement expr evan@coeus-group.com
@ 2020-03-28 23:04 ` jakub at gcc dot gnu.org
  2020-03-29 13:57 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-28 23:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |10.0
   Last reconfirmed|                            |2020-03-28
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r10-317-ga52cf5cf278e4a9e58bfa2bb67a93244766a122f , latent before
I think.
IMHO
--- gcc/cp/semantics.c.jj       2020-03-28 10:19:14.898349472 +0100
+++ gcc/cp/semantics.c  2020-03-29 00:02:40.648258781 +0100
@@ -380,7 +380,8 @@ add_stmt (tree t)

       /* When we expand a statement-tree, we must know whether or not the
         statements are full-expressions.  We record that fact here.  */
-      STMT_IS_FULL_EXPR_P (t) = stmts_are_full_exprs_p ();
+      if (STATEMENT_CODE_P (TREE_CODE (t)))
+       STMT_IS_FULL_EXPR_P (t) = stmts_are_full_exprs_p ();
     }

   if (code == LABEL_EXPR || code == CASE_LABEL_EXPR)
should fix this.

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

* [Bug c++/94385] [10 Regression] Internal compiler error for __builtin_convertvector + statement expr
  2020-03-28 21:45 [Bug c++/94385] New: Internal compiler error for __builtin_convertvector + statement expr evan@coeus-group.com
  2020-03-28 23:04 ` [Bug c++/94385] [10 Regression] " jakub at gcc dot gnu.org
@ 2020-03-29 13:57 ` jakub at gcc dot gnu.org
  2020-03-30 20:56 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-29 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/94385] [10 Regression] Internal compiler error for __builtin_convertvector + statement expr
  2020-03-28 21:45 [Bug c++/94385] New: Internal compiler error for __builtin_convertvector + statement expr evan@coeus-group.com
  2020-03-28 23:04 ` [Bug c++/94385] [10 Regression] " jakub at gcc dot gnu.org
  2020-03-29 13:57 ` jakub at gcc dot gnu.org
@ 2020-03-30 20:56 ` cvs-commit at gcc dot gnu.org
  2020-03-30 20:57 ` jakub at gcc dot gnu.org
  2020-04-07 19:04 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-30 20:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:1cb1986cb596336e688c079b821205ec212a46a3

commit r10-7464-g1cb1986cb596336e688c079b821205ec212a46a3
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Mar 30 22:55:36 2020 +0200

    c++: Fix handling of internal fn calls in statement expressions [PR94385]

    The following testcase ICEs, because the FE when processing the statement
    expression changes the .VEC_CONVERT internal fn CALL_EXPR into .PHI call.
    That is because the internal fn call is recorded in the base.u.ifn
    field, which overlaps base.u.bits.lang_flag_1 which is used for
    STMT_IS_FULL_EXPR_P, so this essentially does ifn |= 2 on little-endian.
    STMT_IS_FULL_EXPR_P bit is used in:
    cp-gimplify.c-  if (STATEMENT_CODE_P (code))
    cp-gimplify.c-    {
    cp-gimplify.c-      saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p
();
    cp-gimplify.c-      current_stmt_tree ()->stmts_are_full_exprs_p
    cp-gimplify.c:        = STMT_IS_FULL_EXPR_P (*expr_p);
    cp-gimplify.c-    }
    and
    pt.c-  if (STATEMENT_CODE_P (TREE_CODE (t)))
    pt.c:    current_stmt_tree ()->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P
(t);
    so besides being wrong on some other codes, it actually isn't beneficial at
    all to set it on anything else, so the following patch restricts it to
    trees with STATEMENT_CODE_P TREE_CODE.

    2020-03-30  Jakub Jelinek  <jakub@redhat.com>

            PR c++/94385
            * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees
with
            STATEMENT_CODE_P code.

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

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

* [Bug c++/94385] [10 Regression] Internal compiler error for __builtin_convertvector + statement expr
  2020-03-28 21:45 [Bug c++/94385] New: Internal compiler error for __builtin_convertvector + statement expr evan@coeus-group.com
                   ` (2 preceding siblings ...)
  2020-03-30 20:56 ` cvs-commit at gcc dot gnu.org
@ 2020-03-30 20:57 ` jakub at gcc dot gnu.org
  2020-04-07 19:04 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-30 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed (will apply later to release branches anyway as it is latent there).

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

* [Bug c++/94385] [10 Regression] Internal compiler error for __builtin_convertvector + statement expr
  2020-03-28 21:45 [Bug c++/94385] New: Internal compiler error for __builtin_convertvector + statement expr evan@coeus-group.com
                   ` (3 preceding siblings ...)
  2020-03-30 20:57 ` jakub at gcc dot gnu.org
@ 2020-04-07 19:04 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-07 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r9-8474-ga6bf0e5fb11cc0e231ac016a1995caaa93fdc4a0
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Mar 30 22:55:36 2020 +0200

    c++: Fix handling of internal fn calls in statement expressions [PR94385]

    The following testcase ICEs, because the FE when processing the statement
    expression changes the .VEC_CONVERT internal fn CALL_EXPR into .PHI call.
    That is because the internal fn call is recorded in the base.u.ifn
    field, which overlaps base.u.bits.lang_flag_1 which is used for
    STMT_IS_FULL_EXPR_P, so this essentially does ifn |= 2 on little-endian.
    STMT_IS_FULL_EXPR_P bit is used in:
    cp-gimplify.c-  if (STATEMENT_CODE_P (code))
    cp-gimplify.c-    {
    cp-gimplify.c-      saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p
();
    cp-gimplify.c-      current_stmt_tree ()->stmts_are_full_exprs_p
    cp-gimplify.c:        = STMT_IS_FULL_EXPR_P (*expr_p);
    cp-gimplify.c-    }
    and
    pt.c-  if (STATEMENT_CODE_P (TREE_CODE (t)))
    pt.c:    current_stmt_tree ()->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P
(t);
    so besides being wrong on some other codes, it actually isn't beneficial at
    all to set it on anything else, so the following patch restricts it to
    trees with STATEMENT_CODE_P TREE_CODE.

    2020-03-30  Jakub Jelinek  <jakub@redhat.com>

            PR c++/94385
            * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees
with
            STATEMENT_CODE_P code.

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

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

end of thread, other threads:[~2020-04-07 19:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28 21:45 [Bug c++/94385] New: Internal compiler error for __builtin_convertvector + statement expr evan@coeus-group.com
2020-03-28 23:04 ` [Bug c++/94385] [10 Regression] " jakub at gcc dot gnu.org
2020-03-29 13:57 ` jakub at gcc dot gnu.org
2020-03-30 20:56 ` cvs-commit at gcc dot gnu.org
2020-03-30 20:57 ` jakub at gcc dot gnu.org
2020-04-07 19:04 ` cvs-commit 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).