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