public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
@ 2020-11-18 16:37 gscfq@t-online.de
  2020-11-18 17:57 ` [Bug fortran/97896] " dominiq at lps dot ens.fr
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: gscfq@t-online.de @ 2020-11-18 16:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97896
           Summary: [11 Regression] ICE in gfc_trans_assignment_1, at
                    fortran/trans-expr.c:11156
           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: ---

Follow-up of pr91651, changed between 20201004 and 20201018 :


$ cat z1.f90
program p
   logical :: a(2)
   integer :: b(2)
   b = index('xyxy', 'yx', a, 4)
   print *, b
end


$ gfortran-11-20201004 -c z1.f90
$
$ gfortran-11-20201115 -c z1.f90
z1.f90:4:32:

    4 |    b = index('xyxy', 'yx', a, 4)
      |                                1
internal compiler error: in gfc_trans_assignment_1, at
fortran/trans-expr.c:11156
0x764094 gfc_trans_assignment_1
        ../../gcc/fortran/trans-expr.c:11155
0x725aa7 trans_code
        ../../gcc/fortran/trans.c:1888
0x74bbe4 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6878
0x6d2e86 translate_all_program_units
        ../../gcc/fortran/parse.c:6347
0x6d2e86 gfc_parse_file()
        ../../gcc/fortran/parse.c:6616
0x71ee2f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
@ 2020-11-18 17:57 ` dominiq at lps dot ens.fr
  2020-11-18 21:48 ` anlauf at gcc dot gnu.org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-11-18 17:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-11-18
             Status|UNCONFIRMED                 |WAITING
           Priority|P3                          |P4
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I see the ICE from GCC7 up to GCC11, including GCC 10.2.1, but not for GCC
10.2.0.

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
  2020-11-18 17:57 ` [Bug fortran/97896] " dominiq at lps dot ens.fr
@ 2020-11-18 21:48 ` anlauf at gcc dot gnu.org
  2020-11-19  7:34 ` rguenth at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-18 21:48 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
Reverting the following snippet from my fix attempt for pr91651:

diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index c2a4865f28f..994a9af4eb8 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -1296,11 +1296,7 @@ gfc_resolve_index_func (gfc_expr *f, gfc_actual_arglist
*a)

   f->ts.type = BT_INTEGER;
   if (kind)
-    {
-      f->ts.kind = mpz_get_si ((kind)->value.integer);
-      a_back->next = NULL;
-      gfc_free_actual_arglist (a_kind);
-    }
+    f->ts.kind = mpz_get_si ((kind)->value.integer);
   else
     f->ts.kind = gfc_default_integer_kind;

fixes the current PR, but breaks testcase index_4.f90

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
  2020-11-18 17:57 ` [Bug fortran/97896] " dominiq at lps dot ens.fr
  2020-11-18 21:48 ` anlauf at gcc dot gnu.org
@ 2020-11-19  7:34 ` rguenth at gcc dot gnu.org
  2020-11-19 20:28 ` anlauf at gcc dot gnu.org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-19  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2020-11-19  7:34 ` rguenth at gcc dot gnu.org
@ 2020-11-19 20:28 ` anlauf at gcc dot gnu.org
  2020-11-20 14:55 ` mikael at gcc dot gnu.org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-19 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #2)
> Reverting the following snippet from my fix attempt for pr91651:

That snippet is necessary for the scalarizer during simplification.
The original ICE is coming from the assert in trans-expr.c:

11155     else
11156       {
11157         gcc_assert (lse.ss == gfc_ss_terminator
11158                     && rse.ss == gfc_ss_terminator);

Printing lse.ss and rse.ss for

  b = index ('xyxyz','yx', back=a)
  b = index ('xyxyz','yx', back=a, kind=4)

one sees that the first case without kind is fine, while the second case has

(gdb) p *rse.ss
$30 = {info = 0x288c1c0, dimen = 0, dim = {0 <repeats 15 times>}, loop_chain =
0x2814270, 
  next = 0x268eb80 <gfc_ss_terminator_var>, parent = 0x0, nested_ss = 0x0, 
  loop = 0x7fffffffcd90, is_alloc_lhs = 0, no_bounds_check = 0}

so something is screwing up the scalarization.

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2020-11-19 20:28 ` anlauf at gcc dot gnu.org
@ 2020-11-20 14:55 ` mikael at gcc dot gnu.org
  2020-11-20 20:48 ` anlauf at gcc dot gnu.org
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mikael at gcc dot gnu.org @ 2020-11-20 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to anlauf from comment #3) 
> so something is screwing up the scalarization.

Indeed.
gfc_walk_expr registers all the arrays involved as an early step of scalarizing
a statement.
The failing assert checks that all the arrays have been used/consumed, meaning
that the array registration and the actual code generation are kept
synchronized.

Elemental actual arguments are some of those arrays involved.
Obviously one should not remove some of them in the middle of code generation.
It should be done beforehand if at all.

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2020-11-20 14:55 ` mikael at gcc dot gnu.org
@ 2020-11-20 20:48 ` anlauf at gcc dot gnu.org
  2020-11-21 18:00 ` mikael at gcc dot gnu.org
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-20 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from anlauf at gcc dot gnu.org ---
(In reply to Mikael Morin from comment #4)
> Elemental actual arguments are some of those arrays involved.
> Obviously one should not remove some of them in the middle of code
> generation.
> It should be done beforehand if at all.

The problem is only the KIND argument, which must be a scalar constant that
determines the function call and subsequent conversions.

The patch below solves the issue in comment#0, as well as most of

program p
  implicit none
  logical    :: a(2)
  integer    :: b(2)
  integer(8) :: d(2)
  b = index ('xyxyz','yx', back=a)
  b = index ('xyxyz','yx', back=a, kind=4) ! works now
  d = index ('xyxyz','yx', back=a, kind=8) ! works now
! b = index ('xyxyz','yx', back=a, kind=8) ! ICE remains
! d = index ('xyxyz','yx', back=a, kind=4) ! ICE remains
  print *, b, d
end


diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 2167de455b8..dc3624f2204 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -10858,6 +10860,8 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr *
expr2, bool init_flag,
       gfc_init_loopinfo (&loop);

       /* Walk the rhs.  */
+      if (expr2->value.function.isym)
+       gfc_strip_kind_from_actual (expr2->value.function.actual);
       rss = gfc_walk_expr (expr2);
       if (rss == gfc_ss_terminator)
        /* The rhs is scalar.  Add a ss for the expression.  */
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index d17b623924c..b5ca67198c2 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -5149,8 +5149,8 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr *
expr)
 /* Remove unneeded kind= argument from actual argument list when the
    result conversion is dealt with in a different place.  */

-static void
-strip_kind_from_actual (gfc_actual_arglist * actual)
+void
+gfc_strip_kind_from_actual (gfc_actual_arglist * actual)
 {
   for (gfc_actual_arglist *a = actual; a; a = a->next)
     {
@@ -5297,7 +5297,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr *
expr, enum tree_code op)
     {
       gfc_actual_arglist *a;
       a = actual;
-      strip_kind_from_actual (a);
+      gfc_strip_kind_from_actual (a);
       while (a)
        {
          if (a->name && strcmp (a->name, "dim") == 0)
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 16b4215605e..617916fa579 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -821,6 +821,7 @@ void gfc_omp_firstprivatize_type_sizes (struct
gimplify_omp_ctx *, tree);
 /* In trans-intrinsic.c.  */
 void gfc_conv_intrinsic_mvbits (gfc_se *, gfc_actual_arglist *,
                                gfc_loopinfo *);
+void gfc_strip_kind_from_actual (gfc_actual_arglist *);

 /* Runtime library function decls.  */
 extern GTY(()) tree gfor_fndecl_pause_numeric;

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2020-11-20 20:48 ` anlauf at gcc dot gnu.org
@ 2020-11-21 18:00 ` mikael at gcc dot gnu.org
  2020-11-21 18:02 ` mikael at gcc dot gnu.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mikael at gcc dot gnu.org @ 2020-11-21 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> ---
Created attachment 49609
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49609&action=edit
rough patch

OK, I understand better the problem.
It’s not a bug that the kind argument is not used to produce code.
It is known to be a constant, and that constant can be used directly at compile
time.
So it is the walking functions that should be fixed.
I attach a rough patch doing that, it should sit on top of a full revert of
pr91651.

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2020-11-21 18:00 ` mikael at gcc dot gnu.org
@ 2020-11-21 18:02 ` mikael at gcc dot gnu.org
  2020-11-21 18:06 ` mikael at gcc dot gnu.org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mikael at gcc dot gnu.org @ 2020-11-21 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #6)
> rough patch
> 
Well, it doesn’t fix comment #5. :-(

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

* [Bug fortran/97896] [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2020-11-21 18:02 ` mikael at gcc dot gnu.org
@ 2020-11-21 18:06 ` mikael at gcc dot gnu.org
  2021-04-27 11:39 ` [Bug fortran/97896] [11/12 " jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mikael at gcc dot gnu.org @ 2020-11-21 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #7)
> Well, it doesn’t fix comment #5. :-(

Pilot error, it does fix it.

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2020-11-21 18:06 ` mikael at gcc dot gnu.org
@ 2021-04-27 11:39 ` jakub at gcc dot gnu.org
  2021-07-28  7:05 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.0                        |11.2

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2021-04-27 11:39 ` [Bug fortran/97896] [11/12 " jakub at gcc dot gnu.org
@ 2021-07-28  7:05 ` rguenth at gcc dot gnu.org
  2021-08-07 18:38 ` mikael at gcc dot gnu.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |11.3

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (10 preceding siblings ...)
  2021-07-28  7:05 ` rguenth at gcc dot gnu.org
@ 2021-08-07 18:38 ` mikael at gcc dot gnu.org
  2021-11-12 12:11 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mikael at gcc dot gnu.org @ 2021-08-07 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

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

--- Comment #11 from Mikael Morin <mikael at gcc dot gnu.org> ---
Patches posted:

v1:
https://gcc.gnu.org/pipermail/fortran/2021-August/056303.html

v2: 
https://gcc.gnu.org/pipermail/fortran/2021-August/056317.html

11 backport:
https://gcc.gnu.org/pipermail/fortran/2021-August/056329.html

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (11 preceding siblings ...)
  2021-08-07 18:38 ` mikael at gcc dot gnu.org
@ 2021-11-12 12:11 ` cvs-commit at gcc dot gnu.org
  2021-11-16 20:36 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-12 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Mikael Morin <mikael@gcc.gnu.org>:

https://gcc.gnu.org/g:68d62cb20637b2faf2c2cc1716a0786b07a6a76f

commit r12-5192-g68d62cb20637b2faf2c2cc1716a0786b07a6a76f
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Sun Nov 7 14:39:18 2021 +0100

    fortran: Ignore unused args in scalarization [PR97896]

    The KIND argument of the INDEX intrinsic is a compile time constant
    that is used at compile time only to resolve to a kind-specific library
    function.  That argument is otherwise completely ignored at runtime, and
there is
    no code generated for it as the library procedure has no kind argument.
    This confuses the scalarizer which expects to see every argument
    of elemental functions used when calling a procedure.
    This change removes the argument from the scalarization lists
    at the beginning of the scalarization process, so that the argument
    is completely ignored.
    This also reverts the existing workaround
    (commit d09847357b965a2c2cda063827ce362d4c9c86f2 except for its testcase).

            PR fortran/97896

    gcc/fortran/ChangeLog:
            * intrinsic.c (add_sym_4ind): Remove.
            (add_functions): Use add_sym4 instead of add_sym4ind.
            Donât special case the index intrinsic.
            * iresolve.c (gfc_resolve_index_func): Use the individual arguments
            directly instead of the full argument list.
            * intrinsic.h (gfc_resolve_index_func): Update the declaration
            accordingly.
            * trans-decl.c (gfc_get_extern_function_decl): Donât modify the
            list of arguments in the case of the index intrinsic.
            * trans-array.h (gfc_get_intrinsic_for_expr,
            gfc_get_proc_ifc_for_expr): New.
            * trans-array.c (gfc_get_intrinsic_for_expr,
            arg_evaluated_for_scalarization): New.
            (gfc_walk_elemental_function_args): Add intrinsic procedure
            as argument.  Count arguments.  Check
arg_evaluated_for_scalarization.
            * trans-intrinsic.c (gfc_walk_intrinsic_function): Update call.
            * trans-stmt.c (get_intrinsic_for_code): New.
            (gfc_trans_call): Update call.

    gcc/testsuite/ChangeLog:
            * gfortran.dg/index_5.f90: New.

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (12 preceding siblings ...)
  2021-11-12 12:11 ` cvs-commit at gcc dot gnu.org
@ 2021-11-16 20:36 ` cvs-commit at gcc dot gnu.org
  2021-11-17 10:45 ` mikael at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-16 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Mikael Morin
<mikael@gcc.gnu.org>:

https://gcc.gnu.org/g:92e549683e1f46ba419e40b12928dc8afe5dc967

commit r11-9243-g92e549683e1f46ba419e40b12928dc8afe5dc967
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Sun Nov 7 14:39:18 2021 +0100

    fortran: Ignore unused args in scalarization [PR97896]

    The KIND argument of the INDEX intrinsic is a compile time constant
    that is used at compile time only to resolve to a kind-specific library
    function.  That argument is otherwise completely ignored at runtime, and
there is
    no code generated for it as the library procedure has no kind argument.
    This confuses the scalarizer which expects to see every argument
    of elemental functions used when calling a procedure.
    This change removes the argument from the scalarization lists
    at the beginning of the scalarization process, so that the argument
    is completely ignored.
    This also reverts the existing workaround
    (commit d09847357b965a2c2cda063827ce362d4c9c86f2 except for its testcase).

            PR fortran/97896

    gcc/fortran/ChangeLog:
            * intrinsic.c (add_sym_4ind): Remove.
            (add_functions): Use add_sym4 instead of add_sym4ind.
            Donât special case the index intrinsic.
            * iresolve.c (gfc_resolve_index_func): Use the individual arguments
            directly instead of the full argument list.
            * intrinsic.h (gfc_resolve_index_func): Update the declaration
            accordingly.
            * trans-decl.c (gfc_get_extern_function_decl): Donât modify the
            list of arguments in the case of the index intrinsic.
            * trans-array.h (gfc_get_intrinsic_for_expr,
            gfc_get_proc_ifc_for_expr): New.
            * trans-array.c (gfc_get_intrinsic_for_expr,
            arg_evaluated_for_scalarization): New.
            (gfc_walk_elemental_function_args): Add intrinsic procedure
            as argument.  Count arguments.  Check
arg_evaluated_for_scalarization.
            * trans-intrinsic.c (gfc_walk_intrinsic_function): Update call.
            * trans-stmt.c (get_intrinsic_for_code): New.
            (gfc_trans_call): Update call.

    gcc/testsuite/ChangeLog:
            * gfortran.dg/index_5.f90: New.

    (cherry picked from commit 68d62cb20637b2faf2c2cc1716a0786b07a6a76f)

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (13 preceding siblings ...)
  2021-11-16 20:36 ` cvs-commit at gcc dot gnu.org
@ 2021-11-17 10:45 ` mikael at gcc dot gnu.org
  2022-01-16 18:16 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mikael at gcc dot gnu.org @ 2021-11-17 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

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

--- Comment #14 from Mikael Morin <mikael at gcc dot gnu.org> ---
Fixed for 11.3 and 12.1.
Closing.

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (14 preceding siblings ...)
  2021-11-17 10:45 ` mikael at gcc dot gnu.org
@ 2022-01-16 18:16 ` cvs-commit at gcc dot gnu.org
  2022-01-16 21:20 ` cvs-commit at gcc dot gnu.org
  2022-01-16 21:20 ` cvs-commit at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-16 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Mikael Morin <mikael@gcc.gnu.org>:

https://gcc.gnu.org/g:15630e6e9eb019477d1fc5c0966b43979e18ae18

commit r12-6613-g15630e6e9eb019477d1fc5c0966b43979e18ae18
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Sun Jan 16 18:33:36 2022 +0100

    testsuite: Enrich tests with variants failing on the branch.

    Backporting the fix for pr103789 on the 11 branch revealed a lack of test
    coverage for the tests provided with that fix.  Indeed, the tests use the
KIND
    argument of the respective intrinsics only with keyword arguments.
    This adds variants with non-keyword arguments.

    The tests enriched this way fail on the branch if the fix is cherry-picked
    straightforwardly.  The fix will have to be tweaked slightly there.

            PR fortran/103789
            PR fortran/87711
            PR fortran/97896

    gcc/testsuite/ChangeLog:

            * gfortran.dg/index_5.f90: Enrich test with usages of INDEX with
            a non-keyword KIND argument.
            * gfortran.dg/len_trim.f90: Same for LEN_TRIM.
            * gfortran.dg/maskl_1.f90: Same for MASKL.
            * gfortran.dg/maskr_1.f90: Same for MASKR.
            * gfortran.dg/scan_3.f90: Same for SCAN.
            * gfortran.dg/verify_3.f90: Same for VERIFY.

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (15 preceding siblings ...)
  2022-01-16 18:16 ` cvs-commit at gcc dot gnu.org
@ 2022-01-16 21:20 ` cvs-commit at gcc dot gnu.org
  2022-01-16 21:20 ` cvs-commit at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-16 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Mikael Morin
<mikael@gcc.gnu.org>:

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

commit r11-9467-ge63ef9ae51ab67fdd280401e643eb97fddef8d93
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Sun Jan 16 16:26:15 2022 +0100

    Fortran: Fix KIND argument index for LEN_TRIM.

    The mainline code to check whether an argument has to be included in
    scalarization uses only the name of a dummy argument object to recognize a
    specific argument of an intrinsic procedure.  On the 11 branch, the dummy
    argument object is not available and the code uses a mix of check for
    argument name (for keyword arguments) and argument index (for non-keyword
ones).
    This makes backports non-straightforward in this area, as the argument
indexes
    depend on the intrinsics.

    This change fixes a bogus backport for LEN_TRIM, whose KIND argument index
    should be different from that of INDEX.

            PR fortran/87711
            PR fortran/97896

    gcc/fortran/ChangeLog:

            * trans-array.c (arg_evaluated_for_scalarization): Handle keyword
and
            non-keyword arguments separatedly.  Adapt the expected argument
index
            for KIND to each intrinsic in the non-keyword case.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/index_5.f90: Enrich test with usages of INDEX with
            a non-keyword KIND argument.
            * gfortran.dg/len_trim.f90: Same for LEN_TRIM.

    (tests cherry picked from commit 15630e6e9eb019477d1fc5c0966b43979e18ae18)

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

* [Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156
  2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
                   ` (16 preceding siblings ...)
  2022-01-16 21:20 ` cvs-commit at gcc dot gnu.org
@ 2022-01-16 21:20 ` cvs-commit at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-16 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Mikael Morin
<mikael@gcc.gnu.org>:

https://gcc.gnu.org/g:024fd4fb5a1ba742242eec84149f159518444ae3

commit r11-9469-g024fd4fb5a1ba742242eec84149f159518444ae3
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Sun Jan 16 18:33:36 2022 +0100

    testsuite: Enrich tests with variants failing on the branch.

    Backporting the fix for pr103789 on the 11 branch revealed a lack of test
    coverage for the tests provided with that fix.  Indeed, the tests use the
KIND
    argument of the respective intrinsics only with keyword arguments.
    This adds variants with non-keyword arguments.

    The tests enriched this way fail on the branch if the fix is cherry-picked
    straightforwardly.  The fix will have to be tweaked slightly there.

            PR fortran/103789
            PR fortran/87711
            PR fortran/97896

    gcc/testsuite/ChangeLog:

            * gfortran.dg/maskl_1.f90: Enrich test with usages of MASKL with
            a non-keyword KIND argument.
            * gfortran.dg/maskr_1.f90: Same for MASKR.
            * gfortran.dg/scan_3.f90: Same for SCAN.
            * gfortran.dg/verify_3.f90: Same for VERIFY.

    (cherry picked from commit 15630e6e9eb019477d1fc5c0966b43979e18ae18)

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

end of thread, other threads:[~2022-01-16 21:20 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 16:37 [Bug fortran/97896] New: [11 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156 gscfq@t-online.de
2020-11-18 17:57 ` [Bug fortran/97896] " dominiq at lps dot ens.fr
2020-11-18 21:48 ` anlauf at gcc dot gnu.org
2020-11-19  7:34 ` rguenth at gcc dot gnu.org
2020-11-19 20:28 ` anlauf at gcc dot gnu.org
2020-11-20 14:55 ` mikael at gcc dot gnu.org
2020-11-20 20:48 ` anlauf at gcc dot gnu.org
2020-11-21 18:00 ` mikael at gcc dot gnu.org
2020-11-21 18:02 ` mikael at gcc dot gnu.org
2020-11-21 18:06 ` mikael at gcc dot gnu.org
2021-04-27 11:39 ` [Bug fortran/97896] [11/12 " jakub at gcc dot gnu.org
2021-07-28  7:05 ` rguenth at gcc dot gnu.org
2021-08-07 18:38 ` mikael at gcc dot gnu.org
2021-11-12 12:11 ` cvs-commit at gcc dot gnu.org
2021-11-16 20:36 ` cvs-commit at gcc dot gnu.org
2021-11-17 10:45 ` mikael at gcc dot gnu.org
2022-01-16 18:16 ` cvs-commit at gcc dot gnu.org
2022-01-16 21:20 ` cvs-commit at gcc dot gnu.org
2022-01-16 21:20 ` 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).