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



--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-15 
14:47:31 UTC ---

(In reply to comment #6)

> Looks as if code of the form:

>   if (y.data)

>     D.1914 = _gfortran_internal_pack (&y);

>   else

>     D.1914 = NULL;

> 

> is missing



The bug is in trans-array.c's gfc_conv_array_parameter, which currently has:



  7156        ptr = build_call_expr_loc (input_location,

  7157                               gfor_fndecl_in_pack, 1, desc);

  7158  

  7159        if (fsym && fsym->attr.optional && sym && sym->attr.optional)

  7160          {

  7161            tmp = gfc_conv_expr_present (sym);





If the actual argument has sym->attr.optional, the code should work. Looking at

line 39 of class_optional_2.f90, there seems to be something not working, which

might be a bug in gfc_conv_expr_present.





If sym->attr.optional is not present, it is currently not handled by

gfc_conv_expr_present (assert).



Similarly, if the actual argument is an expression like "var%comp" - here, the

".data == NULL" check has to be done for "comp" and not for "var" alias "sym".

Similarly for expressions instead of variables. (There are presumably more

issues.)

Reply via email to