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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-08-23
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-08-23 
10:07:42 UTC ---
Confirmed on 4.4.6, 4.5.3, 4.6.1, and trunk. g95 and ifort reject the code with

[macbook] f90/bug% g95 pr50163.f90
In file pr50163.f90:3

integer :: iloc=index(xx,'bb')
                      1
Error: Variable 'xx' at (1) cannot appear in an initialization expression
[macbook] f90/bug% ifc pr50163.f90
pr50163.f90(3): error #6592: This symbol must be a defined parameter, an
enumerator, or an argument of an inquiry function that evaluates to a
compile-time constant.   [XX]
integer :: iloc=index(xx,'bb')
----------------------^
pr50163.f90(3): error #6973: This is not a valid initialization expression.  
[INDEX]
integer :: iloc=index(xx,'bb')
----------------^
compilation aborted for pr50163.f90 (code 1)

The segmentation fault is due to

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
check_init_expr (e=0x141f1c640) at ../../work/gcc/fortran/expr.c:1969
1969          if (a->expr->expr_type != EXPR_ARRAY)
(gdb) bt
#0  check_init_expr (e=0x141f1c640) at ../../work/gcc/fortran/expr.c:1969
#1  0x000000010002e778 in gfc_reduce_init_expr (expr=0x3) at
../../work/gcc/fortran/expr.c:2626
Current language:  auto; currently c++
(gdb) p *a
$3 = {
  name = 0x0, 
  label = 0x0, 
  missing_arg_type = BT_LOGICAL, 
  expr = 0x0, 
  next = 0x141f1cac0
}

Reply via email to