diff mbox series

[Committed] Update Fortran expression dumper for BT_BOZ

Message ID 20191023233402.GA79990@troutmask.apl.washington.edu
State New
Headers show
Series [Committed] Update Fortran expression dumper for BT_BOZ | expand

Commit Message

Steve Kargl Oct. 23, 2019, 11:34 p.m. UTC
The attached and committed patch updates gfortran 
expression dumper to do something sensible with a
gfc_expr that is a BT_BOZ basic type.  That is, for

program a
   real :: x = real(b'10101')
   real :: y = real(o'4444')
   real :: z = real(z'abcd')
   print *, x, y, z
end program a

if one is in gdb, you now get (in gfc_boz2real).

(gdb) call debug(x)
b'10101' (BOZ 0)
 
(gdb) call debug(x)
o'4444' (BOZ 0)

(gdb) call debug(x)
z'abcd' (BOZ 0)

2019-10-23  Steven G. Kargl  <kargl@gcc.gnu.org>

 dump-parse-tree.c (show_expr): Add dumping of BT_BOZ constants.
diff mbox series

Patch

Index: gcc/fortran/dump-parse-tree.c
===================================================================
--- gcc/fortran/dump-parse-tree.c	(revision 277296)
+++ gcc/fortran/dump-parse-tree.c	(working copy)
@@ -559,6 +559,16 @@  show_expr (gfc_expr *p)
 	  fputc (')', dumpfile);
 	  break;
 
+	case BT_BOZ:
+	  if (p->boz.rdx == 2)
+	    fputs ("b'", dumpfile);
+	  else if (p->boz.rdx == 8)
+	    fputs ("o'", dumpfile);
+	  else
+	    fputs ("z'", dumpfile);
+	  fprintf (dumpfile, "%s'", p->boz.str);
+	  break;
+
 	case BT_HOLLERITH:
 	  fprintf (dumpfile, HOST_WIDE_INT_PRINT_DEC "H",
 		   p->representation.length);