View previous topic :: View next topic |
Author |
Message |
simon
Joined: 05 Jul 2006 Posts: 299
|
Posted: Tue Aug 27, 2013 2:46 am Post subject: Incorrect use of derived type |
|
|
The following program attempts to increment an integer component of a derived type, but in line 14 incorrectly refers to u%j%i instead of u%t%i.
Code: |
MODULE m
TYPE t1
INTEGER :: i=0
END TYPE t1
TYPE t2
INTEGER :: j=0
TYPE(t1) :: t
END TYPE t2
END MODULE m
!
PROGRAM p
USE m
TYPE(t2) :: u
PRINT *, u%j%i+1
END PROGRAM p
|
The compiler, appropriately, generates an error message, but seems to imply that u is integer. Is it possible for the compiler to indicate that u%j is INTEGER(KIND=3) rather than u? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Aug 27, 2013 7:05 am Post subject: |
|
|
I have logged this. It could be that the compiler is looking at J rather than U.
Chances are the error report is generally correct and this is an exception so these things are not necessarily easy to fix. |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Tue Aug 27, 2013 8:52 am Post subject: |
|
|
Hello,
This is the same BUG I refer to in the post below. See message of 31 July for the simplest example.
http://forums.silverfrost.com/viewtopic.php?t=2474
I am still hoping that this can be fixed at some point, because at the momement derived types with default initialization are not usable with the compiler. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Aug 27, 2013 11:34 am Post subject: |
|
|
This is simply an unnecessary (and incorrectly phrased) error report which I have now suppressed.
It does not bear any relation to other bugs which we aim to fix in due course. |
|
Back to top |
|
 |
|