URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [dependency_25.f90] - Rev 694
Compare with Previous | Blame | View Log
! { dg-do run }! Test the fix for PR42736, in which an excessively rigorous dependency! checking for the assignment generated an unnecessary temporary, whose! rank was wrong. When accessed by the scalarizer, a segfault ensued.!! Contributed by Tobias Burnus <burnus@gcc.gnu.org>! Reported by Armelius Cameron <armeliusc@gmail.com>!module UnitValue_Moduleimplicit noneprivatepublic :: &operator(*), &assignment(=)type, public :: UnitValuereal :: &Value = 1.0character(31) :: &Labelend type UnitValueinterface operator(*)module procedure ProductReal_LVend interface operator(*)interface assignment(=)module procedure Assign_LV_Realend interface assignment(=)containselemental function ProductReal_LV(Multiplier, Multiplicand) result(P_R_LV)real, intent(in) :: &Multipliertype(UnitValue), intent(in) :: &Multiplicandtype(UnitValue) :: &P_R_LVP_R_LV%Value = Multiplier * Multiplicand%ValueP_R_LV%Label = Multiplicand%Labelend function ProductReal_LVelemental subroutine Assign_LV_Real(LeftHandSide, RightHandSide)real, intent(inout) :: &LeftHandSidetype(UnitValue), intent(in) :: &RightHandSideLeftHandSide = RightHandSide%Valueend subroutine Assign_LV_Realend module UnitValue_Moduleprogram TestProgramuse UnitValue_Moduleimplicit nonetype :: TableFormreal, dimension(:,:), allocatable :: &RealDataend type TableFormtype(UnitValue) :: &CENTIMETERtype(TableForm), pointer :: &Tableallocate(Table)allocate(Table%RealData(10,5))CENTIMETER%value = 42Table%RealData = 1Table%RealData(:,1) = Table%RealData(:,1) * CENTIMETERTable%RealData(:,2) = Table%RealData(:,2) * CENTIMETERTable%RealData(:,3) = Table%RealData(:,3) * CENTIMETERTable%RealData(:,5) = Table%RealData(:,5) * CENTIMETER! print *, Table%RealDataif (any (abs(Table%RealData(:,4) - 1) > epsilon(1.0))) call abort ()if (any (abs(Table%RealData(:,[1,2,3,5]) - 42) > epsilon(1.0))) call abort ()end program TestProgram! { dg-final { cleanup-modules "unitvalue_module" } }
