This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/57019] New: Compiler crashes (and make wrong assignments) at some combinations of pointers


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57019

             Bug #: 57019
           Summary: Compiler crashes (and make wrong assignments) at some
                    combinations of pointers
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thambsup@gmail.com


This bug has two parts.

!here we have  types of data:
type cParticle
    real(4) :: v(3),r0(2),rS(3),r1(2),SinA,CosA
endtype cParticle
type aParticle
    real(4) :: v(3),r0(2)
endtype aParticle
type pCItem
    type(aParticle) :: Atm
    type(cParticle) :: Ele
    type(cParticle) :: Ion
end type pCItem

!and array+pointers:
type(pCItem),allocatable,target,dimension(:,:)::pCellArray
type(cParticle),pointer,dimension(:,:)::pArray
type(cParticle),pointer::p_pointer
real(4),pointer,dimension(:)::v_pointer
real(4),pointer::s_pointer
allocate( pCellArray(1:ipMax,1:iCells) )
pArray=>pCellArray%Ele !for example

!now let's try
p_pointer=>pArray(1,1);

and we have
~/src gfortran -Wall bug.f95
data_types.f95: In function âMAIN__â:
data_types.f95:19: internal compiler error: ÐÑÐÐÐÐ ÑÐÐÐÐÐÑÐÑÐÐÐÐÐÑ
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.

and we can achive this bug if we write s_pointer=>pArray(1,1)%SinA, but not if
v_pointer=>pArray(1,1)%v

!%%%%%%%%%%%%%%%%%%%%%%%
the second part of this bug is wrong assignments.

if we write "pArray(1,1)%v=10" -- only first component of vector will be
written, but if we make it via transitional pointer "v_pointer=>pArray(1,1)%v ;
v_pointer=10" -- everything is fine.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]