* [Patch, Fortran] PR 48889 - fix 4.6/4.7 regression: ICE in generics' resolution
@ 2011-05-11 14:15 Tobias Burnus
2011-05-11 22:38 ` Mikael Morin
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2011-05-11 14:15 UTC (permalink / raw)
To: gcc patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 707 bytes --]
As the PR shows, in the function the gfc_expr can be such that
expr->value.function.esym points to the correct specific function but
the generic expr->symtree->n.sym does not exist (expr->symtree == NULL).
However, also the opposite can happen that only expr->symtree is set and
neither esym nor isym is (yet) set.
Build and regtested on x86-64-linux.
OK for the trunk and 4.6?
* * *
Regression status:
- PR 48955 [4.6/4.7] Serious missing temporary regression, which Paul
wants to fix
- PR 45586 [4.6/4.7] Restricted vs. not-restricted assignment-tree check ICE
- PR 48786 [4.6/4.7] Probably no regression and just two OOP-related bugs
- PR 42954 [4.5/4.6/4.7]: Target CPP regression ...
Tobias
[-- Attachment #2: regfix.diff --]
[-- Type: text/x-patch, Size: 4028 bytes --]
2011-05-11 Tobias Burnus <burnus@net-b.de>
PR fortran/48889
* expr.c (gfc_is_constant_expr): Use e->value.function.esym
instead of e->symtree->n.sym, if available.
2011-05-11 Tobias Burnus <burnus@net-b.de>
PR fortran/48889
* gfortran.dg/generic_24.f90: New.
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 3d519db..f881bb1 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -893,6 +893,9 @@ gfc_is_constant_expr (gfc_expr *e)
case EXPR_FUNCTION:
case EXPR_PPC:
case EXPR_COMPCALL:
+ gcc_assert (e->symtree || e->value.function.esym
+ || e->value.function.isym);
+
/* Call to intrinsic with at least one argument. */
if (e->value.function.isym && e->value.function.actual)
{
@@ -901,13 +904,14 @@ gfc_is_constant_expr (gfc_expr *e)
return 0;
}
- /* Make sure we have a symbol. */
- gcc_assert (e->symtree);
-
- sym = e->symtree->n.sym;
-
/* Specification functions are constant. */
/* F95, 7.1.6.2; F2003, 7.1.7 */
+ sym = NULL;
+ if (e->symtree)
+ sym = e->symtree->n.sym;
+ if (e->value.function.esym)
+ sym = e->value.function.esym;
+
if (sym
&& sym->attr.function
&& sym->attr.pure
--- /dev/null 2011-05-11 08:03:10.239890179 +0200
+++ gcc/gcc/testsuite/gfortran.dg/generic_24.f90 2011-05-11 14:28:53.000000000 +0200
@@ -0,0 +1,100 @@
+! { dg-do compile }
+!
+! PR fortran/48889
+!
+! Thanks for
+! reporting to Lawrence Mitchell
+! for the test case to David Ham
+!
+module sparse_tools
+ implicit none
+ private
+
+ type csr_foo
+ integer, dimension(:), pointer :: colm=>null()
+ end type csr_foo
+
+ type block_csr_matrix
+ type(csr_foo) :: sparsity
+ end type block_csr_matrix
+
+ interface attach_block
+ module procedure block_csr_attach_block
+ end interface
+
+ interface size
+ module procedure sparsity_size
+ end interface
+
+ public :: size, attach_block
+contains
+ subroutine block_csr_attach_block(matrix, val)
+ type(block_csr_matrix), intent(inout) :: matrix
+ real, dimension(size(matrix%sparsity%colm)), intent(in), target :: val
+ end subroutine block_csr_attach_block
+
+ pure function sparsity_size(sparsity, dim)
+ integer :: sparsity_size
+ type(csr_foo), intent(in) :: sparsity
+ integer, optional, intent(in) :: dim
+ end function sparsity_size
+end module sparse_tools
+
+module global_numbering
+ use sparse_tools
+ implicit none
+
+ type ele_numbering_type
+ integer :: boundaries
+ end type ele_numbering_type
+
+ type element_type
+ integer :: loc
+ type(ele_numbering_type), pointer :: numbering=>null()
+ end type element_type
+
+ type csr_sparsity
+ end type csr_sparsity
+
+ interface size
+ module procedure sparsity_size
+ end interface size
+contains
+ pure function sparsity_size(sparsity, dim)
+ integer :: sparsity_size
+ type(csr_sparsity), intent(in) :: sparsity
+ integer, optional, intent(in) :: dim
+ end function sparsity_size
+
+ subroutine make_boundary_numbering(EEList, xndglno, ele_n)
+ type(csr_sparsity), intent(in) :: EEList
+ type(element_type), intent(in) :: ele_n
+ integer, dimension(size(EEList,1)*ele_n%loc), intent(in), target ::&
+ & xndglno
+ integer, dimension(ele_n%numbering%boundaries) :: neigh
+ integer :: j
+ j=size(neigh)
+ end subroutine make_boundary_numbering
+end module global_numbering
+
+module sparse_matrices_fields
+ use sparse_tools
+implicit none
+ type scalar_field
+ real, dimension(:), pointer :: val
+ end type scalar_field
+contains
+ subroutine csr_mult_T_scalar(x)
+ type(scalar_field), intent(inout) :: x
+ real, dimension(:), allocatable :: tmp
+ integer :: i
+ i=size(x%val)
+ end subroutine csr_mult_T_scalar
+end module sparse_matrices_fields
+
+program test
+ use sparse_matrices_fields
+ use global_numbering
+end program test
+
+! { dg-final { cleanup-tree-dump "sparse_tools sparse_matrices_fields global_numbering" } }
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, Fortran] PR 48889 - fix 4.6/4.7 regression: ICE in generics' resolution
2011-05-11 14:15 [Patch, Fortran] PR 48889 - fix 4.6/4.7 regression: ICE in generics' resolution Tobias Burnus
@ 2011-05-11 22:38 ` Mikael Morin
0 siblings, 0 replies; 2+ messages in thread
From: Mikael Morin @ 2011-05-11 22:38 UTC (permalink / raw)
To: fortran; +Cc: Tobias Burnus, gcc patches
On Wednesday 11 May 2011 15:20:38 Tobias Burnus wrote:
> As the PR shows, in the function the gfc_expr can be such that
> expr->value.function.esym points to the correct specific function but
> the generic expr->symtree->n.sym does not exist (expr->symtree == NULL).
> However, also the opposite can happen that only expr->symtree is set and
> neither esym nor isym is (yet) set.
>
> Build and regtested on x86-64-linux.
> OK for the trunk and 4.6?
In the test, it should be cleanup-modules instead of cleanup-tree-dump.
Ok with that change.
Thanks.
Mikael
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-11 19:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-11 14:15 [Patch, Fortran] PR 48889 - fix 4.6/4.7 regression: ICE in generics' resolution Tobias Burnus
2011-05-11 22:38 ` Mikael Morin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).