public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
@ 2009-09-27 18:04 ` pinskia at gcc dot gnu dot org
  2009-10-09 13:52 ` ros at rzg dot mpg dot de
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-09-27 18:04 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc-bugs at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
  2009-09-27 18:04 ` [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function pinskia at gcc dot gnu dot org
@ 2009-10-09 13:52 ` ros at rzg dot mpg dot de
  2009-10-09 22:00 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: ros at rzg dot mpg dot de @ 2009-10-09 13:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ros at rzg dot mpg dot de  2009-10-09 13:51 -------
(In reply to comment #5)
I have further reducd the test code to:
idx=sum(maxloc(index(pfd%n,pfmt)))-1
    Program GF_BUG
!
    type psfd
      character              :: n*3
    end type psfd
    character                :: pfmt*3=''
    type(psfd), parameter    :: pfd(1)=[psfd('')]
!
    idx=sum(maxloc(index(pfd%n,pfmt)))-1
    end

For the error message to appear it is essential
- that the variable 'psfd' is of derived type,
- that the type declaration statement for 'pdf' has the attribute PARAMETER
- and the statement 'idx=sum(maxloc(index(pfd%n,pfmt)))-1' exists in this form.
Splitting up this statement into 
  'idx=sum(maxloc(index(pfd%n,pfmt)))'   and
  'idx=idx-1'
makes the error message disappear!

I hope, this helps for fixing the bug.


-- 

ros at rzg dot mpg dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ros at rzg dot mpg dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
  2009-09-27 18:04 ` [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function pinskia at gcc dot gnu dot org
  2009-10-09 13:52 ` ros at rzg dot mpg dot de
@ 2009-10-09 22:00 ` burnus at gcc dot gnu dot org
  2009-10-12  9:33 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-10-09 22:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2009-10-09 21:59 -------
(In reply to comment #6)
>     idx=sum(maxloc(index(pfd%n,pfmt)))-1

The problem is that "pfd%n" is simplified to an array constructor [''] of type
expr->value.constructor->ts == CHARACTER(kind=1,len=3).

But this typespec is not propagated to expr->ts while doing the simplification
and thus expr->ts is BT_DERIVED and expr->ts.kind == 0 - which causes the
assert to trigger. If one applies the hack below, one continues a bit further
but ends up having an ICE in gfc_conv_string_parameter's
  gcc_assert (POINTER_TYPE_P (TREE_TYPE (se->expr)))

The proper solutions is presumably to find the spot in array.c or expr.c where
the derived-type constructor is simplified into an character constructor; there
at least updating the expr->ts is missing.


Not working hack (ICE in gfc_conv_string_parameter):

--- trans-intrinsic.c   (Revision 152601)
+++ trans-intrinsic.c   (Arbeitskopie)
@@ -5340,2 +5340,5 @@ gfc_conv_intrinsic_function (gfc_se * se
     case GFC_ISYM_INDEX:
+      if (expr->value.function.actual->expr->expr_type == EXPR_ARRAY)
+       expr->value.function.actual->expr->ts
+         = expr->value.function.actual->expr->value.constructor->expr->ts;
       kind = expr->value.function.actual->expr->ts.kind;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2009-10-09 22:00 ` burnus at gcc dot gnu dot org
@ 2009-10-12  9:33 ` burnus at gcc dot gnu dot org
  2010-01-14 13:45 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-10-12  9:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from burnus at gcc dot gnu dot org  2009-10-12 09:33 -------
> I have further reducd the test code to:
> idx=sum(maxloc(index(pfd%n,pfmt)))-1

Even shorter:
    idx = index(pfd%n,pfmt) - 1
(Or any other one/two operator expression except of function calls; idx needs
to be a rank-1 array.)

Another issue (or the same?) is that pfd%n is seen as EXPR_VARIABLE and not as
EXPR_CONSTANT. The following vaguely related gives a segfault:

type t
  integer :: i
end type t
type(t), parameter :: a(1) = t(4)
real(a(1)%i) :: b
end

==27247== Invalid read of size 8
==27247==    at 0x4C3CDD: simplify_const_ref (expr.c:1168)

simplify_const_ref (p=<value optimized out>) at
/home/tob/projects/gcc/gcc/fortran/expr.c:1559
1559              remove_subobject_ref (p, cons);

Seemingly, the segfault is in remove_subobject_ref, called by
simplify_const_ref (and "cons" being not a valid pointer).
        case REF_COMPONENT:
          cons = find_component_ref (p->value.constructor, p->ref);
          remove_subobject_ref (p, cons);


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2009-10-12  9:33 ` burnus at gcc dot gnu dot org
@ 2010-01-14 13:45 ` jvdelisle at gcc dot gnu dot org
  2010-01-23 14:03 ` jvdelisle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-01-14 13:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2010-01-14 13:45 -------
The test case in comment #8 is a separate issue.  The constructor pointer is
coming out of find_component_ref as invalid.  I am still working on it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2010-01-14 13:45 ` jvdelisle at gcc dot gnu dot org
@ 2010-01-23 14:03 ` jvdelisle at gcc dot gnu dot org
  2010-01-24 17:00 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-01-23 14:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jvdelisle at gcc dot gnu dot org  2010-01-23 14:03 -------
As Paul would say, I am flummoxed. In remove_subobject_ref at line expr.c:1159 
 e->ref = p->ref->next;  p->ref is NULL, resulting in the segfault.  I have
been unable to conjure a solution.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2010-01-23 14:03 ` jvdelisle at gcc dot gnu dot org
@ 2010-01-24 17:00 ` pault at gcc dot gnu dot org
  2010-01-25  7:53 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-24 17:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pault at gcc dot gnu dot org  2010-01-24 17:00 -------
Subject: Bug 41044

Author: pault
Date: Sun Jan 24 16:59:51 2010
New Revision: 156197

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156197
Log:
2010-01-24  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/41044
        PR fortran/41167
        * expr.c (remove_subobject_ref): If the constructor is NULL use
        the expression as the source.
        (simplify_const_ref): Change the type of expression if
        there are component references.  Allow for substring to be at
        the end of an arbitrarily long chain of references.  If an
        element is found that is not in an EXPR_ARRAY, assume that this
        is scalar initialization of array. Call remove_subobject_ref in
        this case with NULL second argument.

2010-01-24  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/41044
        * gfortran.dg/parameter_array_ref_2.f90 : New test.

        PR fortran/41167
        * gfortran.dg/char_array_arg_1.f90 : New test.

        * gfortran.dg/pr25923.f90 : Remove XFAIL.

Added:
    trunk/gcc/testsuite/gfortran.dg/char_array_arg_1.f90
    trunk/gcc/testsuite/gfortran.dg/parameter_array_ref_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/pr25923.f90


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2010-01-24 17:00 ` pault at gcc dot gnu dot org
@ 2010-01-25  7:53 ` pault at gcc dot gnu dot org
  2010-01-30 21:13 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-25  7:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pault at gcc dot gnu dot org  2010-01-25 07:53 -------
I just posted the patch for this, so could take it with some advantage.  Will
correct 4.4 in a few days.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-01-16 16:15:29         |2010-01-25 07:53:09
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2010-01-25  7:53 ` pault at gcc dot gnu dot org
@ 2010-01-30 21:13 ` pault at gcc dot gnu dot org
  2010-01-30 21:14 ` pault at gcc dot gnu dot org
  2010-02-07  3:39 ` hjl dot tools at gmail dot com
  10 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-30 21:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from pault at gcc dot gnu dot org  2010-01-30 21:13 -------
Subject: Bug 41044

Author: pault
Date: Sat Jan 30 21:12:59 2010
New Revision: 156389

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156389
Log:
2010-01-30  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/41044
        PR fortran/41167
        * expr.c (remove_subobject_ref): If the constructor is NULL use
        the expression as the source.
        (simplify_const_ref): Change the type of expression if
        there are component references.  Allow for substring to be at
        the end of an arbitrarily long chain of references.  If an
        element is found that is not in an EXPR_ARRAY, assume that this
        is scalar initialization of array. Call remove_subobject_ref in
        this case with NULL second argument.

2010-01-30  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/41044
        * gfortran.dg/parameter_array_ref_2.f90 : New test.

        PR fortran/41167
        * gfortran.dg/char_array_arg_1.f90 : New test.

        * gfortran.dg/pr25923.f90 : Remove XFAIL.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/char_array_arg_1.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/parameter_array_ref_2.f90
Modified:
    branches/gcc-4_4-branch/gcc/fortran/ChangeLog
    branches/gcc-4_4-branch/gcc/fortran/expr.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2010-01-30 21:13 ` pault at gcc dot gnu dot org
@ 2010-01-30 21:14 ` pault at gcc dot gnu dot org
  2010-02-07  3:39 ` hjl dot tools at gmail dot com
  10 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-30 21:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from pault at gcc dot gnu dot org  2010-01-30 21:14 -------
Fixed on trunk and 4.4.

Thanks for the report

Paul


-- 

pault at gcc dot gnu dot org changed:

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

* [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function
       [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2010-01-30 21:14 ` pault at gcc dot gnu dot org
@ 2010-02-07  3:39 ` hjl dot tools at gmail dot com
  10 siblings, 0 replies; 11+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-07  3:39 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.4
            Version|unknown                     |4.3.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044


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

end of thread, other threads:[~2010-02-07  3:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-41044-18049@http.gcc.gnu.org/bugzilla/>
2009-09-27 18:04 ` [Bug fortran/41044] internal compiler error: in gfc_conv_intrinsic_function pinskia at gcc dot gnu dot org
2009-10-09 13:52 ` ros at rzg dot mpg dot de
2009-10-09 22:00 ` burnus at gcc dot gnu dot org
2009-10-12  9:33 ` burnus at gcc dot gnu dot org
2010-01-14 13:45 ` jvdelisle at gcc dot gnu dot org
2010-01-23 14:03 ` jvdelisle at gcc dot gnu dot org
2010-01-24 17:00 ` pault at gcc dot gnu dot org
2010-01-25  7:53 ` pault at gcc dot gnu dot org
2010-01-30 21:13 ` pault at gcc dot gnu dot org
2010-01-30 21:14 ` pault at gcc dot gnu dot org
2010-02-07  3:39 ` hjl dot tools at gmail dot com

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).