Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28445 Discussions

Internal compiler error with overloaded structure constructor and MERGE

IanH
Honored Contributor II
352 Views

The following use of MERGE inside an overloaded structure constructor results in an internal compiler error.

MODULE Direct2D
  IMPLICIT NONE
  PRIVATE
  
  TYPE, BIND(C), PUBLIC :: D2D1_POINT_2F
    REAL :: x = 0.0
    REAL :: y = 0.0
  END TYPE D2D1_POINT_2F
  
  TYPE, BIND(C), PUBLIC :: D2D1_RECT_F
    REAL :: left = 0.0
    REAL :: top = 0.0
    REAL :: right = 0.0
    REAL :: bottom = 0.0
  END TYPE D2D1_RECT_F
  INTERFACE D2D1_RECT_F
    MODULE PROCEDURE D2D1_RECT_F_constructor_point_point
  END INTERFACE D2D1_RECT_F
  
  PUBLIC :: FillRectangle
CONTAINS
  FUNCTION D2D1_RECT_F_constructor_point_point(top_left, bottom_right)  &
       RESULT(rect)
    TYPE(D2D1_POINT_2F), INTENT(IN) :: top_left
    TYPE(D2D1_POINT_2F), INTENT(IN) :: bottom_right
    TYPE(D2D1_RECT_F) :: rect
    rect%left = 0.0
  END FUNCTION D2D1_RECT_F_constructor_point_point
  
  SUBROUTINE FillRectangle(rect)
    TYPE(D2D1_RECT_F), INTENT(IN) :: rect
  END SUBROUTINE FillRectangle
END MODULE Direct2D

SUBROUTINE draw_swatch
  USE Direct2D
  IMPLICIT NONE
  CALL FillRectangle(  &
      D2D1_RECT_F( &
        1.0,  &
        1.0 - 5.0,  &
        1.0 + MERGE(38.0, -5.0, .TRUE.),  &
        1.0 + 5.0 ) )
END SUBROUTINE draw_swatch

 

>ifort /c "2016-05-04 ice.f90"
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.180 Build 20160204
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

2016-05-04 ice.f90(38): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
  CALL FillRectangle(  &
^
[ Aborting due to internal error. ]
compilation aborted for 2016-05-04 ice.f90 (code 1)

 

0 Kudos
2 Replies
Kevin_D_Intel
Employee
352 Views

Thank you for reporting this error Ian and for the convenient reproducer. I confirmed this defect in both our current 16.0 and upcoming 17.0 compilers and reported it to Development.

(Internal tracking id: DPD200410562)

0 Kudos
Kevin_D_Intel
Employee
352 Views

This issue is fixed in the next major release (18.0) scheduled for release later this year.

0 Kudos
Reply