public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
@ 2020-06-15 18:46 gscfq@t-online.de
  2020-06-15 19:05 ` [Bug fortran/95690] " marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2020-06-15 18:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95690
           Summary: [11 Regression] ICE in
                    set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Changed between 20200531 and 20200607 :


$ cat z1.f90
module m
contains
   subroutine s
      print *, (erfc)
   end
   function erfc()
   end
end


$ gfortran-11-20200531 -c z1.f90
z1.f90:4:0:

    4 |       print *, (erfc)
      |
Error: initializer for floating value is not a floating constant


$ gfortran-11-20200614 -c z1.f90
during RTL pass: expand
z1.f90:4:0:

    4 |       print *, (erfc)
      |
internal compiler error: in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
0x89d5d0 set_mem_attributes_minus_bitpos(rtx_def*, tree_node*, int,
poly_int<1u, long>)
        ../../gcc/emit-rtl.c:2090
0xe6d8c4 build_constant_desc
        ../../gcc/varasm.c:3402
0xe6d8c4 add_constant_to_table
        ../../gcc/varasm.c:3454
0xe6aa2c output_constant_def(tree_node*, int)
        ../../gcc/varasm.c:3478
0x8d0034 expand_expr_constant
        ../../gcc/expr.c:8079
0x8d0034 expand_expr_addr_expr_1
        ../../gcc/expr.c:8132
0x8c5cbd expand_expr_addr_expr
        ../../gcc/expr.c:8299
0x8c5cbd expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/expr.c:11474
0x7bdd80 expand_normal
        ../../gcc/expr.h:288
0x7bdd80 precompute_register_parameters
        ../../gcc/calls.c:982
0x7bdd80 expand_call(tree_node*, rtx_def*, int)
        ../../gcc/calls.c:4337
0x8c662e expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/expr.c:11246
0x7cba7a expand_expr
        ../../gcc/expr.h:282
0x7cba7a expand_call_stmt
        ../../gcc/cfgexpand.c:2703
0x7cba7a expand_gimple_stmt_1
        ../../gcc/cfgexpand.c:3682
0x7cba7a expand_gimple_stmt
        ../../gcc/cfgexpand.c:3847
0x7d0527 expand_gimple_basic_block
        ../../gcc/cfgexpand.c:5888
0x7d2b9e execute
        ../../gcc/cfgexpand.c:6572

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

* [Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
  2020-06-15 18:46 [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092 gscfq@t-online.de
@ 2020-06-15 19:05 ` marxin at gcc dot gnu.org
  2020-06-15 19:13 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-15 19:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2020-06-15
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-963-g80d6f89e78fc3b77.

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

* [Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
  2020-06-15 18:46 [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092 gscfq@t-online.de
  2020-06-15 19:05 ` [Bug fortran/95690] " marxin at gcc dot gnu.org
@ 2020-06-15 19:13 ` dominiq at lps dot ens.fr
  2020-06-16  6:41 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-06-15 19:13 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
  2020-06-15 18:46 [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092 gscfq@t-online.de
  2020-06-15 19:05 ` [Bug fortran/95690] " marxin at gcc dot gnu.org
  2020-06-15 19:13 ` dominiq at lps dot ens.fr
@ 2020-06-16  6:41 ` rguenth at gcc dot gnu.org
  2020-06-16  7:30 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-16  6:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Target Milestone|---                         |11.0
             Status|NEW                         |ASSIGNED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look, but I guess given the error from the FE we're handing
broken GENERIC to the backend.

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

* [Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
  2020-06-15 18:46 [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2020-06-16  6:41 ` rguenth at gcc dot gnu.org
@ 2020-06-16  7:30 ` rguenth at gcc dot gnu.org
  2020-06-16 11:57 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-16  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(gdb) p t
$1 = <paren_expr 0x7ffff6d67940>
(gdb) p debug_generic_expr (t)
((erfc))

so that's the DECL_INITIAL of a CONST_DECL.  The CONST_DECL is built that
way by the FE:

8833      /* Create a temporary var to hold the value.  */
8834      if (TREE_CONSTANT (se->expr))
8835        {
8836          tree tmp = se->expr;
8837          STRIP_TYPE_NOPS (tmp);
8838          var = build_decl (input_location,
8839                            CONST_DECL, NULL, TREE_TYPE (tmp));
8840          DECL_INITIAL (var) = tmp;

and the middle-end doesn't really expect PAREN_EXPRs.  I don't see any
stripping of other codes on the path to the ICE so I'll amend what is already
there.  But IMHO build_constant_desc shouldn't pass the constant expression
to be used as MEM_EXPR, instead passing down the type looks more appropriate
and future-proof...

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

* [Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
  2020-06-15 18:46 [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2020-06-16  7:30 ` rguenth at gcc dot gnu.org
@ 2020-06-16 11:57 ` cvs-commit at gcc dot gnu.org
  2020-06-16 11:57 ` rguenth at gcc dot gnu.org
  2020-06-23 13:31 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-16 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

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

commit r11-1349-ga97e49a89d11b302b12ec319a3316ba78adca02a
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Jun 16 09:36:09 2020 +0200

    middle-end/95690 - avoid MEM_EXPRs for constants

    The following avoids calling set_mem_attributes on the
    DECL_INITIAL of a CONST_DECL which seems pointless since there
    cannot be a sensible MEM_EXPR derived from that.  We're overwriting
    both other possibly useful info, alias-set and alignment immediately
    so the following patch simply removes the call instead of making
    the function deal with even more (unexpected) trees that are not
    memory accesses.

    2020-06-16  Richard Biener  <rguenther@suse.de>

            PR middle-end/95690
            * varasm.c (build_constant_desc): Remove set_mem_attributes call.

            * gfortran.dg/pr95690.f90: New testcase.

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

* [Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
  2020-06-15 18:46 [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2020-06-16 11:57 ` cvs-commit at gcc dot gnu.org
@ 2020-06-16 11:57 ` rguenth at gcc dot gnu.org
  2020-06-23 13:31 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-16 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95493
[Bug 95493] [10 Regression] test for vector members apparently reordered with
assignment to vector members since r10-7523-gb90061c6ec090c6b

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

* [Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
  2020-06-15 18:46 [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2020-06-16 11:57 ` rguenth at gcc dot gnu.org
@ 2020-06-23 13:31 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-23 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:7d919c33fbd29a996326840dae3b5e093c3190f4

commit r10-8355-g7d919c33fbd29a996326840dae3b5e093c3190f4
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jun 4 13:44:58 2020 +0200

    middle-end/95493 - bogus MEM_ATTRS for variable array access

    The following patch avoids keeping the inherited MEM_ATTRS when
    set_mem_attributes_minus_bitpos is called with a variable ARRAY_REF.
    The inherited ones may not reflect the correct offset and neither
    does the updated alias-set match the inherited MEM_EXPR.  This all
    ends up confusing path-based alias-analysis, causing wrong-code.

    The fix is to stop not adopting a MEM_EXPR for certain kinds of
    expressions and instead handle everything we can.  There's still
    the constant kind trees case which I'm too lazy to look into right
    now.  I did refrain from adding SSA_NAME there and instead avoided
    calling set_mem_attributes_minus_bitpos when debug expression
    expansion ended up expanding a SSA definition RHS which should
    already have taken care of setting the appropriate MEM_ATTRS.

    It also avoids calling set_mem_attributes on the
    DECL_INITIAL of a CONST_DECL which seems pointless since there
    cannot be a sensible MEM_EXPR derived from that.  We're overwriting
    both other possibly useful info, alias-set and alignment immediately
    so the following patch simply removes the call instead of making
    the function deal with even more (unexpected) trees that are not
    memory accesses.

    2020-06-23  Richard Biener  <rguenther@suse.de>

            PR middle-end/95493
            PR middle-end/95690
            * cfgexpand.c (expand_debug_expr): Avoid calling
            set_mem_attributes_minus_bitpos when we were expanding
            an SSA name.
            * emit-rtl.c (set_mem_attributes_minus_bitpos): Remove
            ARRAY_REF special-casing, add CONSTRUCTOR to the set of
            special-cases we do not want MEM_EXPRs for.  Assert
            we end up with reasonable MEM_EXPRs.
            * varasm.c (build_constant_desc): Remove set_mem_attributes call.

            * g++.dg/torture/pr95493.C: New testcase.
            * g++.dg/torture/pr95493-1.C: Likewise.
            * gfortran.dg/pr95690.f90: Likewise.

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

end of thread, other threads:[~2020-06-23 13:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 18:46 [Bug fortran/95690] New: [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092 gscfq@t-online.de
2020-06-15 19:05 ` [Bug fortran/95690] " marxin at gcc dot gnu.org
2020-06-15 19:13 ` dominiq at lps dot ens.fr
2020-06-16  6:41 ` rguenth at gcc dot gnu.org
2020-06-16  7:30 ` rguenth at gcc dot gnu.org
2020-06-16 11:57 ` cvs-commit at gcc dot gnu.org
2020-06-16 11:57 ` rguenth at gcc dot gnu.org
2020-06-23 13:31 ` 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).