bugGNU roff - Bugs: bug #60398, [mm] initialize two string array...

 
 

bug #60398: [mm] initialize two string array elements let*ia-{name,title}!n to avoid warnings

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Wed 14 Apr 2021 10:37:36 PM UTC
   
 
Category:  Macro mm Severity:  2 - Minor
Item Group:  Warning/Suspicious behaviour Status:  Invalid
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 04 Oct 2022 08:19:41 AM UTC, comment #1: 

You haven't identified any input that would produce the warnings.

In other words, you haven't established that there exists an execution trace wherein uninitialized strings are dereferenced.

A simple experiment shows that an mm letter can be composed without either writer's or inside address data, without producing diagnostics.


$ printf '.LT\n.P\nHello.\n' | nroff -ww -mm 2>&1 >/dev/null | grep . || echo EMPTY
EMPTY


(This is with groff 1.22.4.)

Further, we can also see that these strings are dereferenced only within while loops that are not entered if the quantity of such addresses is zero.


...
3318 .\"------------------------
3319 .de let*lt-sign
...
3322 .nr let*i 0 1
3323 .nr let*j 0
3324 .while \\n+[let*i]<=\\n[let*wa-n] \{\
3325 .if \\n[let*i]=\\n[let*wa-n] .nr let*j 1
3326 .let@sg_\\*[let*type] "\\*[let*wa-name!\\n[let*i]]" "\\*[let*wa-title!\\n[let*i]]" \\n[let*i] \\n[let*j] \\$@
3327 .\}

3480 .\" Print the letter-head
3481 .de let@print-head
...
3507 .nr let*i 0 1
3508 .while \\n+[let*i]<=\\n[let*ia-n] \{\
3509 \\*[let*ia-name!\\n[let*i]]
3510 \\*[let*ia-title!\\n[let*i]]
3511 .\}
...
3539 .\"-------------------
3540 .\" .IA [name [title]]
3541 .nr let*ia-n 0 1
3542 .de IA
3543 .if \\n[.$] .ds let*ia-name!\\n+[let*ia-n] \\$1
3544 .if \\n[.$]>1 .ds let*ia-title!\\n[let*ia-n] \\$2
3545 .ev let@ev
3546 .init@reset
3547 'nf
3548 .di let@ia-div
3549 .eo
3550 ..
...
3556 .\"-------------------
3557 .\" .WA [name [title]]
3558 .nr let*wa-n 0 1
3559 .de WA
3560 .if \\n[.$] .ds let*wa-name!\\n+[let*wa-n] \\$1
3561 .if \\n[.$]>1 .ds let*wa-title!\\n[let*wa-n] \\$2
3562 .ev let@ev
3563 .init@reset
3564 'nf
3565 .di let@wa-div
3566 .it \\n[Letwam] let@wa-drain
3567 .eo
3568 ..


Removing patch annotation.  Closing as invalid.

If you can come up with an input document that provokes diagnostics due to errors in the macro package, please do so.  The problem must be clearly demonstrated before a patch can be appropriate.

G. Branden Robinson <gbranden>
Group administrator
Wed 14 Apr 2021 10:37:36 PM UTC, original submission:  

From 07581b1ca7431f4a4ca7c2f57b5abd1fc409a9d1 Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Wed, 14 Apr 2021 22:33:45 +0000
Subject: [PATCH] contrib/mm/m.tmac: initialize two strings "let*..." to avoid
 warnings

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 contrib/mm/m.tmac | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index bc9dcddf..1540568e 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -3500,7 +3500,9 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
 .\" .IA [name [title]]
 .nr let*ia-n 0 1
 .de IA
-.if \\n[.$] .ds let*ia-name!\\n+[let*ia-n] \\$1
+.ds let*ia-name!\\n+[let*ia-n]\" initialize to avoid warnings
+.ds let*ia-title!\\n[let*ia-n]\" ditto
+.if \\n[.$] .ds let*ia-name!\\n[let*ia-n] \\$1
 .if \\n[.$]>1 .ds let*ia-title!\\n[let*ia-n] \\$2
 .ev let@ev
 .init@reset
@@ -3517,7 +3519,9 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
 .\" .WA [name [title]]
 .nr let*wa-n 0 1
 .de WA
-.if \\n[.$] .ds let*wa-name!\\n+[let*wa-n] \\$1
+.ds let*wa-name!\\n+[let*wa-n]\" initialize to avoid a warning
+.ds let*wa-title!\\n[let*wa-n]\" ditto
+.if \\n[.$] .ds let*wa-name!\\n[let*wa-n] \\$1
 .if \\n[.$]>1 .ds let*wa-title!\\n[let*wa-n] \\$2
 .ev let@ev
 .init@reset
--
2.30.2


Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Updated the item)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-04 gbranden StatusNone Invalid
        Assigned toNone gbranden
        Open/ClosedOpen Closed
        Summary[PATCH] [mm] initialize two string array elements let*ia-{name,title}!n to avoid warnings [mm] initialize two string array elements let*ia-{name,title}!n to avoid warnings
    2021-05-30 gbranden Severity3 - Normal 2 - Minor
        Summary[PATCH] contrib/mm/m.tmac: initialize two strings &quot;let*...&quot; to avoid warnings [PATCH] [mm] initialize two string array elements let*ia-{name,title}!n to avoid warnings

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code