-ff2c question: Complex type in procedure calls (related to PR 30887 / %VAL())

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Thu Feb 22 20:14:00 GMT 2007


Tobias Burnus wrote:
> In the test case, I have:
> external c_to_c8
> complex(8) u8, v8, w8, c_to_c8

No, you have not :-)  You wrote complex*8, which gets the following 
special treatment in gfc_match_old_kind_spec:

   /* Massage the kind numbers for complex types.  */
   if (ts->type == BT_COMPLEX)
     {
       if (ts->kind % 2)
	{
	  gfc_error ("Old-style type declaration %s*%d not supported at %C",
		     gfc_basic_typename (ts->type), original_kind);
	  return MATCH_ERROR;
	}
       ts->kind /= 2;
     }

If this weren't the case, the code you generated would certainly trip 
over some assertion in the middle end, due to a type mismatch between 
cmplx.1 and v8

> {
> complex4 cmplx.1;
> c_to_c8 (&cmplx.1, u8, &w8, &&w8);
> v8 = cmplx.1;
> }

- Tobi



More information about the Fortran mailing list