This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/36158] Transformational function BESSEL_YN(n1,n2,x) and BESSEL_JN missing


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

--- Comment #17 from Ian Bolton <ibolton at gcc dot gnu.org> 2011-02-07 15:41:14 UTC ---
(In reply to comment #16)
> (In reply to comment #15)
> 
> > 
> > Is this going to be backported to 4.5?  It is required to make CSHIFT function
> > correctly.
> 
> It may be prudent to actually describe the problem
> with cshift and give a short example.  The above
> is of little value.

Sorry about that.  You are right - I should have given more information.  Here
goes:

Currently, the code for the gfc_get_symbol_for_expr() function on the 4.5
branch has a comment that says:

"/* TODO: proper argument lists for external intrinsics.  */"

CSHIFT is one such fortran intrinsic, which will have an incorrect formal
argument list due to this TODO not being done.  Specifically, we can end up
with a _gfortran_cshift0_4 call with no formal arguments.

Here is a reduced testcase (adapted from an existing testcase) that shows such
an issue with _gfortran_cshift0_4:

 ! Program to test the cshift intrinsic
 program intrinsic_cshift
    integer, dimension(3, 2) :: a

    ! Scalar shift
    a = reshape ((/1, 2, 3, 4, 5, 6/), (/3, 2/))
    a = cshift (a, 1, 1)
    if (any (a .ne. reshape ((/2, 3, 1, 5, 6, 4/), (/3, 2/)))) &
       call abort
 end program

There is no information within the existing tree dumps to show things have gone
wrong, but debugging with gdb and inserting a breakpoint within the
gfc_get_symbol_for_expr function will show that
expr->value.function.isym.formal has three items in it, whereas the new sym
that we create is empty.  The patch that fixed PR36158 correctly copies the
formal arguments from isym to sym and we then get the correct behaviour.

I hope that information is sufficient.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]