https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61615

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Well, my understanding is that
>
>     TYPE(c_ptr) :: a, b
>
> are pointers (void*) and
>
>     TYPE(c_ptr) :: a(:), b(:)
>
> are arrays of pointers (void**).

The result of -fdump-tree-original of

PROGRAM cptr_array_vs_scalar_arg
  USE iso_c_binding
  IMPLICIT NONE
  INTEGER, TARGET :: i, j(5)
  TYPE(c_ptr) :: a, b
  a = C_LOC(i)
  b = C_LOC(j)
END PROGRAM cptr_array_vs_scalar_arg

is

cptr_array_vs_scalar_arg ()
{
  void * a;
  void * b;
  integer(kind=4) i;
  integer(kind=4) j[5];

  {
    void * D.2336;

    D.2336 = (void *) &i;
    a = D.2336;
  }
  {
    void * D.2337;

    D.2337 = (void *) &j;
    b = D.2337;
  }
}


main (integer(kind=4) argc, character(kind=1) * * argv)
{
  static integer(kind=4) options.0[9] = {68, 1023, 0, 0, 1, 1, 0, 0, 31};

  _gfortran_set_args (argc, argv);
  _gfortran_set_options (9, &options.0[0]);
  cptr_array_vs_scalar_arg ();
  return 0;
}

Reply via email to