Hello world,

having recently had the occasion to look at -fdump-fortran-original
dumps, I found them to be quite hard to read, the same goes for
"call debug(expr)" in the debugger. A line like

ASSIGN reallocation_bug:y((+ block@1:__var_2_do 1_8)) (+ reallocation_bug:y((+ block@1:__var_2_do 1_8)) (* reallocation_bug:a((+ block@1:__var_2_do 1_8) , (+ block@1:__var_1_do 1_8)) reallocation_bug:x((+ block@1:__var_1_do 1_8))))

takes quite some counting of parentheses to decipher.

I see two possibilities there. One would be to write a script that
takes the output from -fdump-fortran-original and rewrites it
in infix notation (at least the code sections). This would be
possible, but would be unstable because we do not guarantee the
output format, and would not help with the debugger output.

The other possibility would be to write additional functions
in dump-parse-tree.cc which transfer things into infix
notation, to be output with a separate flag, and to also
(optionally) use that for debugging, at least for code.
The output need not be compilable, but it should be
readable by a human.

I also would not mind having a + b + c being displayed
as (a + b) + c (and namespace names could also be dropped).

So, the line above would then read something like

y(__var_2_do + 1_8) = y(__var_2_do + 1_8) + (a(__var_2_do + 1, __var_1_do + 1) * b(__var_a_do + 1))

which I think is easier.

What do you think, would this be useful?

Best regards

        Thomas




Reply via email to