Hi Mikael,
On 7/18/2025 3:26 PM, Mikael Morin wrote:
Le 17/07/2025 à 15:58, Yuao Ma a écrit :
Hi Mikael,
On 7/17/2025 3:47 PM, Mikael Morin wrote:
How did you declare gfor_fndecl_string_split?
More exactly what is the declaration type for the POS argument?
For the POS argument type, I'm using
build_pointer_type(gfc_charlen_type_node). I got this from
string_minmax, but I'm unsure if it's the right fit here.
It makes sense to use that type, but then the argument passed to the
function should have the same type, or at least the same type size.
gfc_charlen_type_node is probably 8 bytes long, whereas the default
integer passed to it is only 4 bytes long.
Also, I'm encountering an issue with pointer declarations. I've found
two methods: gfc_build_addr_expr and se.want_pointer. Are these the
same, or do they have different uses? I've tried both, and they give
me the same errors in my tests.
gfc_build_addr_expr is maybe a bit more low level. See at the end of
gfc_conv_variable, if se.want_pointer is set, we use
gfc_build_addr_expr. You can also use gfc_conv_expr_reference, which
uses either of them depending on the case.
Thanks so much for your suggestions! They are really helpful.
I noticed that hex(16128084538487209988) evaluates to
0xdfd2777000000004, and it looks like the higher bits weren't being
zeroed out as expected. After I explicitly added pos =
convert(gfc_charlen_type_node, pos); for type conversion, the test case
started working perfectly.
Thanks,
Yuao