public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand
@ 2020-07-14  8:12 manuel.lauss at googlemail dot com
  2020-07-14 10:53 ` [Bug middle-end/96194] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: manuel.lauss at googlemail dot com @ 2020-07-14  8:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96194
           Summary: 10.1.1: ICE in assign_temp, at function.c:984 during
                    RTL pass: expand
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manuel.lauss at googlemail dot com
  Target Milestone: ---

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

The attached unreduced testcase, extracted from current mesa, generates the
following ICE with -O2 or higher.  Current 10.1.1 as of today (14.07.2020),
with the fix to PR96130 applied.


# g++ -O2 -c p_tesselator.i
during RTL pass: expand
../mesa-9999/src/gallium/auxiliary/tessellator/p_tessellator.cpp: In function
'pipe_tessellator* p_tess_init(pipe_prim_type, pipe_tess_spacing, bool, bool)':
../mesa-9999/src/gallium/auxiliary/tessellator/p_tessellator.cpp:130:1:
internal compiler error: in assign_temp, at function.c:984
  130 | p_tess_init(enum pipe_prim_type tes_prim_mode,
      | ^~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.gentoo.org/> for instructions.

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

* [Bug middle-end/96194] 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
@ 2020-07-14 10:53 ` jakub at gcc dot gnu.org
  2020-07-14 11:02 ` [Bug middle-end/96194] [10/11 Regression] " jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-14 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-14

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase:

typedef decltype (sizeof 0) size_t;
void *operator new (size_t, void *b) { return b; }
struct A { ~A (); };
struct B : A { float e[64]; };

void *
foo (void *x, bool y)
{
  void *p = y ? x : nullptr;
  return new (p) B ();
}

(the nullptr is from:
static inline void *
os_malloc_aligned(size_t size, size_t alignment)
{
   void *ptr;
   alignment = (alignment + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
   if(posix_memalign(&ptr, alignment, size) != 0)
      return NULL;
   return ptr;
}
) and jump threading makes return new (nullptr) B (); out of this.

typedef decltype (sizeof 0) size_t;
void *operator new (size_t, void *b) { return b; }
struct A { ~A (); };
struct B : A { float e[64]; };

void *
foo ()
{
  return new (nullptr) B ();
}

ICEs too.

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
  2020-07-14 10:53 ` [Bug middle-end/96194] " jakub at gcc dot gnu.org
@ 2020-07-14 11:02 ` jakub at gcc dot gnu.org
  2020-07-14 11:09 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-14 11:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|10.1.1: ICE in assign_temp, |[10/11 Regression] ICE in
                   |at function.c:984 during    |assign_temp, at
                   |RTL pass: expand            |function.c:984 during RTL
                   |                            |pass: expand
           Priority|P3                          |P1
   Target Milestone|---                         |10.2

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r11-2045-ga4aca1edaf37d43b2b7e9111825837a7a317b1b0 and its
r10-2046 backport.

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
  2020-07-14 10:53 ` [Bug middle-end/96194] " jakub at gcc dot gnu.org
  2020-07-14 11:02 ` [Bug middle-end/96194] [10/11 Regression] " jakub at gcc dot gnu.org
@ 2020-07-14 11:09 ` jakub at gcc dot gnu.org
  2020-07-14 11:10 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-14 11:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/expr.c.jj       2020-07-13 19:09:33.173872178 +0200
+++ gcc/expr.c  2020-07-14 13:07:26.228801996 +0200
@@ -8382,7 +8382,9 @@ expand_constructor (tree exp, rtx target
       || GET_CODE (target) == PARALLEL || modifier == EXPAND_STACK_PARM
       /* Also make a temporary if the store is to volatile memory, to
         avoid individual accesses to aggregate members.  */
-      || (GET_CODE (target) == MEM && MEM_VOLATILE_P (target)))
+      || (GET_CODE (target) == MEM
+         && MEM_VOLATILE_P (target)
+         && !TREE_ADDRESSABLE (TREE_TYPE (exp))))
     {
       if (avoid_temp_mem)
        return NULL_RTX;
fixes this - even when volatile, for non-POD types the middle-end may not
create temporaries period.

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
                   ` (2 preceding siblings ...)
  2020-07-14 11:09 ` jakub at gcc dot gnu.org
@ 2020-07-14 11:10 ` jakub at gcc dot gnu.org
  2020-07-14 11:22 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-14 11:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Started with r11-2045-ga4aca1edaf37d43b2b7e9111825837a7a317b1b0 and its
> r10-2046 backport.

Sorry, meant r10-8468 backport.

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
                   ` (3 preceding siblings ...)
  2020-07-14 11:10 ` jakub at gcc dot gnu.org
@ 2020-07-14 11:22 ` jakub at gcc dot gnu.org
  2020-07-14 12:03 ` manuel.lauss at googlemail dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-14 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48874
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48874&action=edit
gcc11-pr96194.patch

Untested fix.

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
                   ` (4 preceding siblings ...)
  2020-07-14 11:22 ` jakub at gcc dot gnu.org
@ 2020-07-14 12:03 ` manuel.lauss at googlemail dot com
  2020-07-14 14:03 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: manuel.lauss at googlemail dot com @ 2020-07-14 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Manuel Lauss <manuel.lauss at googlemail dot com> ---
(In reply to Jakub Jelinek from comment #5)
> Created attachment 48874 [details]
> gcc11-pr96194.patch
> 
> Untested fix.

It fixes the mesa build, thank you!

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
                   ` (5 preceding siblings ...)
  2020-07-14 12:03 ` manuel.lauss at googlemail dot com
@ 2020-07-14 14:03 ` cvs-commit at gcc dot gnu.org
  2020-07-14 14:04 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-14 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:b1d389d60d1929c7528ef984925ea010e3bf2c1a

commit r11-2086-gb1d389d60d1929c7528ef984925ea010e3bf2c1a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jul 14 16:01:11 2020 +0200

    expr: Unbreak build of mesa [PR96194]

    > > The store to the whole of each volatile object was picked apart
    > > like there had been an individual assignment to each of the
    > > fields.  Reads were added as part of that; see PR for details.
    > > The reads from volatile memory were a clear bug; individual
    > > stores questionable.  A separate patch clarifies the docs.

    This breaks building of mesa on both the trunk and 10 branch.

    The problem is that the middle-end may never create temporaries of non-POD
    (TREE_ADDRESSABLE) types, those can be only created when the language says
    so and thus only the FE is allowed to create those.

    This patch just reverts the behavior to what we used to do before for the
    stores to volatile non-PODs.  Perhaps we want to do something else, but
    definitely we can't create temporaries of the non-POD type.  It is up to
    discussions on what should happen in those cases.

    2020-07-14  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/96194
            * expr.c (expand_constructor): Don't create temporary for store to
            volatile MEM if exp has an addressable type.

            * g++.dg/opt/pr96194.C: New test.

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
                   ` (6 preceding siblings ...)
  2020-07-14 14:03 ` cvs-commit at gcc dot gnu.org
@ 2020-07-14 14:04 ` cvs-commit at gcc dot gnu.org
  2020-07-14 14:08 ` jakub at gcc dot gnu.org
  2020-07-23  1:29 ` hp at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-14 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:de70758207a6b2d8d3d6bbd3fc564ca736ed094f

commit r10-8493-gde70758207a6b2d8d3d6bbd3fc564ca736ed094f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jul 14 16:01:11 2020 +0200

    expr: Unbreak build of mesa [PR96194]

    > > The store to the whole of each volatile object was picked apart
    > > like there had been an individual assignment to each of the
    > > fields.  Reads were added as part of that; see PR for details.
    > > The reads from volatile memory were a clear bug; individual
    > > stores questionable.  A separate patch clarifies the docs.

    This breaks building of mesa on both the trunk and 10 branch.

    The problem is that the middle-end may never create temporaries of non-POD
    (TREE_ADDRESSABLE) types, those can be only created when the language says
    so and thus only the FE is allowed to create those.

    This patch just reverts the behavior to what we used to do before for the
    stores to volatile non-PODs.  Perhaps we want to do something else, but
    definitely we can't create temporaries of the non-POD type.  It is up to
    discussions on what should happen in those cases.

    2020-07-14  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/96194
            * expr.c (expand_constructor): Don't create temporary for store to
            volatile MEM if exp has an addressable type.

            * g++.dg/opt/pr96194.C: New test.

    (cherry picked from commit b1d389d60d1929c7528ef984925ea010e3bf2c1a)

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
                   ` (7 preceding siblings ...)
  2020-07-14 14:04 ` cvs-commit at gcc dot gnu.org
@ 2020-07-14 14:08 ` jakub at gcc dot gnu.org
  2020-07-23  1:29 ` hp at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-14 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

* [Bug middle-end/96194] [10/11 Regression] ICE in assign_temp, at function.c:984 during RTL pass: expand
  2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
                   ` (8 preceding siblings ...)
  2020-07-14 14:08 ` jakub at gcc dot gnu.org
@ 2020-07-23  1:29 ` hp at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: hp at gcc dot gnu.org @ 2020-07-23  1:29 UTC (permalink / raw)
  To: gcc-bugs

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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michael at michaelmarley dot com

--- Comment #10 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
*** Bug 96292 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2020-07-23  1:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14  8:12 [Bug c++/96194] New: 10.1.1: ICE in assign_temp, at function.c:984 during RTL pass: expand manuel.lauss at googlemail dot com
2020-07-14 10:53 ` [Bug middle-end/96194] " jakub at gcc dot gnu.org
2020-07-14 11:02 ` [Bug middle-end/96194] [10/11 Regression] " jakub at gcc dot gnu.org
2020-07-14 11:09 ` jakub at gcc dot gnu.org
2020-07-14 11:10 ` jakub at gcc dot gnu.org
2020-07-14 11:22 ` jakub at gcc dot gnu.org
2020-07-14 12:03 ` manuel.lauss at googlemail dot com
2020-07-14 14:03 ` cvs-commit at gcc dot gnu.org
2020-07-14 14:04 ` cvs-commit at gcc dot gnu.org
2020-07-14 14:08 ` jakub at gcc dot gnu.org
2020-07-23  1:29 ` hp 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).