https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122433

--- Comment #2 from kargls at comcast dot net ---
(In reply to kargls from comment #1)
> 
> If I change this to 'if (line(len(line):) == ",") stop 1', the code
> compiles.  I suspect you also tried
> 
>          if (line(len(line):) == ",") then
>            neuron%next = from_json(neuron_lines, start+4)
>          end if
> 
> which leads to 
> 
> % gfcx -c a.f90
> a.f90:26:24:
> 
>    26 |             neuron%next = from_json(neuron_lines, start+4)
>       |                        1
> Error: 'next' at (1) is not a member of the 'Pdtneuron_t_4' structure
> 

Running the testcase with the above change under gdb 
shows (note, I needed to use a volatile because sym
is optimized out).

(gdb) b symbol.cc:2635
(gdb) p vsym
$1 = (volatile gfc_symbol *) 0x804243380
(gdb) call debug(vsym)
|| symbol: 'Pdtneuron_t_4' 
  type spec : (DERIVED Pdtneuron_t_4)
  attributes: (DERIVED  PDT-TYPE)
  components: 
  (k (INTEGER 4) KIND ()) 
  (bias_ (REAL 4) ())

  Procedure bindings:
  Operator bindings:

Sure enough, next is not found!

(gdb) p vsym->components->name
$12 = 0x804bfc220 "k"
(gdb) p vsym->components->next->name
$13 = 0x804bfc238 "bias_"
(gdb) p vsym->components->next->next
$14 = (gfc_component *) 0x0

(gdb) p vsym->ts.u.derived->components->name
$16 = 0x804bfc220 "k"
(gdb) p vsym->ts.u.derived->components->next->name
$17 = 0x804bfc238 "bias_"
(gdb) p vsym->ts.u.derived->components->next->next
$18 = (gfc_component *) 0x0

So, it seems the recursive parameterized derived type is the issue.

Reply via email to