Subject: Purify UMR in menu code

From: Dan Espen <[email-masked]>
Date: Tue, 16 Mar 1999 17:27:53 -0500

Purify also complains that line 701 in misc.c is referencing
uninitialized data.  I think it may be right:

misc.c 701 :  if (!pops->flags.f.has_poshints && fValidPosHints) {

Declaration of "pops" as "mops" in builtins.c line 994:

  MenuOptions mops;

Initialization at line 998:

  mops.flags.allflags = 0;

Wouldn't:

memset(mops, 0, sizeof(mops);

be the way to go?

I don't have any symptom to relate this to.

-- 
Dan Espen
444 Hoes Lane  Room RRC 1C-214             E-mail: [email-masked]
Piscataway, NJ 08854                       Phone: (732) 699-5570
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 17 Mar 1999 07:05:10 +0100

> memset(mops, 0, sizeof(mops);

No. The problem lies within GetMenuOptions itself. The flags variable
is only initialised if action != NULL (lines 547 and 550):

-->  while (action != NULL) {
       /* ^ just to be able to jump to end of loop without 'goto' */
       gflags = NoValue;
-->    pops->flags.allflags = 0;

This has to be copied to the line before the loop:

-->  pops->flags.allflags = 0;
     while (action != NULL) {
       /* ^ just to be able to jump to end of loop without 'goto' */
       gflags = NoValue;
       pops->flags.allflags = 0;

Could you apply and test this?

Bye

Dominik

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Dan Espen <[email-masked]>
Date: Wed, 17 Mar 1999 08:17:50 -0500

> Could you apply and test this?

After applying this, I get the same UMRs.

I'm still not looking closely, but isn't "pops->flags.allflags"
a different area than "pops->flags.f.has_poshints" which is the
area Purify is complaining about?  Note that "allflags"
is initialized in the calling routine.

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 17 Mar 1999 15:18:44 +0100

On Wed, Mar 17, 1999 at 08:17:50AM -0500, Dan Espen wrote:
> area Purify is complaining about?

No, it's a union. I'll have to take a closer look at home.

Bye

Dominik

---

From: Dominik Vogt <[email-masked]>
Date: Sun, 21 Mar 1999 22:47:24 +0100

> No, it's a union. I'll have to take a closer look at home.

Purify is probably complaining because the other half of the union
has been initialised, but not the flag itself. I've tried to fix
that. Could you check that again, Dan?

Bye

Dominik

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Dan Espen <[email-masked]>
Date: Mon, 22 Mar 1999 14:13:49 -0500

> that. Could you check that again, Dan?

Right now  fvwm2 is hanging  in "Recapture()" while run  under Purify,
but before I figure out why, there is a new UMR to report:

This is in Parse.c function GetSuffixedIntegerArguments(), line 438.

Looks to me like the correct fix is:

  if (suffixlist)                                        <-- Remove this?
    suffixes = (suffixlist != NULL) ? strlen(suffixlist) : 0;
  for (i = 0; i < num && action; i++)
  {
    action = GetNextToken(action, &token);
    if (token == NULL)
      break;
    if (sscanf(token, "%d", &(retvals[i])) != 1)
      break;
    if (suffixes != 0 && ret_suffixnum != NULL)          <-- Line 438

Is it only me that would prefer:

suffixes = 0;
if (suffixlist != 0) {
  suffixes = strlen(suffixlist);
}

Just curious.

I haven't studied the entire function, but I can report that the above
change cures the UMR.

Once I figure out the reason for the hang, I should be able to check
out the menu code...

---

From: Dan Espen <[email-masked]>
Date: Mon, 22 Mar 1999 14:37:53 -0500

> that. Could you check that again, Dan?

Purify still complains about a UMR on the same line.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 22 Mar 1999 23:40:52 +0100

> Purify still complains about a UMR on the same line.

Hrm. I'm out of ideas.

Bye

Dominik ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 22 Mar 1999 23:52:26 +0100

> > Purify still complains about a UMR on the same line.

Oops, I was looking at the wrong line all the time. I've committed
another patch.

Bye

Dominik ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 22 Mar 1999 23:46:20 +0100

>   suffixes = strlen(suffixlist);

I like the '?' operator if the result fits on a single line.
The UMR was caused by rewriting the if condition to '?' syntax.
I forgot to delete the if statement. Dan, could you apply this
fix?

Bye

Dominik ^_^

---

From: Dan Espen <[email-masked]>
Date: Tue, 23 Mar 1999 08:41:07 -0500

> I forgot to delete the if statement. Dan, could you apply this

Done.  Sorry for all the "commit" mail, I'm not getting along with
PCL-CVS very well.