------- Comment #5 from jvdelisle at gcc dot gnu dot org 2007-11-17 18:22 ------- The problem here is that when we resolve cshift and eoshift we convert dim from a EXPR_VARIABLE to a EXPR_FUNCTION that converts the type to match up with the runtime function.
Later in trans-expr.c, code is not built to test for NULL and set dim to the default of 1 since dim is no longer a variable and there is nothing in gfc_conv_function_call to handle it. It is normally handled by gfc_conv_missing_dummy. Further complicating this, the conversion of type function, such as convert_i8_i4 which gets simplified to a cast segfaults when dim is NULL. I think the solution is to build the type conversion later in gfc_conv_missing_dummy after building the test for NULL. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33317