This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/58754] ICE/Regression in [4.7/4.8/4.9] with allocatable character arrays
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Oct 2013 21:01:39 +0000
- Subject: [Bug fortran/58754] ICE/Regression in [4.7/4.8/4.9] with allocatable character arrays
- Auto-submitted: auto-generated
- References: <bug-58754-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58754
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-10-16
CC| |burnus at gcc dot gnu.org
Known to work| |4.6.3
Depends on| |57456
Ever confirmed|0 |1
Known to fail| |4.7.3, 4.8.1, 4.9.0
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The segfault occurs for trans-array.c's gfc_array_init_size:
5064 if (expr3_elem_size != NULL_TREE)
5065 tmp = expr3_elem_size;
5066 else if (expr3 != NULL)
5067 {
...
5089 tmp = TYPE_SIZE_UNIT (gfc_get_element_type (type));
5092 element_size = fold_convert (size_type_node, tmp);
And here tmp == NULL. I think the problem is that characters have to be handled
separately.
There should be somewhere a PR which is about moving all the memory size
calculation to gfc_trans_allocate - which already does it for scalars - instead
of partially repeating it in gfc_array_init_size. (The current algorithm might
also cause multiple function evaluation, which is wrong, too.)
I believe unifying the could would be the proper fix (and good in terms of code
size/maintenance as well). -- The PR I meant is: PR57456.