Follow-up Comment #31, bug #64421 (project groff):

Hi Peter,

I instrumented _mom_ with the following diff.


diff --git a/contrib/mom/om.tmac b/contrib/mom/om.tmac
index b0fd1ef55..2a34ba0f2 100644
--- a/contrib/mom/om.tmac
+++ b/contrib/mom/om.tmac
@@ -1871,11 +1871,13 @@ end
 \#   as a macro.
 \#
 .MAC COLOR END
+.    tm GBR: COLOR: $1=\\$1, .u=\\n[.u]
 .    ie \\n[.u]=1 \{\
 \c
 \\*[\\$1]\c
 .    \}
-.    el \\*[\\$1]
+.    el \X'x GBR COLOR: debug marker 1 $1=\\$1
\\\\*[default]=\\*[default]'\\*[\\$1]\X'x GBR COLOR: debug marker 2'
+.\"  device x GBR COLOR: debug marker 2
 .END
 \#
 \# NEWCOLOR
@@ -2854,7 +2856,10 @@ end
 .    di NULL
 .       if \\n[#NUM_ARGS]>=1 .RULE_WEIGHT \\*[$RL_WEIGHT]
 .    di
+.    device x GBR DRH: debug marker 1
 .    COLOR \\*[$RL_COLOR]
+.    device x GBR DRH: debug marker 2
+.\"  device x GBR debug marker 2
 .    ie \\n[#NUM_ARGS]=0 \{\
 .       ie \\n[#INDENT_ACTIVE] \{\
 .          nr #RESTORE_L_LENGTH \\n[.l]


I ran "./build/test-groff -Z -m om -T pdf", pasted in all but the last of
Günther's original reproducer except for the last line, then, typed the last
(".DRH") by hand; that's where all the trouble seems to come in.

Here's (the end of) what I got with the buggy, `-flto=auto` version.


.DRH
GBR: COLOR: $1=default, .u=0
V78000
H81000
V78000
H81000
x X x GBR DRH: debug marker 1
V78000
H81000
x X x GBR COLOR: debug marker 1 $1=default \*[default]=black
tblack
V78000
H106992
x X x GBR COLOR: debug marker 2
n13571 0
V91571
H81000
V91571
H81000
x X x GBR DRH: debug marker 2
Dt 500 0
H81250
v250
Dl 433000 0
V91321
Dt 0 0
n13571 0


Here's what I get with a "good" _troff_, "groff -M ./contrib/mom -Z -m om -T
pdf".


.DRH
GBR: COLOR: $1=black, .u=0
V78000
H81000
V78000
H81000
x X x GBR DRH: debug marker 1
V78000
H81000
x X x GBR COLOR: debug marker 1 $1=black \*[default]=black
V78000
H81000
mr 0 0 0
x X x GBR COLOR: debug marker 2
n13571 0
V91571
H81000
V91571
H81000
x X x GBR DRH: debug marker 2
Dt 500 0
H81250
v250
Dl 433000 0
V91321
Dt 0 0
n13571 0


Here's a diff.


$ diff -u GOOD BAD
--- GOOD        2023-09-05 23:01:56.074166418 -0500
+++ BAD 2023-09-05 23:02:09.510125214 -0500
@@ -1,5 +1,5 @@
 .DRH
-GBR: COLOR: $1=black, .u=0
+GBR: COLOR: $1=default, .u=0
 V78000
 H81000
 V78000
@@ -7,10 +7,10 @@
 x X x GBR DRH: debug marker 1
 V78000
 H81000
-x X x GBR COLOR: debug marker 1 $1=black \*[default]=black
+x X x GBR COLOR: debug marker 1 $1=default \*[default]=black
+tblack
 V78000
-H81000
-mr 0 0 0
+H106992
 x X x GBR COLOR: debug marker 2
 n13571 0
 V91571


The really suspicious thing here is how the `COLOR` macro is getting passed a
"black" argument in one case and a "default" one in the other, with only
link-time optimization making the difference.

I double checked and `DRH` definitely does not think it is getting passed any
arguments.


@@ -2840,6 +2842,7 @@ end
 \#   rule), the rule weight is the one set by RULE_WEIGHT.
 \#
 .MAC DRH END
+.    device x GBR DRH: args: $1=\\$1, $2=\\$2, $3=\\$3, $4=\\$4
 .    GRAPHICAL_OBJ
 .    ds $RL_WEIGHT \\$1
 .    ds $RL_INDENT \\$2


(I could just have easily used `tm` here instead of the excessively clever
`device x` request.  I was getting tired and copy-and-paste-happy.)

So the quest now is to see how the string `$RL_COLOR` is getting initialized.

Checkpointing here.  Might go to bed soon.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64421>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/


Reply via email to