Bug 18791 - CABS specifics declared of wrong type
CABS specifics declared of wrong type
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: libfortran
4.0.0
: P2 normal
: 4.1.2
Assigned To: Francois-Xavier Coudert
: wrong-code
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2004-12-02 19:27 UTC by Tobias Schlüter
Modified: 2006-10-02 09:38 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.0 4.1.1
Known to fail:
Last reconfirmed: 2005-12-15 04:57:27


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Schlüter 2004-12-02 19:28:00 UTC
in libgfortran/generated/_abs_c8.f90 we have

elemental function specific__abs_c8 (parm)
   complex (kind=8), intent (in) :: parm
   complex (kind=8) :: specific__abs_c8

   specific__abs_c8 = abs (parm)
end function

the function should be of type real(kind=8), not complex. In the current
incarnation the compiler generates a warning for an implicit type conversion.

Same for _abs_c4.f90
Comment 1 Francois-Xavier Coudert 2006-09-29 13:21:09 UTC
Assigning this to myself, as I have a patch cooking. A testcase is (on i686-linux):

$ cat cdabs.f 
      subroutine foo(f)
      implicit none
      real*8 f
      complex*16 z

      z = (1.,1.)
      print *, f(z)
      end

      implicit none
      intrinsic cdabs
      call foo(cdabs)
      end
$ gfortran cdabs.f && ./a.out
                     NaN
$ gfortran cdabs.f -O3 && ./a.out
                     NaN
zsh: segmentation fault  ./a.out
Comment 2 Francois-Xavier Coudert 2006-09-29 13:22:36 UTC
And also: that's a regression wrt g77.
Comment 3 Francois-Xavier Coudert 2006-09-29 20:41:22 UTC
Subject: Bug 18791

Author: fxcoudert
Date: Fri Sep 29 20:41:11 2006
New Revision: 117317

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117317
Log:
        PR fortran/18791

        * gfortran.dg/specifics_1.f90: New test.
        * gfortran.fortran-torture/execute/specifics.f90: Add tests for
        complex specifics.

        * m4/specific.m4: Special-case cabs so that its return type is
        real. Special-case conjg so that their suffices are _4, _8, _10 and
        _16 instead of _c4, _c8, _c10 and _c16.
        * intrinsics/f2c_specifics.F90: Special-case conjg functions so
        that their suffices are _4 and _8 instead of _c4 and _c8.
        * generated/_conjg_c4.F90: Regenerate.
        * generated/_conjg_c8.F90: Regenerate.
        * generated/_conjg_c10.F90: Regenerate.
        * generated/_conjg_c16.F90: Regenerate.
        * generated/_abs_c4.F90: Regenerate.
        * generated/_abs_c8.F90: Regenerate.
        * generated/_abs_c10.F90: Regenerate.
        * generated/_abs_c16.F90: Regenerate.

Added:
    trunk/gcc/testsuite/gfortran.dg/specifics_1.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.fortran-torture/execute/specifics.f90
    trunk/libgfortran/generated/_abs_c10.F90
    trunk/libgfortran/generated/_abs_c16.F90
    trunk/libgfortran/generated/_abs_c4.F90
    trunk/libgfortran/generated/_abs_c8.F90
    trunk/libgfortran/generated/_conjg_c10.F90
    trunk/libgfortran/generated/_conjg_c16.F90
    trunk/libgfortran/generated/_conjg_c4.F90
    trunk/libgfortran/generated/_conjg_c8.F90
    trunk/libgfortran/m4/specific.m4

Comment 4 Francois-Xavier Coudert 2006-10-02 09:37:18 UTC
Subject: Bug 18791

Author: fxcoudert
Date: Mon Oct  2 09:37:09 2006
New Revision: 117369

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117369
Log:
	PR fortran/18791

	* gfortran.dg/specifics_1.f90: New test.
	* gfortran.fortran-torture/execute/specifics.f90: Add tests for
	complex specifics.

	* m4/specific.m4: Special-case cabs so that its return type is
	real. Special-case conjg so that their suffices are _4, _8, _10 and
	_16 instead of _c4, _c8, _c10 and _c16.
	* intrinsics/f2c_specifics.F90: Special-case conjg functions so
	that their suffices are _4 and _8 instead of _c4 and _c8.
	* generated/_conjg_c4.F90: Regenerate.
	* generated/_conjg_c8.F90: Regenerate.
	* generated/_conjg_c10.F90: Regenerate.
	* generated/_conjg_c16.F90: Regenerate.
	* generated/_abs_c4.F90: Regenerate.
	* generated/_abs_c8.F90: Regenerate.
	* generated/_abs_c10.F90: Regenerate.
	* generated/_abs_c16.F90: Regenerate.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/specifics_1.f90
      - copied unchanged from r117317, trunk/gcc/testsuite/gfortran.dg/specifics_1.f90
Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/specifics.f90
    branches/gcc-4_1-branch/libgfortran/ChangeLog
    branches/gcc-4_1-branch/libgfortran/generated/_abs_c10.F90
    branches/gcc-4_1-branch/libgfortran/generated/_abs_c16.F90
    branches/gcc-4_1-branch/libgfortran/generated/_abs_c4.F90
    branches/gcc-4_1-branch/libgfortran/generated/_abs_c8.F90
    branches/gcc-4_1-branch/libgfortran/generated/_conjg_c10.F90
    branches/gcc-4_1-branch/libgfortran/generated/_conjg_c16.F90
    branches/gcc-4_1-branch/libgfortran/generated/_conjg_c4.F90
    branches/gcc-4_1-branch/libgfortran/generated/_conjg_c8.F90
    branches/gcc-4_1-branch/libgfortran/intrinsics/f2c_specifics.F90
    branches/gcc-4_1-branch/libgfortran/m4/specific.m4

Comment 5 Francois-Xavier Coudert 2006-10-02 09:38:39 UTC
Fixed on both 4.2 and 4.1