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



             Bug #: 54656

           Summary: ICE with software REAL(16) for NORM2

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Keywords: ice-on-valid-code

          Severity: normal

          Priority: P3

         Component: fortran

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: bur...@gcc.gnu.org

                CC: jde...@intec.unl.edu.ar





Reported by Jorge D'ELIA at http://gcc.gnu.org/ml/fortran/2012-09/msg00075.html



  program test79

    implicit none

    real(16) :: d(10), z

    d = 1

    z = norm2 (d)  ! ICE (segfault)

  end program test79







The problem is the following code in trans-intrinsic.c's

gfc_conv_intrinsic_arith:



  if (norm2)

    {

      /* result = scale * sqrt(result).  */

      tree sqrt;

      sqrt = gfc_builtin_decl_for_float_kind (BUILT_IN_SQRT, expr->ts.kind);



as sqrt == NULL_TREE.



Seemingly, the proper way to call the quad functions is to use

gfc_conv_intrinsic_lib_function.



Only a small subset gets a decl and is thus available in the struct

gfc_intrinsic_map, which is accessed in gfc_builtin_decl_for_float_kind.



The struct gets set gfc_build_intrinsic_lib_fndecls, but that only handles

OTHER_BUILTIN - and not DEFINE_MATH_BUILTIN_C, which is needed for SQRT.

Reply via email to