public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57079] New: [Fortran-dev] version/type/attribute fields not set with CLASS components
@ 2013-04-26 7:37 burnus at gcc dot gnu.org
2013-04-26 7:46 ` [Bug fortran/57079] " burnus at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-26 7:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57079
Bug #: 57079
Summary: [Fortran-dev] version/type/attribute fields not set
with CLASS components
Classification: Unclassified
Product: gcc
Version: fortran-dev
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: pault@gcc.gnu.org
Blocks: 56818
The following test case shows that the version etc. field is not properly set
for:
subroutine foo()
type t2
end type t2
type t
integer, allocatable :: x(:)
class(t2), allocatable :: y(:)
integer :: z = 55
end type t
type(t), allocatable :: x!(:)
allocate(x)
end
I wrote that it is a CLASS problem, but it might also affect other allocatable
components if there is a default initializer.
The problem is that the following code is generated, i.e. the initialization is
overridden. The additional issue is that there is a missed optimization
(setting the same value multiple times) - which should be avoided if possible.
There might be also other cases, where the fields aren't properly set.
x = (struct t *) __builtin_malloc (128);
...
x->x.base_addr = 0B;
x->x.version = 1;
...
x->y._data.base_addr = 0B;
x->y._data.version = 1;
...
{
struct t t.0;
if (x != 0B) goto L.1;
x = (struct t *) __builtin_calloc (1, 128);
L.1:;
t.0.x.base_addr = 0B;
t.0.y._data.base_addr = 0B;
t.0.y._vptr = (struct __vtype_foo_T2 * {ref-all}) &__vtab_foo_T2;
t.0.z = 55;
*x = t.0;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/57079] [Fortran-dev] version/type/attribute fields not set with CLASS components
2013-04-26 7:37 [Bug fortran/57079] New: [Fortran-dev] version/type/attribute fields not set with CLASS components burnus at gcc dot gnu.org
@ 2013-04-26 7:46 ` burnus at gcc dot gnu.org
2014-03-22 19:17 ` dominiq at lps dot ens.fr
2021-12-18 2:37 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-26 7:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57079
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-26 07:46:41 UTC ---
(In reply to comment #0)
> There might be also other cases, where the fields aren't properly set.
In particular, I think, one should check:
- ALLOCATE with SOURCE=
- CLASS(*) - also as DT component
- Pointer assignment "=>" - especially with CLASS(dt)/CLASS(*)
On the other hand, some values are currently reseted but should have the same
value, e.g. "type" is set at declaration time (or for components: when the
encompassing DT is allocated). In that case, the only case where "type" has to
be set is for CLASS(*) [type = other vs. type = <intrinsic type>] and in case
of "elem_len" for CLASS(dt)/CLASS(*).
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/57079] [Fortran-dev] version/type/attribute fields not set with CLASS components
2013-04-26 7:37 [Bug fortran/57079] New: [Fortran-dev] version/type/attribute fields not set with CLASS components burnus at gcc dot gnu.org
2013-04-26 7:46 ` [Bug fortran/57079] " burnus at gcc dot gnu.org
@ 2014-03-22 19:17 ` dominiq at lps dot ens.fr
2021-12-18 2:37 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-22 19:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57079
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2014-03-22
Ever confirmed|0 |1
--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
What is the problem with this pr? The difference between the dump with trunk
(r208766) and the dev branch (r208422) is
--- pr57079.f90.003t.original 2014-03-22 20:11:30.000000000 +0100
+++ pr57079.f90_dev.003t.original 2014-03-22 20:10:59.000000000 +0100
@@ -14,28 +14,38 @@ foo ()
try
{
x = 0B;
- if (x != 0B)
+ if ((logical(kind=4)) __builtin_expect ((integer(kind=8)) (x != 0B), 0))
{
_gfortran_runtime_error_at (&"At line 10 of file pr57079.f90"[1]{lb:
1 sz: 1}, &"Attempting to allocate already allocated variable \'%s\'"[1]{lb: 1
sz: 1}, &"x"[1]{lb: 1 sz: 1});
}
else
{
- x = (struct t *) __builtin_malloc (112);
- if (x == 0B)
+ x = (struct t *) __builtin_malloc (128);
+ if ((logical(kind=4)) __builtin_expect ((integer(kind=8)) (x == 0B),
0))
{
_gfortran_os_error (&"Allocation would exceed memory
limit"[1]{lb: 1 sz: 1});
}
}
- x->x.data = 0B;
- x->y._data.data = 0B;
+ x->x.base_addr = 0B;
+ x->x.elem_len = 4;
+ x->x.version = 1;
+ x->x.rank = 1;
+ x->x.type = 1025;
+ x->x.attribute = 2;
+ x->y._data.base_addr = 0B;
+ x->y._data.elem_len = 0;
+ x->y._data.version = 1;
+ x->y._data.rank = 1;
+ x->y._data.type = -1;
+ x->y._data.attribute = 1;
{
struct t t.0;
if (x != 0B) goto L.1;
- x = (struct t *) __builtin_calloc (1, 112);
+ x = (struct t *) __builtin_calloc (1, 128);
L.1:;
- t.0.x.data = 0B;
- t.0.y._data.data = 0B;
+ t.0.x.base_addr = 0B;
+ t.0.y._data.base_addr = 0B;
t.0.y._vptr = (struct __vtype_foo_T2 * {ref-all}) &__vtab_foo_T2;
t.0.z = 55;
*x = t.0;
@@ -45,20 +55,20 @@ foo ()
{
if (x != 0B)
{
- if (x->x.data != 0B)
+ if (x->x.base_addr != 0B)
{
- __builtin_free ((void *) x->x.data);
+ __builtin_free ((void *) x->x.base_addr);
}
- x->x.data = 0B;
- if ((struct t2[0:] * restrict) x->y._data.data != 0B &&
x->y._vptr->_final != 0B)
+ x->x.base_addr = 0B;
+ if ((struct t2[0:] * restrict) x->y._data.base_addr != 0B &&
x->y._vptr->_final != 0B)
{
x->y._vptr->_final (&x->y._data, (integer(kind=8))
x->y._vptr->_size, 1);
}
- if (x->y._data.data != 0B)
+ if (x->y._data.base_addr != 0B)
{
- __builtin_free ((void *) x->y._data.data);
+ __builtin_free ((void *) x->y._data.base_addr);
}
- x->y._data.data = 0B;
+ x->y._data.base_addr = 0B;
__builtin_free ((void *) x);
}
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/57079] [Fortran-dev] version/type/attribute fields not set with CLASS components
2013-04-26 7:37 [Bug fortran/57079] New: [Fortran-dev] version/type/attribute fields not set with CLASS components burnus at gcc dot gnu.org
2013-04-26 7:46 ` [Bug fortran/57079] " burnus at gcc dot gnu.org
2014-03-22 19:17 ` dominiq at lps dot ens.fr
@ 2021-12-18 2:37 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-18 2:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57079
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Something changed in GCC 8 and we get:
<bb 4> :
x_22 = __builtin_malloc (144);
if (x_22 == 0B)
goto <bb 5>; [INV]
else
goto <bb 6>; [INV]
<bb 5> :
_gfortran_os_error (&"Allocation would exceed memory limit"[1]{lb: 1 sz: 1});
...
And no more __builtin_calloc either.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-18 2:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-26 7:37 [Bug fortran/57079] New: [Fortran-dev] version/type/attribute fields not set with CLASS components burnus at gcc dot gnu.org
2013-04-26 7:46 ` [Bug fortran/57079] " burnus at gcc dot gnu.org
2014-03-22 19:17 ` dominiq at lps dot ens.fr
2021-12-18 2:37 ` pinskia 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).