Bug 55255 - [4.6 Regression] Compiler segmentation fault
Summary: [4.6 Regression] Compiler segmentation fault
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-09 20:02 UTC by Everett You
Modified: 2012-11-24 12:35 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-11-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Everett You 2012-11-09 20:02:45 UTC
* version: 4.6.2 20111019 (prerelease) (GCC)
* system type: Mac OS 10.7.4
* built command: gfortran -o BUG BUG.f90 -save-temps -J ./build
* bug behavior: compiler throws internal compiler error: Segmentation fault
* source files: BUG.f90
! -----------------------------------
MODULE MY_ARRAY
	TYPE ARRAY
		REAL, ALLOCATABLE :: VALS(:)
	END TYPE ARRAY
CONTAINS
FUNCTION MAKE_ARRAY(X) RESULT(Y)
	REAL, INTENT(IN) :: X(:)
	TYPE(ARRAY) :: Y
	Y%VALS = X
END FUNCTION MAKE_ARRAY
SUBROUTINE PRINT_ARRAY(Y)
	TYPE(ARRAY), INTENT(IN) :: Y
	PRINT *, Y%VALS
END SUBROUTINE PRINT_ARRAY
END MODULE MY_ARRAY

PROGRAM MAIN
	USE MY_ARRAY
	CALL PRINT_ARRAY(MAKE_ARRAY((/1.,2./)))
END PROGRAM MAIN
! ----------------------------------
Comment 1 janus 2012-11-09 21:19:45 UTC
I can confirm the error with:

gcc version 4.6.0 20110505 [gcc-4_6-branch revision 173419] (SUSE Linux)

However, all other versions I tried compile the test case correctly (including 4.3, 4.5, 4.7 and trunk).
Comment 2 janus 2012-11-09 22:05:20 UTC
Slightly reduced test case:


MODULE MY_ARRAY
  TYPE ARRAY
    REAL, ALLOCATABLE :: VALS
  END TYPE
CONTAINS
  TYPE(ARRAY) FUNCTION MAKE_ARRAY()
  END FUNCTION
  SUBROUTINE PRINT_ARRAY(Y)
    TYPE(ARRAY) :: Y
  END SUBROUTINE
END MODULE

PROGRAM MAIN
  USE MY_ARRAY
  CALL PRINT_ARRAY(MAKE_ARRAY())
END PROGRAM MAIN
Comment 3 janus 2012-11-24 12:35:12 UTC
(In reply to comment #1)
> I can confirm the error with:
> 
> gcc version 4.6.0 20110505 [gcc-4_6-branch revision 173419] (SUSE Linux)
> 
> However, all other versions I tried compile the test case correctly (including
> 4.3, 4.5, 4.7 and trunk).

In fact it seems that it has also been fixed on the 4.6 branch already:

gcc version 4.6.3 20120531 [gcc-4_6-branch revision 188067] (SUSE Linux)

works for me on both comment 0 and comment 2.

Closing as fixed!