This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/40440] [4.4/4.5 Regression] Garbage or segmentation fault in allocatable array derived type structures
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jun 2009 12:16:48 -0000
- Subject: [Bug fortran/40440] [4.4/4.5 Regression] Garbage or segmentation fault in allocatable array derived type structures
- References: <bug-40440-15192@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from burnus at gcc dot gnu dot org 2009-06-15 12:16 -------
Note: syntax_get_rule_ptr is defined as:
function syntax_get_rule_ptr (syntax, key) result (rule)
type(syntax_rule_t), pointer :: rule
type(syntax_t), intent(in), target :: syntax
type(string_t), intent(in) :: key
and "syntax_rule_set_sub" is defined as follows where "sub" is the relevant
argument:
subroutine syntax_rule_set_sub (rule, i, sub)
type(syntax_rule_t), intent(inout) :: rule
integer, intent(in) :: i
type(syntax_rule_t), intent(in), target :: sub
If one looks at the dump for the following line in set_rule_contents
call syntax_rule_set_sub (rule, i, syntax_get_rule_ptr (syntax, &
lexeme_get_contents (lexeme(i+3))))
one finds:
integer(kind=8) S.297;
struct varying_string D.6550;
D.6550 = lexeme_get_contents (&(*lexeme)[(integer(kind=8)) (i + 3) + -1]);
syntax_rule_set_sub ((struct syntax_rule_t *) rule, &i,
syntax_get_rule_ptr ((struct syntax_t *) syntax, &D.6550));
which looks OK. But then it continues:
if (syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->keyword.chars.data != 0B)
__builtin_free (syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->keyword.chars.data);
syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->keyword.chars.data = 0B;
if (syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->separator.chars.data != 0B)
__builtin_free (syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->separator.chars.data);
syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->separator.chars.data = 0B;
S.297 = 0;
while (1)
{
if (S.297 > 1) goto L.27;
if (syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->delimiter[S.297].chars.data != 0B)
__builtin_free (syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->delimiter[S.297].chars.data);
syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->delimiter[S.297].chars.data = 0B;
S.297 = S.297 + 1;
}
L.27:;
if (syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->child.data != 0B)
__builtin_free (syntax_get_rule_ptr ((struct syntax_t *) syntax,
&D.6550)->child.data);
syntax_get_rule_ptr ((struct syntax_t *) syntax, &D.6550)->child.data = 0B;
if (D.6550.chars.data != 0B)
__builtin_free (D.6550.chars.data);
D.6550.chars.data = 0B;
Thus the problem seems to be that "syntax_get_rule_ptr" is treated as variable
and not as function call.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40440