Subject: purify/menu test

From: Dominik Vogt <[email-masked]>
Date: Sun, 11 Feb 2001 15:36:01 +0100

Dan, could you run purify with the menu test I wrote recently?
The instructions and the tests are in tests/menus/.

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: Sun, 11 Feb 2001 14:41:55 -0500

> The instructions and the tests are in tests/menus/.

Looks pretty good to me.  Some of this is X.
UMRs by themselves are not really a problem,
its only if you use the uninitialized data.

Since I'm having attachment problems, here it is:

[FVWM][Echo]:  ***
[FVWM][Echo]:  *** VERTICAL LAYOUT TESTS ***
[FVWM][Echo]:  ***
[FVWM][Echo]:  bw 50, ht 50
[FVWM][Echo]:  bw 1, hthin
[FVWM][Echo]:  bw 0, hoff
[FVWM][Echo]:  bw 2, hhick
[FVWM][Echo]:  bw -1, ht -10
[FVWM][Echo]:  separatorslong
[FVWM][Echo]:  separatorsshort
[FVWM][Echo]:  titleunderlines0
[FVWM][Echo]:  titleunderlines1
[FVWM][Echo]:  titleunderlines2
[FVWM][Echo]:  vis 10 20
[FVWM][Echo]:  vis 10 -10
[FVWM][Echo]:  vis -10 10
[FVWM][Echo]:  vis -24 0
[FVWM][Echo]:  vis -5 -5
[FVWM][Echo]:  vis 1 2
[FVWM][Echo]:  vis 0 2
[FVWM][Echo]:  vis -1 2
[FVWM][Echo]:  vis 1 1
[FVWM][Echo]:  vis 1 0
[FVWM][Echo]:  vis 1 -1
[FVWM][Echo]:  ***
[FVWM][Echo]:  *** SUBMENU TESTS ***
[FVWM][Echo]:  ***
[FVWM][Echo]:  %l%c%r%>

****  Purify instrumented /opt/public/src/fvwmpurify/fvwm/2.3.29/fvwm2 (pid 22473)  ****
UMR: Uninitialized memory read:
  * This is occurring while in:
	MenuInteraction [menus.c:2151]
	do_menu        [menus.c:783]
	menu_func      [menus.c:5461]
	staysup_func   [menus.c:5477]
	execute_function [functions.c:1083]
	old_execute_function [functions.c:1152]
	execute_complex_function [functions.c:1619]
	execute_function [functions.c:1100]
	old_execute_function [functions.c:1152]
	run_command_stream [read.c:142]
	run_command_file [read.c:216]
	ReadFile       [read.c:268]
	execute_function [functions.c:1083]
	old_execute_function [functions.c:1152]
	ExecuteModuleCommand [module_interface.c:641]
	ExecuteCommandQueue [module_interface.c:1503]
	My_XNextEvent  [events.c:2523]
	HandleEvents   [events.c:2669]
	main           [fvwm.c:746]
	_start         [crt1.o]
  * Reading 4 bytes from 0xefffcc98 on the stack.
  * Address 0xefffcc98 is      264 bytes past start of local variable "mi" in function MenuInteraction.
[FVWM][Echo]:  %l%c%r%<
[FVWM][Echo]:  %l%<%c%>%r
[FVWM][menu_func]: <<ERROR>> No such menu non-exist
[FVWM][Echo]:  %l%c%r
[FVWM][Echo]:  %>
[FVWM][Echo]:  ***
[FVWM][Echo]:  *** SPACING TESTS ***
[FVWM][Echo]:  ***
[FVWM][Echo]:  %10l%r%.l
[FVWM][Echo]:  %-10l%r%10.l
[FVWM][Echo]:  %.-10l%r(space)%l%(space)
[FVWM][Echo]:  %.10l%r(tab)%l%(tab)
[FVWM][Echo]:  %10.-10l%r%20p%l
[FVWM][Echo]:  ***
[FVWM][Echo]:  *** HILIGHTING AND SIDEPIC TESTS ***
[FVWM][Echo]:  ***
[FVWM][Echo]:  %s%r%|%l%|%i%c
[FVWM][Echo]:  %r%|%s%l%|%i%c
[FVWM][Echo]:  %r%|%l%|%i%c%s
[FVWM][Echo]:  %s%r%|%l%i%c
[FVWM][Echo]:  %r%|%l%i%c%s
[FVWM][Echo]:  %s%r%l%i%c
[FVWM][Echo]:  %r%l%i%c%s
[FVWM][Echo]:  %s%r%|%l%|%i%c
[FVWM][Echo]:  %r%|%l%|%i%c%s
[FVWM][Echo]:  %|%|
[FVWM][Echo]:  %l%10.1|%1.10|%r
[FVWM][Echo]:  %|%|
[FVWM][Echo]:  %|%-20|
[FVWM][Echo]:  %500|%c%-500|
[FVWM][Echo]:  %100|%c%-100|
[FVWM][Echo]:  %-100|%c%100|
[FVWM][Echo]:  %r%|%l%|%i%|%c%|
[FVWM][Echo]:  %r%|%l%i%c
[FVWM][Echo]:  %rl%i%c
[FVWM][Echo]:  ***
[FVWM][Echo]:  *** ICON PLACEMENT TESTS ***
[FVWM][Echo]:  ***
[FVWM][Echo]:  %i%i icon placement
[FVWM][Echo]:  %i(tab)%i icon placement
[FVWM][Echo]:  (tab)%i(tab)%i(tab) icon placement
[FVWM][Echo]:  (space)%i(space)%i(space) icon placement
[FVWM][Echo]:  %l%l%l%i%i icon placement
[FVWM][Echo]:  %i%r%r%i%r icon placement
[FVWM][Echo]:  %i%i%i%i%i%i icon placement
[FVWM][Echo]:  %i icon placement
[FVWM][Echo]:  (empty) icon placement
[FVWM][Echo]:  ***
[FVWM][Echo]:  *** LABEL PLACEMENT TESTS ***
[FVWM][Echo]:  ***
[FVWM][Echo]:  %l%l%l label placement
[FVWM][Echo]:  %c%c%c label placement
[FVWM][Echo]:  %r%r%r label placement
[FVWM][Echo]:  %r%c%l label placement
[FVWM][Echo]:  %l%c%r label placement
[FVWM][Echo]:  %r%l%c label placement
[FVWM][Echo]:  %c%r%l label placement
[FVWM][Echo]:  %l%l%l label placement with a very long long title
[FVWM][Echo]:  %c%c%c label placement with a very long long title
[FVWM][Echo]:  %r%r%r label placement with a very long long title
[FVWM][Echo]:  %r%c%l label placement with a very long long title
[FVWM][Echo]:  %l%c%r label placement with a very long long title
[FVWM][Echo]:  %r%l%r label placement with a very long long title
[FVWM][Echo]:  %l%l label placement
[FVWM][Echo]:  %c%c label placement
[FVWM][Echo]:  %r%r label placement
[FVWM][Echo]:  %r%l label placement
[FVWM][Echo]:  %l%r label placement
[FVWM][Echo]:  %c%r label placement
[FVWM][Echo]:  %l%c label placement
[FVWM][Echo]:  %l label placement
[FVWM][Echo]:  %c label placement
[FVWM][Echo]:  (empty) label placement
[FVWM][Echo]:  %l%l%l%l%r%c%l%c%r%r label placement

****  Purify instrumented /opt/public/src/fvwmpurify/fvwm/2.3.29/fvwm2 (pid 22473)  ****
UMR: Uninitialized memory read:
  * This is occurring while in:
	_libc_write    [libc.so.1]
	_XFlushInt     [XlibInt.c]
	XCheckTypedWindowEvent [XChkTypWEv.c]
	flush_expose   [events.c:2811]
	RedrawButtons  [borders.c:830]
	DrawDecorations [borders.c:1355]
	HandleFocusIn  [events.c:224]
	DispatchEvent  [events.c:2618]
	HandleEvents   [events.c:2671]
	main           [fvwm.c:746]
	_start         [crt1.o]
  * Reading 188 bytes from 0x156990 in the heap (1 byte at 0x1569c1 uninit).
  * Address 0x156990 is at the beginning of a malloc'd block of 2048 bytes.
  * This block was allocated from:
	malloc         [rtlib.o]
	XOpenDisplay   [XOpenDis.c]
	main           [fvwm.c:377]
	_start         [crt1.o]

****  Purify instrumented /opt/public/src/fvwmpurify/fvwm/2.3.29/fvwm2 (pid 22473)  ****
UMR: Uninitialized memory read:
  * This is occurring while in:
	_libc_write    [libc.so.1]
	_XFlushInt     [XlibInt.c]
	XCheckTypedWindowEvent [XChkTypWEv.c]
	flush_expose   [events.c:2811]
	RedrawTitle    [borders.c:920]
	DrawDecorations [borders.c:1357]
	HandleFocusIn  [events.c:224]
	DispatchEvent  [events.c:2618]
	HandleEvents   [events.c:2671]
	main           [fvwm.c:746]
	_start         [crt1.o]
  * Reading 156 bytes from 0x156990 in the heap (1 byte at 0x1569c1 uninit).
  * Address 0x156990 is at the beginning of a malloc'd block of 2048 bytes.
  * This block was allocated from:
	malloc         [rtlib.o]
	XOpenDisplay   [XOpenDis.c]
	main           [fvwm.c:377]
	_start         [crt1.o]

****  Purify instrumented /opt/public/src/fvwmpurify/fvwm/2.3.29/fvwm2 (pid 22473)  ****
UMR: Uninitialized memory read:
  * This is occurring while in:
	_libc_write    [libc.so.1]
	_XFlushInt     [XlibInt.c]
	XCheckTypedWindowEvent [XChkTypWEv.c]
	flush_expose   [events.c:2811]
	RedrawButtons  [borders.c:830]
	DrawDecorations [borders.c:1355]
	DrawDecorations [borders.c:1319]
	HandleFocusIn  [events.c:224]
	DispatchEvent  [events.c:2618]
	HandleEvents   [events.c:2671]
	main           [fvwm.c:746]
	_start         [crt1.o]
  * Reading 188 bytes from 0x156990 in the heap (1 byte at 0x1569c1 uninit).
  * Address 0x156990 is at the beginning of a malloc'd block of 2048 bytes.
  * This block was allocated from:
	malloc         [rtlib.o]
	XOpenDisplay   [XOpenDis.c]
	main           [fvwm.c:377]
	_start         [crt1.o]

****  Purify instrumented /opt/public/src/fvwmpurify/fvwm/2.3.29/fvwm2 (pid 22473)  ****
UMR: Uninitialized memory read:
  * This is occurring while in:
	_libc_write    [libc.so.1]
	_XFlushInt     [XlibInt.c]
	XCheckTypedWindowEvent [XChkTypWEv.c]
	flush_expose   [events.c:2811]
	RedrawTitle    [borders.c:920]
	DrawDecorations [borders.c:1357]
	DrawDecorations [borders.c:1319]
	HandleFocusIn  [events.c:224]
	DispatchEvent  [events.c:2618]
	HandleEvents   [events.c:2671]
	main           [fvwm.c:746]
	_start         [crt1.o]
  * Reading 156 bytes from 0x156990 in the heap (1 byte at 0x1569c1 uninit).
  * Address 0x156990 is at the beginning of a malloc'd block of 2048 bytes.
  * This block was allocated from:
	malloc         [rtlib.o]
	XOpenDisplay   [XOpenDis.c]
	main           [fvwm.c:377]
	_start         [crt1.o]

--
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: Mon, 12 Feb 2001 14:43:23 +0100

>   * Address 0xefffcc98 is      264 bytes past start of local variable "mi" in function MenuInteraction.

Line 2151 is this in my menus.c:

  mp.flags.has_default_action = False;

This can't have a UMR.  The surrounding block is this:

	  mp.menu = mrPopup;
	  mp.parent_menu = pmp->menu;
	  mp.parent_item = mi;
	  mp.pTmp_win = pmp->pTmp_win;
	  mp.button_window = pmp->button_window;
	  mp.pcontext = pmp->pcontext;
	  mp.flags.has_default_action = False;
	  mp.flags.is_menu_from_frame_or_window_or_titlebar = False;
	  mp.flags.is_sticky = False;
	  mp.flags.is_submenu = True;
	  mp.flags.is_already_mapped = flags.is_submenu_mapped;
	  mp.eventp = (flags.do_popup_and_warp) ? (XEvent *)1 : NULL;
	  mp.pops = &mops;
	  mp.ret_paction = pmp->ret_paction;

But I can't identify the UMR.  Could you try to find out which of
the lines produces the UMR?

> 	XOpenDisplay   [XOpenDis.c]

Looks like an X problem to me.

Bye

Dominik ^_^  ^_^

--
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
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, 12 Feb 2001 09:13:38 -0500

> This can't have a UMR.  The surrounding block is this:

It looks like, to turn on 1 bit it reads in 4 bytes.
Thats not too surprising, but if it is, its reading in
some slack bytes.

Strange that it doesn't know where the 4 bytes are, it reports
the location as 264 beyond "mi".  "mi" is the first automatic
variable in the function.

I think to suppress the UMR we would have to initialize the whole
structure.  Since that would affect performance and executable
size, I don't think thats a good idea.

I guess you don't care about the state of the other 2 bits:

is_invoked_by_key_press
is_first_root_menu

I don't think thats what its detecting.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 12 Feb 2001 15:48:06 +0100

> Thats not too surprising, but if it is, its reading in

But where should it read these bytes from?  "False" is a constant,
not a memory location.

> size, I don't think thats a good idea.

It's an uninitialised memory *read*.  The mp structure has nothing
to do with it.  Zeroing out the structure is not a problem because
it's only done when an sub menu is opened, but it should not fix
the UMR.

> I guess you don't care about the state of the other 2 bits:

Of course I do (although these flags are only used for root
menus).  That's fixed.

Bye

Dominik ^_^  ^_^

---

From: Dan Espen <[email-masked]>
Date: Mon, 12 Feb 2001 10:15:41 -0500

> But where should it read these bytes from?  "False" is a constant,

I think its reading in the 4 bytes in the flags struct so that it
can modify the 1 bit that its trying to change.
It has to load it into a register so that it can change the bit.

I know that the flags struct is defined as 7 bits, but it would
still make the structure 4 butes long.

I don't think its looking at "False".

Since purify doesn't analyse the source code, its misinterpreting
whats going on.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 12 Feb 2001 16:39:12 +0100

> Since purify doesn't analyse the source code, its misinterpreting

Hm, if that is true, the problem must be gone with my latest commit.

Bye

Dominik ^_^  ^_^

---

From: "Paul D. Smith" <[email-masked]>
Date: 12 Feb 2001 11:40:02 -0500

Dan is exactly right in his interpretation.  Remember Purify is a
link-time tool; it doesn't instrument the C source code, it instruments
the object code.  By the time the object code is there, all the
"intelligence" in the C code that would allow you to note that we only
care about that one bit is long gone.  All Purify can see is that you
read a byte (or 4 bytes) of memory which contains uninitialized data,
then try to access it.  That's a UMR.

I have the same thing in GNU make since it also uses bitfields.  I just
set up a Purify options file to have it ignore these accesses, since I
know they're correct.

The other option is to initialize the value in its entirety, so that no
UMR will occur.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>    HASMAT--HA Software Methods & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
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]