public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29098] New: allocation of a pointer to a derived type crashes
@ 2006-09-15 11:38 vahtras at pdc dot kth dot se
2006-09-15 13:12 ` [Bug fortran/29098] " paul dot richard dot thomas at cea dot fr
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: vahtras at pdc dot kth dot se @ 2006-09-15 11:38 UTC (permalink / raw)
To: gcc-bugs
Symptom:
$ gfortran -c test.F90
test.F90: In function 'MAIN__':
test.F90:24: internal compiler error: in gfc_trans_call, at
fortran/trans-stmt.c:325
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Version:
$ gfortran -v
Using built-in specs.
Target: i386-linux
Configured with: ../gcc/configure
--prefix=/cosmic/coudert/tmp/gfortran-20060906/irun
--enable-languages=c,fortran
--host=i386-linux
--with-gmp=/cosmic/coudert/tmp/gfortran-20060906/gfortran_libs
Thread model: posix
gcc version 4.2.0 20060904 (experimental)
Code enclosed (cut down as much as possible)
MODULE MAT
TYPE BAS
INTEGER :: R = 0,C = 0
END TYPE BAS
TYPE BLOCK
INTEGER, DIMENSION(:), POINTER :: R,C
TYPE(BAS), POINTER, DIMENSION(:) :: NO => NULL()
END TYPE BLOCK
INTERFACE ASSIGNMENT(=)
MODULE PROCEDURE BLASSIGN
END INTERFACE
CONTAINS
SUBROUTINE BLASSIGN(A,B)
TYPE(BLOCK), INTENT(IN) :: B
TYPE(BLOCK), INTENT(INOUT) :: A
INTEGER I,N
! ...
END SUBROUTINE BLASSIGN
END MODULE MAT
PROGRAM TEST
USE MAT
TYPE(BLOCK) MATRIX
POINTER MATRIX
ALLOCATE(MATRIX)
END
--
Summary: allocation of a pointer to a derived type crashes
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vahtras at pdc dot kth dot se
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29098
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/29098] allocation of a pointer to a derived type crashes
2006-09-15 11:38 [Bug fortran/29098] New: allocation of a pointer to a derived type crashes vahtras at pdc dot kth dot se
@ 2006-09-15 13:12 ` paul dot richard dot thomas at cea dot fr
2006-09-15 14:16 ` paul dot richard dot thomas at cea dot fr
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-09-15 13:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paul dot richard dot thomas at cea dot fr 2006-09-15 13:12 -------
Olav,
Thanks for the contribution:
TYPE BLOCK
INTEGER, DIMENSION(:), POINTER :: R => NULL(),C => NULL()
TYPE(BAS), POINTER, DIMENSION(:) :: NO => NULL ()
END TYPE BLOCK
gives you a workaround that loses you nothing.
ALLOCATE (matrix) then produces
{
void * * ptr.0;
ptr.0 = (void * *) &matrix;
_gfortran_allocate (ptr.0, 72, 0);
}
{
struct block D.929;
struct block block.1;
block.1.r.data = 0B;
block.1.c.data = 0B;
block.1.no.data = 0B;
D.929 = block.1;
blassign (matrix, &D.929);
}
It is the last line that triggers the error.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29098
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/29098] allocation of a pointer to a derived type crashes
2006-09-15 11:38 [Bug fortran/29098] New: allocation of a pointer to a derived type crashes vahtras at pdc dot kth dot se
2006-09-15 13:12 ` [Bug fortran/29098] " paul dot richard dot thomas at cea dot fr
@ 2006-09-15 14:16 ` paul dot richard dot thomas at cea dot fr
2006-09-16 19:57 ` pault at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-09-15 14:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paul dot richard dot thomas at cea dot fr 2006-09-15 14:16 -------
Created an attachment (id=12276)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12276&action=view)
A fix for the problem
The handling of default initializers can never have been quite right. The
moment that there is an interface assignement, this is called by ALLOCATE, for
example. Adding a dimension(2) array to your structure, ALLOCATE produces,
with the patch applied:
{
void * * ptr.1;
ptr.1 = (void * *) &matrix;
_gfortran_allocate (ptr.1, 80, 0);
}
{
struct block D.943;
struct block block.2;
{
int4 S.3;
S.3 = 1;
while (1)
{
if (S.3 > 2) goto L.2; else (void) 0;
block.2.blank[NON_LVALUE_EXPR <S.3> + -1] = 0;
S.3 = S.3 + 1;
}
L.2:;
}
block.2.r.data = 0B;
block.2.c.data = 0B;
block.2.no.data = 0B;
D.943 = block.2;
blassign (matrix, &D.943);
}
If I now make formal argument a INTENT(OUT), this last block of code is
repeated but with a structure assignment this time, rather than blassign!
Some furthr sorting out is needed!
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29098
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/29098] allocation of a pointer to a derived type crashes
2006-09-15 11:38 [Bug fortran/29098] New: allocation of a pointer to a derived type crashes vahtras at pdc dot kth dot se
2006-09-15 13:12 ` [Bug fortran/29098] " paul dot richard dot thomas at cea dot fr
2006-09-15 14:16 ` paul dot richard dot thomas at cea dot fr
@ 2006-09-16 19:57 ` pault at gcc dot gnu dot org
2006-09-17 11:30 ` patchapp at dberlin dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-09-16 19:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pault at gcc dot gnu dot org 2006-09-16 19:57 -------
See list for choice of fixes. I will submit my favourite tomorrow.
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-09-16 19:57:15
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29098
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/29098] allocation of a pointer to a derived type crashes
2006-09-15 11:38 [Bug fortran/29098] New: allocation of a pointer to a derived type crashes vahtras at pdc dot kth dot se
` (2 preceding siblings ...)
2006-09-16 19:57 ` pault at gcc dot gnu dot org
@ 2006-09-17 11:30 ` patchapp at dberlin dot org
2006-10-04 4:48 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: patchapp at dberlin dot org @ 2006-09-17 11:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from patchapp at dberlin dot org 2006-09-17 11:30 -------
Subject: Bug number PR29098
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00671.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29098
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/29098] allocation of a pointer to a derived type crashes
2006-09-15 11:38 [Bug fortran/29098] New: allocation of a pointer to a derived type crashes vahtras at pdc dot kth dot se
` (3 preceding siblings ...)
2006-09-17 11:30 ` patchapp at dberlin dot org
@ 2006-10-04 4:48 ` pault at gcc dot gnu dot org
2006-10-04 4:49 ` pault at gcc dot gnu dot org
2006-11-06 17:19 ` pault at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-10-04 4:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pault at gcc dot gnu dot org 2006-10-04 04:48 -------
Subject: Bug 29098
Author: pault
Date: Wed Oct 4 04:48:35 2006
New Revision: 117424
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117424
Log:
2006-10-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29098
* resolve.c (resolve_structure_cons): Do not return FAILURE if
component expression is NULL.
2006-10-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29098
* gfortran.dg/default_initialization_2.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/default_initialization_2.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29098
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/29098] allocation of a pointer to a derived type crashes
2006-09-15 11:38 [Bug fortran/29098] New: allocation of a pointer to a derived type crashes vahtras at pdc dot kth dot se
` (4 preceding siblings ...)
2006-10-04 4:48 ` pault at gcc dot gnu dot org
@ 2006-10-04 4:49 ` pault at gcc dot gnu dot org
2006-11-06 17:19 ` pault at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-10-04 4:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pault at gcc dot gnu dot org 2006-10-04 04:49 -------
Fixed on trunk
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29098
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/29098] allocation of a pointer to a derived type crashes
2006-09-15 11:38 [Bug fortran/29098] New: allocation of a pointer to a derived type crashes vahtras at pdc dot kth dot se
` (5 preceding siblings ...)
2006-10-04 4:49 ` pault at gcc dot gnu dot org
@ 2006-11-06 17:19 ` pault at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-11-06 17:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pault at gcc dot gnu dot org 2006-11-06 17:18 -------
Subject: Bug 29098
Author: pault
Date: Mon Nov 6 17:18:03 2006
New Revision: 118522
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118522
Log:
2006-11-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29373
* decl.c (get_proc_name, gfc_match_function_decl): Add
attr.implicit_type to conditions that throw error for
existing explicit interface and that allow new type-
spec to be applied.
PR fortran/29407
* resolve.c (resolve_fl_namelist): Do not check for
namelist/procedure conflict, if the symbol corresponds
to a good local variable declaration.
PR fortran/27701
* decl.c (get_proc_name): Replace the detection of a declared
procedure by the presence of a formal argument list by the
attributes of the symbol and the presence of an explicit
interface.
PR fortran/29232
* resolve.c (resolve_fl_variable): See if the host association
of a derived type is blocked by the presence of another type I
object in the current namespace.
PR fortran/29364
* resolve.c (resolve_fl_derived): Check for the presence of
the derived type for a derived type component.
PR fortran/24398
* module.c (gfc_use_module): Check that the first words in a
module file are 'GFORTRAN module'.
PR fortran/29115
* resolve.c (resolve_structure_cons): It is an error if the
pointer component elements of a derived type constructor are
not pointer or target.
PR fortran/29211
* trans-stmt.c (generate_loop_for_temp_to_lhs,
generate_loop_for_rhs_to_temp): Provide a string length for
the temporary by copying that of the other side of the scalar
assignment.
PR fortran/29098
* resolve.c (resolve_structure_cons): Do not return FAILURE if
component expression is NULL.
2006-11-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29373
* gfortran.dg/implicit_9.f90: New test.
PR fortran/29407
* gfortran.dg/namelist_25.f90: New test.
PR fortran/27701
* gfortran.dg/same_name_2.f90: New test.
PR fortran/29232
* gfortran.dg/host_assoc_types_1.f90: New test.
PR fortran/29364
* gfortran.dg/missing_derived_type_1.f90: New test.
* gfortran.dg/implicit_actual.f90: Comment out USE GLOBAL.
PR fortran/29115
* gfortran.dg/derived_constructor_comps_2.f90: New test.
PR fortran/29211
* gfortran.dg/forall_char_dependencies_1.f90: New test.
PR fortran/29098
* gfortran.dg/default_initialization_2.f90: New test.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/default_initialization_2.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/forall_char_dependencies_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/host_assoc_types_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/implicit_9.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/missing_derived_type_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_25.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/same_name_2.f90
Modified:
branches/gcc-4_1-branch/gcc/fortran/ChangeLog
branches/gcc-4_1-branch/gcc/fortran/decl.c
branches/gcc-4_1-branch/gcc/fortran/module.c
branches/gcc-4_1-branch/gcc/fortran/resolve.c
branches/gcc-4_1-branch/gcc/fortran/trans-stmt.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/implicit_actual.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29098
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-11-06 17:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-15 11:38 [Bug fortran/29098] New: allocation of a pointer to a derived type crashes vahtras at pdc dot kth dot se
2006-09-15 13:12 ` [Bug fortran/29098] " paul dot richard dot thomas at cea dot fr
2006-09-15 14:16 ` paul dot richard dot thomas at cea dot fr
2006-09-16 19:57 ` pault at gcc dot gnu dot org
2006-09-17 11:30 ` patchapp at dberlin dot org
2006-10-04 4:48 ` pault at gcc dot gnu dot org
2006-10-04 4:49 ` pault at gcc dot gnu dot org
2006-11-06 17:19 ` pault at gcc dot gnu dot org
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).