🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #690

xclock and "gcc -O" don't mix (with fix)

#690
From: Arthur David Olson
Date: Sat, 07 Oct 1989 20:52
77 lines
2292 bytes
			  X Window System Bug Report
			    xbugs@expo.lcs.mit.edu




VERSION:
	R3

CLIENT MACHINE and OPERATING SYSTEM:
	Sun 3/60 running SunOS 4.0.3

DISPLAY:
	Sun CG4

WINDOW MANAGER:
	uwm

AREA:
	xclock

SYNOPSIS:
	xclock and gcc -O don't mix

DESCRIPTION:
	xclock.c contains this code. . .
		static Junk()
		{
		#include <X11/Vendor.h>
		WidgetClass junk = vendorShellWidgetClass;
		}
	. . .to create a reference to "vendorShellWidgetClass" in "xclock.o"
	and cause "the linker to include the vendorShell module from Xaw,
	rather than the one from Xt".  As it happens, gcc optimization is
	smart enough to notice that "junk" is never used; it therefore doesn't
	generate the desired reference.  So the Xaw vendorSehllWidgetClass
	doesn't get included; in particular, this means that iconPixmaps
	can't be set for xclocks.

REPEAT BY:
	Compiling xclock using gcc and the -O option, then using the command
		xclock -xrm "*iconPixmap: mensetmanus"
	and noting the
		X Toolkit Warning: No type converter registered for
			'String' to 'Pixmap' conversion.
	warning.

SAMPLE FIX:
*** 1.1/xclock.c	Sat Oct  7 16:44:21 1989
--- 1.2/xclock.c	Sat Oct  7 16:44:21 1989
***************
*** 52,61 ****
  /* this silliness causes the linker to include the VendorShell
   * module from Xaw, rather than the one from Xt.
   */
! static Junk()
  {
  #include <X11/Vendor.h>
! WidgetClass junk = vendorShellWidgetClass;
  }
  #endif
  
--- 52,61 ----
  /* this silliness causes the linker to include the VendorShell
   * module from Xaw, rather than the one from Xt.
   */
! static WidgetClass Junk()
  {
  #include <X11/Vendor.h>
!     return vendorShellWidgetClass;
  }
  #endif
  
-- 
	 To understand Sun's corporate culture look at the vi source code.
	Arthur David Olson   ado@alw.nih.gov   ADO is a trademark of Ampex.
Technical Details
Message-ID: <8910072052.AA10557@elsie>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ALW.NIH.GOV!elsie!ado

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ALW.NIH.GOV!elsie!ado
From: elsie!ado@ALW.NIH.GOV (Arthur David Olson)
Newsgroups: gnu.gcc.bug
Subject: xclock and "gcc -O" don't mix (with fix)
Message-ID: <8910072052.AA10557@elsie>
Date: 7 Oct 89 20:52:57 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 77