How do I print the name of a variable created with create_tmp_var_raw

Thomas Koenig tkoenig@netcologne.de
Tue Dec 8 20:39:26 GMT 2020


Hi Tobias,

> On 08.12.20 19:34, Thomas Koenig via Fortran wrote:
>> I would like to know the name of a variable created with
>> create_tmp_var_raw, but it is not clear to my how to do it.
>> ...
>>    t = create_tmp_var_raw (type, prefix);
>> -
>> +  dprintf (2, "%s\n", IDENTIFIER_POINTER (DECL_NAME (t)));
> 
> I think that's okay. However:
> 
> Do you have a prefix or not?
> 
> If there is no prefix, DECL_NAME (t) == NULL.
> 
> If there is a prefix, the name is create_tmp_var_name (prefix),
> which is (on most systems)   "%s.%d", prefix, tmp_var_id_num++
> 
> Otherwise, the D.1234 you see in the dump is mostly the result of
> "D.%u", DECL_UID (t).

Yes, this clears up things.  Thanks!

I am currently trying to figure out better ways of debugging
generated code (PR 90207) and one thing is to make intermediate
variables visible to the debugger, of course under control of
a special flag.  The dot is of course not a good choice beause
gdb will not print a variable called S.0, but maybe a @ will work.

Or, less amitious, sometimes it is hard to see by which path a
certain variable is generated. Being able to set a breakpoint
where a certain variable is being generated can help a lot.

Best regards

	Thomas


More information about the Fortran mailing list