resolve.c: Prevent segfault on illegal input.
gcc/fortran/ChangeLog: 2015-03-16 Andre Vehreschild <vehre@gmx.de> * resolve.c: Prevent segfault on illegal input. gcc/testsuite/ChangeLog: 2015-03-16 Andre Vehreschild <vehre@gmx.de> * gfortran.dg/pointer_2.f90: New test. From-SVN: r221455
This commit is contained in:
parent
9e25209f3a
commit
6c25f79625
4 changed files with 30 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
2015-03-16 Andre Vehreschild <vehre@gmx.de>
|
||||
|
||||
* resolve.c: Prevent segfault on illegal input.
|
||||
|
||||
2015-03-14 Mikael Morin <mikael@gcc.gnu.org>
|
||||
|
||||
PR fortran/61138
|
||||
|
|
|
@ -2639,6 +2639,10 @@ found:
|
|||
expr->ts = sym->ts;
|
||||
expr->value.function.name = sym->name;
|
||||
expr->value.function.esym = sym;
|
||||
/* Prevent crash when sym->ts.u.derived->components is not set due to previous
|
||||
error(s). */
|
||||
if (sym->ts.type == BT_CLASS && !CLASS_DATA (sym))
|
||||
return MATCH_ERROR;
|
||||
if (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->as)
|
||||
expr->rank = CLASS_DATA (sym)->as->rank;
|
||||
else if (sym->as != NULL)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2015-03-16 Andre Vehreschild <vehre@gmx.de>
|
||||
|
||||
* gfortran.dg/pointer_2.f90: New test.
|
||||
|
||||
2015-03-16 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* testsuite/g++.dg/pr65049.C: New test.
|
||||
|
|
18
gcc/testsuite/gfortran.dg/pointer_2.f90
Normal file
18
gcc/testsuite/gfortran.dg/pointer_2.f90
Normal file
|
@ -0,0 +1,18 @@
|
|||
! { dg-do compile }
|
||||
! Check that the compiler reports the errors, but does not segfault.
|
||||
! Contributed by: Andre Vehreschild <vehre@gcc.gnu.org>
|
||||
!
|
||||
program test
|
||||
implicit none
|
||||
class(*), pointer :: P
|
||||
class(*), allocatable :: P2
|
||||
|
||||
allocate(P2, source=convertType(P))
|
||||
|
||||
contains
|
||||
|
||||
function convertType(in) ! { dg-error "must be dummy, allocatable or pointer" }
|
||||
class(*), intent(in) :: in
|
||||
class(*) :: convertType
|
||||
end function
|
||||
end program test
|
Loading…
Add table
Reference in a new issue