[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-10 Thread mikael at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

Mikael Morin mikael at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED
   Assignee|vehre at gcc dot gnu.org   |mikael at gcc dot 
gnu.org

--- Comment #34 from Mikael Morin mikael at gcc dot gnu.org ---
(In reply to Jürgen Reuter from comment #33)
 Great, with that comment everything in our code works again, thanks, Mikael.
 So, what about Dominique's comment with the fix for PR 58586 and that this
 breaks our code again. Shall I (try to) investigate this?

Yes, if you have time.
Reduced tests are preferred. ;-)
Anyway, further comments should go to PR58586, I'm closing this PR.
Thanks to the reporter and the testers.

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-09 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #33 from Jürgen Reuter juergen.reuter at desy dot de ---
Great, with that comment everything in our code works again, thanks, Mikael.
So, what about Dominique's comment with the fix for PR 58586 and that this
breaks our code again. Shall I (try to) investigate this?

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-09 Thread mikael at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #32 from Mikael Morin mikael at gcc dot gnu.org ---
Author: mikael
Date: Sat May  9 13:36:14 2015
New Revision: 222968

URL: https://gcc.gnu.org/viewcvs?rev=222968root=gccview=rev
Log:
Fix fortran/65894 elemental procedures wrong-code

gcc/fortran/
2015-05-09  Mikael Morin  mik...@gcc.gnu.org

PR fortran/65894
* trans-array.h (gfc_scalar_elemental_arg_saved_as_reference):
New prototype.
* trans-array.c (gfc_scalar_elemental_arg_saved_as_reference):
New function.
(gfc_add_loop_ss_code): Use gfc_scalar_elemental_arg_saved_as_reference
as conditional.
(gfc_walk_elemental_function_args): Set the dummy_arg field.
* trans.h (gfc_ss_info): New subfield dummy_arg.
* trans-expr.c (gfc_conv_procedure_call): Revert the change
of revision 222361.
(gfc_conv_expr): Use gfc_scalar_elemental_arg_saved_as_reference
as conditional.

gcc/testsuite/
2015-05-09  Andre Vehreschild  ve...@gmx.de

PR fortran/65894
* gfortran.dg/elemental_subroutine_11.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/elemental_subroutine_11.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-array.h
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans.h
trunk/gcc/testsuite/ChangeLog


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-08 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #30 from Dominique d'Humieres dominiq at lps dot ens.fr ---
While the Mikael's patch allows the test suite to run as expected, adding the
patch for pr58586 breaks it again.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-08 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #31 from Jürgen Reuter juergen.reuter at desy dot de ---
Shall I do any checks now? It seems that Mikael's patch is doing the right
thing, and you found the one that breaks it again.

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-08 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #29 from Dominique d'Humieres dominiq at lps dot ens.fr ---
 Dominique, comment #27 looks perfect. That would be great for us
 with the upcoming revision of gfortran 6.0.0.

First, obviously Andre's test gfortran.dg/elemental_subroutine_11.f90 does not
cover all the possible issues. How difficult would it be to infer what is
missing from the list of failures?

Second, I have done some tests with the addition of pending patches:

(1) Mikael's patch + combined patch for pr6183165792 + patches for pr64674 and
pr65548,

(2) Mikael's patch + patches for pr44672, pr58586, pr64674 and pr65548.

While I get the results of comment 27 with (1), I get the following result with
(2)


Testsuite summary for WHIZARD 2.2.6

# TOTAL: 280
# PASS:  70
# SKIP:  28
# XFAIL: 1
# FAIL:  179
# XPASS: 2
# ERROR: 0


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

vehre at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|WAITING

--- Comment #16 from vehre at gcc dot gnu.org ---
Patch submitted at:

https://gcc.gnu.org/ml/fortran/2015-05/msg00025.html

This patch also fixes the issue in comment #15.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #17 from Jürgen Reuter juergen.reuter at desy dot de ---
(In reply to vehre from comment #16)
 Patch submitted at:
 
 https://gcc.gnu.org/ml/fortran/2015-05/msg00025.html
 
 This patch also fixes the issue in comment #15.

First of all, thanks for the efforts. Does this also fix the ICE in #11?

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #26 from Dominique d'Humieres dominiq at lps dot ens.fr ---
With Andre's patch on top of a clean tree at r222878, I get


Testsuite summary for WHIZARD 2.2.6

# TOTAL: 280
# PASS:  107
# SKIP:  28
# XFAIL: 1
# FAIL:  142
# XPASS: 2
# ERROR: 0

After 2 hours I lost patience and killed all the tests requiring more than
~10Gb or more than 5 minutes (~30 of them, on a Corei7 with 16Gb of RAM). I
have no idea if such huge memory usage or long time are expected.

I'll test Mikael's patch at
https://gcc.gnu.org/ml/fortran/2015-05/msg00027.html.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #20 from Dominique d'Humieres dominiq at lps dot ens.fr ---
 Patch submitted at:

 https://gcc.gnu.org/ml/fortran/2015-05/msg00025.html

 This patch also fixes the issue in comment #15.

With the submitted patch I have been able to build the whizard package. The
summary for 'make check' is


Testsuite summary for WHIZARD 2.2.6

# TOTAL: 280
# PASS:  60
# SKIP:  167
# XFAIL: 0
# FAIL:  53
# XPASS: 0
# ERROR: 0

Many failures are of the kind

FAIL: models.run


Running script ./models.run
| Writing log to 'models.log'
| 
| Running self-test: models
| 
Running test: models_1 ... success.
Running test: models_2| Reading model file
'/Users/dominiq/Downloads/whizard-2.2.6/share/models/Test.mdl'
whizard(55852,0x7fff72381300) malloc: *** error for object 0x7fff54a0a5e8:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Is this expected?


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #23 from Jürgen Reuter juergen.reuter at desy dot de ---
That would be cool. If you have OCaml installed (version 3.12 or newer, and as
a French you couldn't complain about that^^) you could run a lot more from the
test suite.

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #24 from Dominique d'Humieres dominiq at lps dot ens.fr ---
 That would be cool. If you have OCaml installed (version 3.12 or newer,
 and as a French you couldn't complain about that^^) you could run a lot more
 from the test suite.

I have

The OCaml toplevel, version 4.02.1

What should I do to use it?


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #18 from vehre at gcc dot gnu.org ---
Yes, it also fixes the ICE in #11. The code example is part of the regression
test added. I hope you don't mind. Most parts of the regression test added base
on your reported issues.

Additionally the whizard code mentioned in #1 is compiling and running again.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #21 from Jürgen Reuter juergen.reuter at desy dot de ---
No this is not expected. There seems to be another problem inside gfortran
6.0.0 trunk. I cannot test things before tomorrow/weekend.

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #22 from Dominique d'Humieres dominiq at lps dot ens.fr ---
 No this is not expected. There seems to be another problem inside
 gfortran 6.0.0 trunk. I cannot test things before tomorrow/weekend.

I will try with a tree with less patches.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #28 from Jürgen Reuter juergen.reuter at desy dot de ---
Dominique, comment #27 looks perfect. That would be great for us with the
upcoming revision of gfortran 6.0.0.

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

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

   What|Removed |Added

 CC||mikael at gcc dot gnu.org

--- Comment #27 from Dominique d'Humieres dominiq at lps dot ens.fr ---
With Mikael's patch I get


Testsuite summary for WHIZARD 2.2.6

# TOTAL: 280
# PASS:  249
# SKIP:  28
# XFAIL: 3
# FAIL:  0
# XPASS: 0
# ERROR: 0

in less than 12 minutes.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #19 from Jürgen Reuter juergen.reuter at desy dot de ---
Of course, we are fine (or even happy) if you take our code examples for your
regression tests.

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-07 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #25 from Jürgen Reuter juergen.reuter at desy dot de ---
Just do the configuration without the --disable-ocaml flag (the default is 
that OCaml is enabled). The configure should show then something like that
(Ocamlweb is not needed):
configure: --
configure: --- Objective Caml checks ---
configure: 
checking for ocaml... /usr/local/bin/ocaml
checking for ocamlc... /usr/local/bin/ocamlc
OCaml version is 4.02.1
OCaml library path is /usr/local/lib/ocaml
checking for ocamlopt... /usr/local/bin/ocamlopt
checking for ocamlc.opt... /usr/local/bin/ocamlc.opt
checking for ocamlopt.opt... /usr/local/bin/ocamlopt.opt
checking for ocamldep... /usr/local/bin/ocamldep
checking for ocamlmktop... /usr/local/bin/ocamlmktop
checking for ocamlmklib... /usr/local/bin/ocamlmklib
checking for ocamldoc... /usr/local/bin/ocamldoc
checking for ocamlbuild... /usr/local/bin/ocamlbuild
checking for OCaml version 312000... ok
checking for ocamllex... /usr/local/bin/ocamllex
checking for ocamllex.opt... /usr/local/bin/ocamllex.opt
checking for ocamlyacc... /usr/local/bin/ocamlyacc
checking for ocamlcp... /usr/local/bin/ocamlcp
checking for ocamlweb... /usr/local/bin/ocamlweb
This is ocamlweb version 1.38, compiled on Sun Nov 9 16:08:42 CET 2014
Copyright (c) 1999-2000 Jean-Christophe Filli?tre and Claude March?
This is free software with ABSOLUTELY NO WARRANTY (use option -warranty)
This is ocamlweb version 1.38, compiled on Sun Nov 9 16:08:42 CET 2014
Copyright (c) 1999-2000 Jean-Christophe Filli?tre and Claude March?
This is free software with ABSOLUTELY NO WARRANTY (use option -warranty)
OCamlweb version is : ok
checking for OCaml/GTK+ toolkit directory... not found
checking for ocamldot... no
checking for ocamldefun... no

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-06 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #15 from Dominique d'Humieres dominiq at lps dot ens.fr ---
 Created attachment 35464 [details]
 Follow-up patch fixing latest regression.

 With this patch all code samples and the code in the tar-archive compile
 and execute well. This patch will need most of my previous patches. The total
 set of all of my patches is available on the gitmirror in the branch
 vehre/head_cosmo

With this patch I still get the ICE when compiling the file evaluators.f90.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-05 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

vehre at gcc dot gnu.org changed:

   What|Removed |Added

  Attachment #35407|0   |1
is obsolete||

--- Comment #12 from vehre at gcc dot gnu.org ---
Created attachment 35464
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35464action=edit
Follow-up patch fixing latest regression.

With this patch all code samples and the code in the tar-archive compile and
execute well. This patch will need most of my previous patches. The total set
of all of my patches is available on the gitmirror in the branch
vehre/head_cosmo


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-05 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #13 from Jürgen Reuter juergen.reuter at desy dot de ---
I will give it a try as soon as possible. Any idea how long propagation into
the trunk might last?

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-05-05 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #14 from vehre at gcc dot gnu.org ---
That solely depends on the availability of reviews. At the moment getting a
review is quite difficult.

Btw, when you can use docker, then there is docker image available at:

https://registry.hub.docker.com/u/cmbant/docker-gcc-build/

But this also needs to compile first. Check the Build Details tab, whether it
succeeded. I do not maintain this docker file, just for info.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-28 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #10 from Jürgen Reuter juergen.reuter at desy dot de ---
(In reply to Dominique d'Humieres from comment #9)
  With the attached patch your small test case and the test suite runs
  w/o segfault now. Furthermore does gcc6 bootstrap and regtest ok
  with the patch.
 
 Confirmed. The bigger test in comment 2 runs without segfault also. However
 I get an ICE when compiling the full package at
 http://whizard.hepforge.org/versions/unofficial/whizard-2.2.6_alpha-20150426.
 tar.gz
 
 libtool: compile:  gfc -I../basics -I../utilities -I../testing -I../system
 -I../combinatorics -I../expr_base -I../physics -g -O2 -c evaluators.f90 
 -fno-common -o .libs/evaluators.o
 evaluators.f90:897:0:
 
   .or. qn_mask_rest
  1
 internal compiler error: in gfc_trans_assignment_1, at
 fortran/trans-expr.c:9203


I confirm this ICE with the patch and will provide a smaller test case soon.

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-28 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #11 from Jürgen Reuter juergen.reuter at desy dot de ---
Here is the small test case for the ICE with the patch provided Andre
Vehreschild:

gfortran -c evaluators.f90
evaluators.f90:40:0:

 .or. qn_mask_rest
 1
internal compiler error: in gfc_trans_assignment_1, at
fortran/trans-expr.c:9187

evaluators.f90:40:0: internal compiler error: Abort trap: 6
gfortran: internal compiler error: Abort trap: 6 (program f951)

This is the code:

module evaluators
  implicit none
  private
  type :: quantum_numbers_mask_t
   contains
 generic :: operator(.or.) = quantum_numbers_mask_or
 procedure, private :: quantum_numbers_mask_or
  end type quantum_numbers_mask_t

  type :: index_map_t
 integer, dimension(:), allocatable :: entry
  end type index_map_t
  type :: prt_mask_t
 logical, dimension(:), allocatable :: entry
  end type prt_mask_t
  type :: qn_mask_array_t
 type(quantum_numbers_mask_t), dimension(:), allocatable :: mask
  end type qn_mask_array_t

contains
  elemental function quantum_numbers_mask_or (mask1, mask2) result (mask)
type(quantum_numbers_mask_t) :: mask
class(quantum_numbers_mask_t), intent(in) :: mask1, mask2
  end function quantum_numbers_mask_or

  subroutine make_product_interaction 
  (prt_is_connected, qn_mask_in, qn_mask_rest)
type(prt_mask_t), dimension(2), intent(in) :: prt_is_connected
type(qn_mask_array_t), dimension(2), intent(in) :: qn_mask_in
type(quantum_numbers_mask_t), intent(in) :: qn_mask_rest
type(index_map_t), dimension(2) :: prt_index_in
integer :: i
type(quantum_numbers_mask_t), dimension(:), allocatable :: qn_mask
allocate (qn_mask (2))
do i = 1, 2
   qn_mask(prt_index_in(i)%entry) = 
pack (qn_mask_in(i)%mask, prt_is_connected(i)%entry) 
.or. qn_mask_rest
end do
  end subroutine make_product_interaction
end module evaluators

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-28 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #9 from Dominique d'Humieres dominiq at lps dot ens.fr ---
 With the attached patch your small test case and the test suite runs
 w/o segfault now. Furthermore does gcc6 bootstrap and regtest ok
 with the patch.

Confirmed. The bigger test in comment 2 runs without segfault also. However I
get an ICE when compiling the full package at
http://whizard.hepforge.org/versions/unofficial/whizard-2.2.6_alpha-20150426.tar.gz

libtool: compile:  gfc -I../basics -I../utilities -I../testing -I../system
-I../combinatorics -I../expr_base -I../physics -g -O2 -c evaluators.f90 
-fno-common -o .libs/evaluators.o
evaluators.f90:897:0:

  .or. qn_mask_rest
 1
internal compiler error: in gfc_trans_assignment_1, at
fortran/trans-expr.c:9203


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-27 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #7 from Jürgen Reuter juergen.reuter at desy dot de ---
Created attachment 35404
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35404action=edit
Code that triggers the segmentation fault.

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-27 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

vehre at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #4 from vehre at gcc dot gnu.org ---
Looks like this is my patch's fault. I will investigate and report back.

Because this is on trunk and seems to not make gfortran completely unusable, I
would like not to withdraw the commit, but to fix the issue in a later patch.


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|--- |6.0
Summary|severe regression in|[6 Regression] severe
   |gfortran 6.0.0  |regression in gfortran
   ||6.0.0


[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-27 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #5 from Jürgen Reuter juergen.reuter at desy dot de ---
Here is a reduced test case (where iso_varying_string.f90 is the standard
module with 1 or 2 modifications by us). As this is at the core of our program,
we do rely on a timely fix in order to further use and test gfortran 6.0.



module model_data
  use iso_varying_string, string_t = varying_string

  implicit none
  private

  public :: field_data_t
  public :: model_data_t

  type :: field_data_t
 private
 integer :: pdg = 0
 type(string_t), dimension(:), allocatable :: name
   contains
 procedure :: init = field_data_init
 procedure :: get_pdg = field_data_get_pdg
  end type field_data_t

  type :: model_data_t
 private
 type(string_t) :: name
 type(field_data_t), dimension(:), allocatable :: field
   contains
 generic :: init = model_data_init
 procedure, private :: model_data_init
 generic :: get_pdg = 
  model_data_get_field_pdg_index
 procedure, private :: model_data_get_field_pdg_index
 generic :: get_field_ptr = 
  model_data_get_field_ptr_pdg
 procedure, private :: model_data_get_field_ptr_pdg
 procedure :: get_field_ptr_by_index = model_data_get_field_ptr_index
 procedure :: init_sm_test = model_data_init_sm_test
  end type model_data_t


contains

  subroutine field_data_init (prt, pdg)
class(field_data_t), intent(out) :: prt
integer, intent(in) :: pdg
prt%pdg = pdg
  end subroutine field_data_init

  elemental function field_data_get_pdg (prt) result (pdg)
integer :: pdg
class(field_data_t), intent(in) :: prt
pdg = prt%pdg
  end function field_data_get_pdg

  subroutine model_data_init (model, name, 
   n_field)
class(model_data_t), intent(out) :: model
type(string_t), intent(in) :: name
integer, intent(in) :: n_field
model%name = name
allocate (model%field (n_field))
  end subroutine model_data_init

  function model_data_get_field_pdg_index (model, i) result (pdg)
class(model_data_t), intent(in) :: model
integer, intent(in) :: i
integer :: pdg
pdg = model%field(i)%get_pdg ()
  end function model_data_get_field_pdg_index

  function model_data_get_field_ptr_pdg (model, pdg, check) result (ptr)
class(model_data_t), intent(in), target :: model
integer, intent(in) :: pdg
logical, intent(in), optional :: check
type(field_data_t), pointer :: ptr
integer :: i, pdg_abs
if (pdg == 0) then
   ptr = null ()
   return
end if
pdg_abs = abs (pdg)
do i = 1, size (model%field)
   if (model%field(i)%get_pdg () == pdg_abs) then
  ptr = model%field(i)
  return
   end if
end do
ptr = null ()
  end function model_data_get_field_ptr_pdg

  function model_data_get_field_ptr_index (model, i) result (ptr)
class(model_data_t), intent(in), target :: model
integer, intent(in) :: i
type(field_data_t), pointer :: ptr
ptr = model%field(i)
  end function model_data_get_field_ptr_index

  subroutine model_data_init_sm_test (model)
class(model_data_t), intent(out) :: model
type(field_data_t), pointer :: field
integer, parameter :: n_field = 19
call model%init (var_str (SM_test), 
 n_field)
field = model%get_field_ptr_by_index (1)
call field%init (1)
  end subroutine model_data_init_sm_test

end module model_data


module flavors
  use model_data

  implicit none
  private

  public :: flavor_t

  type :: flavor_t
 private
 integer :: f = 0
 type(field_data_t), pointer :: field_data = null ()
   contains
 generic :: init = 
  flavor_init0_model
 procedure, private :: flavor_init0_model
  end type flavor_t

contains

  impure elemental subroutine flavor_init0_model (flv, f, model)
class(flavor_t), intent(inout) :: flv
integer, intent(in) :: f
class(model_data_t), intent(in), target :: model
flv%f = f
flv%field_data = model%get_field_ptr (f, check=.true.)
  end subroutine flavor_init0_model
end module flavors

module beams
  use model_data
  use flavors
  implicit none
  private
  public :: beam_1
contains
  subroutine beam_1 (u)
integer, intent(in) :: u
type(flavor_t), dimension(2) :: flv
real, dimension(2) :: pol_f
type(model_data_t), target :: model
call model%init_sm_test ()   
call flv%init ([1,-1], model)
pol_f(1) = 0.5
  end subroutine beam_1
end module beams

program main
  use beams
  call beam_1 (6)
end program main

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-27 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #6 from Jürgen Reuter juergen.reuter at desy dot de ---
Created attachment 35403
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35403action=edit
Auxiliary module

[Bug fortran/65894] [6 Regression] severe regression in gfortran 6.0.0

2015-04-27 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65894

--- Comment #8 from vehre at gcc dot gnu.org ---
Created attachment 35407
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35407action=edit
A first patch.

With the attached patch your small test case and the testsuite runs w/o
segfault now. Furthermore does gcc6 bootstrap and regtest ok with the patch.