public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51435] New: Bad association status after null() of derived type component
@ 2011-12-06 9:29 darmar.xxl at gmail dot com
2011-12-06 10:08 ` [Bug fortran/51435] [4.6/4.7 Regression] " burnus at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: darmar.xxl at gmail dot com @ 2011-12-06 9:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
Bug #: 51435
Summary: Bad association status after null() of derived type
component
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: darmar.xxl@gmail.com
Created attachment 26002
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26002
test code
Here is the code:
!---------------
module arr_m
type arr_t
real(8), dimension(:), allocatable :: rsk
! if allocatable changed to pointer, all is OK
end type
end module arr_m
!*********************
module list_m
use arr_m
implicit none
type my_list
type(arr_t), pointer :: head => null()
!!!integer, pointer :: tail => null() !if this is uncommented, all
is OK.
end type my_list
end module list_m
!***********************
module worker_mod
use list_m
implicit none
type data_all_t
type(my_list) :: my_data
end type data_all_t
contains
subroutine do_job()
type(data_all_t) :: dum
if (associated(dum%my_data%head)) then
print *, 'do_job my_data%head is associated'
!
! gfortran goes here.
! WRONG. head was nullified.
!
else
print *, 'do_job my_data%head is NOT associated' ! OK
end if
end subroutine
end module
!***************
program hello
use worker_mod
implicit none
call do_job()
end program
!***************
gfortran reports that dum%my_data%head is associated in the sub "do_job", while
"head" component was nullified using null() in the variable declaration line.
I tested this with gfortran 4.6 and 4.7 on Linux and Windows (produces wrong
results). Version 4.5 outputs correct result. (ifort is OK).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51435] [4.6/4.7 Regression] Bad association status after null() of derived type component
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
@ 2011-12-06 10:08 ` burnus at gcc dot gnu.org
2011-12-06 10:34 ` burnus at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-06 10:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
CC| |burnus at gcc dot gnu.org
Target Milestone|--- |4.6.3
Summary|Bad association status |[4.6/4.7 Regression] Bad
|after null() of derived |association status after
|type component |null() of derived type
| |component
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-06 10:08:32 UTC ---
With GCC 4.3, 4.4 and 4.5, I get:
do_job my_data%head is NOT associated
while GCC 4.6 prints
do_job my_data%head is associated
With GCC 4.7 I get the correct result ("NOT associated") but it shows the same
valgrind warning as GCC 4.6. (GCC 4.5 shows no valgrind warning.) Thus, either
the issue is fixed in 4.7 - and 4.6 and 4.7 have additional issues. Or it works
in 4.7 only by chance.
==19540== Conditional jump or move depends on uninitialised value(s)
==19540== at 0x400776: __worker_mod_MOD_do_job (hjhjff.f90:29)
==19540== by 0x400849: MAIN__ (hjhjff.f90:47)
==19540== by 0x40087F: main (hjhjff.f90:44)
Line 29 is:
if (associated(dum%my_data%head)) then
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51435] [4.6/4.7 Regression] Bad association status after null() of derived type component
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
2011-12-06 10:08 ` [Bug fortran/51435] [4.6/4.7 Regression] " burnus at gcc dot gnu.org
@ 2011-12-06 10:34 ` burnus at gcc dot gnu.org
2011-12-06 13:08 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-06 10:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-06 10:33:57 UTC ---
Lightly tested patch:
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3733,17 +3733,14 @@ gfc_has_default_initializer (gfc_symbol *der)
if (c->ts.type == BT_DERIVED)
{
if (!c->attr.pointer
&& gfc_has_default_initializer (c->ts.u.derived))
return true;
}
- else
- {
- if (c->initializer)
- return true;
- }
+ if (c->initializer)
+ return true;
return false;
}
/* Get an expression for a default initializer. */
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51435] [4.6/4.7 Regression] Bad association status after null() of derived type component
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
2011-12-06 10:08 ` [Bug fortran/51435] [4.6/4.7 Regression] " burnus at gcc dot gnu.org
2011-12-06 10:34 ` burnus at gcc dot gnu.org
@ 2011-12-06 13:08 ` jakub at gcc dot gnu.org
2011-12-06 14:01 ` dominiq at lps dot ens.fr
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-06 13:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
CC| |jakub at gcc dot gnu.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51435] [4.6/4.7 Regression] Bad association status after null() of derived type component
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
` (2 preceding siblings ...)
2011-12-06 13:08 ` jakub at gcc dot gnu.org
@ 2011-12-06 14:01 ` dominiq at lps dot ens.fr
2011-12-06 18:10 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-12-06 14:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-12-06
Ever Confirmed|0 |1
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-12-06 13:59:21 UTC ---
On x86_64-apple-darwin10, the test always gives
do_job my_data%head is NOT associated
but valgrind complains as in comment #1.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51435] [4.6/4.7 Regression] Bad association status after null() of derived type component
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
` (3 preceding siblings ...)
2011-12-06 14:01 ` dominiq at lps dot ens.fr
@ 2011-12-06 18:10 ` burnus at gcc dot gnu.org
2011-12-06 19:27 ` burnus at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-06 18:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-06 18:10:11 UTC ---
Author: burnus
Date: Tue Dec 6 18:10:01 2011
New Revision: 182059
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182059
Log:
2011-12-06 Tobias Burnus <burnus@net-b.de>
PR fortran/51435
* expr.c (gfc_has_default_initializer): Fix handling of
DT with initialized pointer components.
2011-12-06 Tobias Burnus <burnus@net-b.de>
PR fortran/51435
* gfortran.dg/default_initialization_5.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/default_initialization_5.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51435] [4.6/4.7 Regression] Bad association status after null() of derived type component
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
` (4 preceding siblings ...)
2011-12-06 18:10 ` burnus at gcc dot gnu.org
@ 2011-12-06 19:27 ` burnus at gcc dot gnu.org
2011-12-06 19:30 ` burnus at gcc dot gnu.org
2011-12-20 18:06 ` burnus at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-06 19:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-06 19:26:48 UTC ---
Author: burnus
Date: Tue Dec 6 19:26:44 2011
New Revision: 182062
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182062
Log:
2011-12-06 Tobias Burnus <burnus@net-b.de>
PR fortran/51435
* expr.c (gfc_has_default_initializer): Fix handling of
DT with initialized pointer components.
2011-12-06 Tobias Burnus <burnus@net-b.de>
PR fortran/51435
* gfortran.dg/default_initialization_5.f90: New.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/default_initialization_5.f90
Modified:
branches/gcc-4_6-branch/gcc/fortran/ChangeLog
branches/gcc-4_6-branch/gcc/fortran/expr.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51435] [4.6/4.7 Regression] Bad association status after null() of derived type component
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
` (5 preceding siblings ...)
2011-12-06 19:27 ` burnus at gcc dot gnu.org
@ 2011-12-06 19:30 ` burnus at gcc dot gnu.org
2011-12-20 18:06 ` burnus at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-06 19:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-06 19:28:32 UTC ---
FIXED on the trunk (4.7) and on the 4.6 branch.
Thanks for the report!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/51435] [4.6/4.7 Regression] Bad association status after null() of derived type component
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
` (6 preceding siblings ...)
2011-12-06 19:30 ` burnus at gcc dot gnu.org
@ 2011-12-20 18:06 ` burnus at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-20 18:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51435
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jonathan.hogg at stfc dot
| |ac.uk
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-20 17:43:43 UTC ---
*** Bug 51639 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-12-20 17:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-06 9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
2011-12-06 10:08 ` [Bug fortran/51435] [4.6/4.7 Regression] " burnus at gcc dot gnu.org
2011-12-06 10:34 ` burnus at gcc dot gnu.org
2011-12-06 13:08 ` jakub at gcc dot gnu.org
2011-12-06 14:01 ` dominiq at lps dot ens.fr
2011-12-06 18:10 ` burnus at gcc dot gnu.org
2011-12-06 19:27 ` burnus at gcc dot gnu.org
2011-12-06 19:30 ` burnus at gcc dot gnu.org
2011-12-20 18:06 ` burnus at gcc dot gnu.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).