Bug 67757 - ICE after "ambiguous reference"
Summary: ICE after "ambiguous reference"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.9.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-29 08:18 UTC by Arjen Markus
Modified: 2016-08-09 20:41 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-10-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arjen Markus 2015-09-29 08:18:48 UTC
The following code causes the compiler to produce a message about an ambiguous reference and then to crash with a segmentation fault (this is on Windows 7, both MinGW and Cygwin)":

module quaternion_def_basic
    implicit none

    type quaternion
        !type(complex) :: c(2)
        complex :: c(2)
    end type quaternion
end module quaternion_def_basic

module quaternion_def
    use quaternion_def_basic, only: T => quaternion
end module quaternion_def

module octonion_def
    use quaternion_def, T2 => T

    implicit none

    !private :: T2

    type T
        type(T2) :: c(2)
    end type T
end module octonion_def

module sedenion_def
    use octonion_def, T2 => T

    implicit none

    !private :: T2

    type T
        type(T2) :: c(2)
    end type T
end module sedenion_def

When I bring the "private" statements back, all is well.
Comment 1 Dominique d'Humieres 2015-10-09 18:11:51 UTC
Confirmed from 4.8 up to trunk (6.0). Note that the code compiles if the line

    !private :: T2

is uncommented in the module octonion_def.
Comment 2 kargls 2016-07-08 22:51:23 UTC
This appears to be fixed on 6 and 7.  Please check.
Comment 3 Dominique d'Humieres 2016-07-09 07:01:25 UTC
> This appears to be fixed on 6 and 7.  Please check.

I still get

pr67757_db_1.f90:27:8:

     use octonion_def, T2 => T
        1
Error: Name 't2' at (1) is an ambiguous reference to 't' from module 'octonion_def'
pr67757_db_1.f90:27:8:

     use octonion_def, T2 => T
        1
Error: Name 't2' at (1) is an ambiguous reference to 't' from module 'octonion_def'
pr67757_db_1.f90:34:16:

         type(T2) :: c(2)
                1
Error: Type name 't2' at (1) is ambiguous

with trunk, and

pr67757.f90:27:8:

     use octonion_def, T2 => T
        1
Error: Name 't2' at (1) is an ambiguous reference to 't' from module 'octonion_def'
pr67757.f90:27:8:

     use octonion_def, T2 => T
        1
Error: Name 't2' at (1) is an ambiguous reference to 't' from module 'octonion_def'
(null):0: confused by earlier errors, bailing out

with 5.4.0 and 6.1.0.
Comment 4 Thomas Koenig 2016-08-09 20:41:55 UTC
This no longer ICEs, probably after r238822 .

Closing as fixed.