[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2019-01-27 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

--- Comment #15 from Paul Thomas  ---
Author: pault
Date: Sun Jan 27 18:53:47 2019
New Revision: 268317

URL: https://gcc.gnu.org/viewcvs?rev=268317=gcc=rev
Log:
2019-01-27  Paul Thomas  

Backport from trunk
PR fortran/56386
PR fortran/58906
PR fortran/77385
PR fortran/80260
PR fortran/82077
* resolve.c (resolve_variable): Fix up expressions with array
associate names, where the parser did not detect that this is
array and there was no array part_ref in the expression.
* trans-expr.c (gfc_find_and_cut_at_last_class_ref): base_expr
should be a copy of e and not the initialization expr.

2019-01-27  Paul Thomas  

Backport from trunk
PR fortran/56386
PR fortran/58906
PR fortran/77385
* gfortran.dg/associate_44.f90 : New test.

PR fortran/80260
* gfortran.dg/select_type_45.f90 : New test.

PR fortran/82077
* gfortran.dg/select_type_46.f90 : New test.


Added:
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/associate_44.f90
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/select_type_45.f90
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/select_type_46.f90
Modified:
branches/gcc-7-branch/gcc/fortran/ChangeLog
branches/gcc-7-branch/gcc/fortran/resolve.c
branches/gcc-7-branch/gcc/fortran/trans-expr.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2019-01-27 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

--- Comment #14 from Paul Thomas  ---
Author: pault
Date: Sun Jan 27 18:02:17 2019
New Revision: 268313

URL: https://gcc.gnu.org/viewcvs?rev=268313=gcc=rev
Log:
2019-01-27  Paul Thomas  

Backport from trunk
PR fortran/56386
PR fortran/58906
PR fortran/77385
PR fortran/80260
PR fortran/82077
* resolve.c (resolve_variable): Fix up expressions with array
associate names, where the parser did not detect that this is
array and there was no array part_ref in the expression.
* trans-expr.c (gfc_find_and_cut_at_last_class_ref): base_expr
should be a copy of e and not the initialization expr.

2019-01-27  Paul Thomas  

Backport from trunk
PR fortran/56386
PR fortran/58906
PR fortran/77385
* gfortran.dg/associate_44.f90 : New test.

PR fortran/80260
* gfortran.dg/select_type_45.f90 : New test.

PR fortran/82077
* gfortran.dg/select_type_46.f90 : New test.


Added:
branches/gcc-8-branch/gcc/testsuite/gfortran.dg/associate_44.f90
branches/gcc-8-branch/gcc/testsuite/gfortran.dg/select_type_45.f90
branches/gcc-8-branch/gcc/testsuite/gfortran.dg/select_type_46.f90
Modified:
branches/gcc-8-branch/gcc/fortran/ChangeLog
branches/gcc-8-branch/gcc/fortran/resolve.c
branches/gcc-8-branch/gcc/fortran/trans-expr.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2019-01-13 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from Paul Thomas  ---
Fixed on trunk.

Thanks for the report.

Paul

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2018-11-19 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #12 from Martin Liška  ---
Can the bug be marked as resolved?

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2018-10-17 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

--- Comment #11 from Tobias Burnus  ---
(In reply to Jürgen Reuter from comment #10)
> Paul, I think this "bugfix" introduced an ICE in our code. I will open a new
> PR.

Seemingly, it's PR 87632

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2018-10-17 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

--- Comment #10 from Jürgen Reuter  ---
Paul, I think this "bugfix" introduced an ICE in our code. I will open a new
PR.

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2018-10-17 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

--- Comment #9 from Paul Thomas  ---
Author: pault
Date: Wed Oct 17 07:16:16 2018
New Revision: 265232

URL: https://gcc.gnu.org/viewcvs?rev=265232=gcc=rev
Log:
2018-10-17  Paul Thomas  

PR fortran/56386
PR fortran/58906
PR fortran/77385
PR fortran/80260
PR fortran/82077
* resolve.c (resolve_variable): Fix up expressions with array
associate names, where the parser did not detect that this is
array and there was no array part_ref in the expression.

2018-10-17  Paul Thomas  

PR fortran/56386
PR fortran/58906
PR fortran/77385
* gfortran.dg/associate_44.f90 : New test.

PR fortran/80260
* gfortran.dg/select_type_45.f90 : New test.

PR fortran/82077
* gfortran.dg/select_type_46.f90 : New test.


Added:
trunk/gcc/testsuite/gfortran.dg/associate_44.f90
trunk/gcc/testsuite/gfortran.dg/select_type_45.f90
trunk/gcc/testsuite/gfortran.dg/select_type_46.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2018-10-14 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |pault at gcc dot gnu.org

--- Comment #8 from Paul Thomas  ---
Created attachment 44838
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44838=edit
A patch for the original problem

The attached does the job on the original problem. I will wait until the fix
for PR87566 is committed before submitting this one.

With respect to the problem in comment #2: This one is really tough because the
type of the function f() has not been determined since it is contained. Either
we have to change the parsing sequence such that a CONTAINS statement is
searched for and the the contained procedures parsed or we look for a derived
type with the component name and set the symbol type accordingly. Even if it is
a bit desperate, the latter is certainly doable. 

Paul

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2018-10-01 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #2)
> Related test case by the bug reporterm
> https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/
> UvBX1kfuFqs
> 
> 
> This time rejecting the code instead of ICEing:
> 
>print *,x%i
>  1
> Error: Symbol 'x' at (1) has no IMPLICIT type

One can get past this error via:

diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 6f45afa86ea..311e3aafc85 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2111,7 +2111,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag,
bool sub_flag,
  sym->ts = tgt_expr->ts;
}

-  if (sym->ts.type == BT_UNKNOWN)
+  if (sym->ts.type == BT_UNKNOWN && !sym->assoc)
{
  gfc_error ("Symbol %qs at %C has no IMPLICIT type", sym->name);
  return MATCH_ERROR;

but then one runs into:

7 | print *,x%i
  |  1
Error: Syntax error in PRINT statement at (1)



> program p
>   type t
> integer :: i = 0
>   end type
> 
>   associate (x=>f())
> print *,x%i
>   end associate
> 
>   contains
> function f()
>   type(t) f
>   f%i = 5
> end function
> end program


The general problem with this case is that we can not infer the type of 'x'
before parsing the print statement. Right now I can not see how to get around
this issue.

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2017-06-07 Thread vladimir.fuka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

Vladimir Fuka  changed:

   What|Removed |Added

Version|4.8.0   |7.1.1

--- Comment #6 from Vladimir Fuka  ---
Probably not a duplicate of pr64674 because this bug is still present in 7.1.1.

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2017-06-07 Thread vladimir.fuka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

--- Comment #5 from Vladimir Fuka  ---
Probably not a duplicate of pr64674 because this bug is still present in 7.1.1.

[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2015-02-09 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56386

--- Comment #4 from Dominique d'Humieres dominiq at lps dot ens.fr ---
pr64674 is likely a duplicate of this pr.


[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2013-04-16 Thread burnus at gcc dot gnu.org


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



Tobias Burnus burnus at gcc dot gnu.org changed:



   What|Removed |Added



   Keywords||rejects-valid

 Status|UNCONFIRMED |NEW

   Last reconfirmed||2013-04-16

 CC||burnus at gcc dot gnu.org

 Ever Confirmed|0   |1



--- Comment #2 from Tobias Burnus burnus at gcc dot gnu.org 2013-04-16 
17:17:52 UTC ---

Related test case by the bug reporterm

https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/UvBX1kfuFqs





This time rejecting the code instead of ICEing:



   print *,x%i

 1

Error: Symbol 'x' at (1) has no IMPLICIT type







program p

  type t

integer :: i = 0

  end type



  associate (x=f())

print *,x%i

  end associate



  contains

function f()

  type(t) f

  f%i = 5

end function

end program


[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2013-04-16 Thread vladimir.fuka at gmail dot com


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



--- Comment #3 from Vladimir Fuka vladimir.fuka at gmail dot com 2013-04-16 
17:40:04 UTC ---

Thanks, I didn't realize they might be connected. I even forgotten I have

this bug opened when I asked.



  Vladimir

Dne 16.4.2013 19:17 burnus at gcc dot gnu.org gcc-bugzi...@gcc.gnu.org

napsal(a):





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



 Tobias Burnus burnus at gcc dot gnu.org changed:



What|Removed |Added



 

Keywords||rejects-valid

  Status|UNCONFIRMED |NEW

Last reconfirmed||2013-04-16

  CC||burnus at gcc dot gnu.org

  Ever Confirmed|0   |1



 --- Comment #2 from Tobias Burnus burnus at gcc dot gnu.org 2013-04-16

 17:17:52 UTC ---

 Related test case by the bug reporterm



 https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/UvBX1kfuFqs





 This time rejecting the code instead of ICEing:



print *,x%i

  1

 Error: Symbol 'x' at (1) has no IMPLICIT type







 program p

   type t

 integer :: i = 0

   end type



   associate (x=f())

 print *,x%i

   end associate



   contains

 function f()

   type(t) f

   f%i = 5

 end function

 end program



 --

 Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email

 --- You are receiving this mail because: ---

 You are on the CC list for the bug.

 You reported the bug.




[Bug fortran/56386] [F03] ICE with ASSOCIATE construct and an derived type array component

2013-02-18 Thread janus at gcc dot gnu.org


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



janus at gcc dot gnu.org changed:



   What|Removed |Added



   Keywords||ice-on-valid-code

 CC||janus at gcc dot gnu.org

Summary|ICE with ASSOCIATE  |[F03] ICE with ASSOCIATE

   |construct and an derived|construct and an derived

   |type array component|type array component



--- Comment #1 from janus at gcc dot gnu.org 2013-02-18 22:46:23 UTC ---

Confirmed. ICEs with all of 4.6, 4.7 and trunk.