🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #161

"gcc-2.1 -O" breaks gnuplot on romp-ibm-aos

#161
From: Tim Theisen
Date: Mon, 06 Apr 1992 22:26
150 lines
5803 bytes
I know that this is a pretty vague bug report and that it is possible
that gnuplot has bad code.  However, gnuplot has been compiled with
many different C compilers on many different architectures.  Also, gcc on
the RT is still pretty young.  Therefore, I am guessing that the problem
lies with gcc.

When running gnuplot on an RT compiled with gcc-2.1 -O, 2D plots that have
curves with negative y values come out with incorrect axes.  The y axis
either ranges over positive values only or the y axis ranges over huge
(>1e80) numbers.

The program works fine on an RT when compiled with "gcc-2.1 -O0".
It also works fine on a DECstation or SPARC compiled with either gcc or
native cc with or without optimization.

Here are the details:

I am running gcc-2.1 with the following patch:

Tue Mar 31 06:37:50 1992  Richard Kenner  (kenner at vlsi1.ultra.nyu.edu)

        * expr.c (do_store_flag): Handle case where EXP is a TRUTH_NOT_EXPR.

The source is gnuplot-3.1 which can be fetched from prep.ai.mit.edu.
I have made the following modifications for out local enviroment:

--- 1.1	1992/03/17 23:22:40
+++ gnuplot_x11.c	1992/03/17 23:24:24
@@ -117,7 +117,7 @@
    vchar = (rv.font->ascent + rv.font->descent);
 
    /* add callbacks on input-from-gnuplot-on-stdin & window-resized */
-   XtAddInput(0, XtInputReadMask, gnuplot, NULL);
+   XtAddInput(0, (XtPointer)XtInputReadMask, gnuplot, NULL);
    XtAddEventHandler(w_label, StructureNotifyMask, FALSE, resize, NULL);
 
    XtMainLoop();
@@ -238,7 +238,7 @@
      if (*buf == 'G') {                           /* enter graphics mode */
 	 if (commands) {
 	    int n; for (n=0; n<nc; n++) XtFree(commands[n]);
-	    XtFree(commands);
+	    XtFree((char *)commands);
 	    }
 	 commands = NULL; nc = ncalloc = 0;
          }
@@ -247,7 +247,8 @@
       else {
 	 if (nc >= ncalloc) {
 	    ncalloc = ncalloc*2 + 1;
-	    commands = (String *)XtRealloc(commands, ncalloc * sizeof(String));
+	    commands = (String *)XtRealloc((char *)commands,
+					   ncalloc * sizeof(String));
 	    }
 	 commands[nc++] = XtNewString(buf);
 	 }
--- 1.1	1992/03/17 22:29:39
+++ makefile.unx	1992/03/30 23:46:11
@@ -14,17 +14,20 @@
 
 TARGET = All # What to make by default
 
+
+MAKE = make # for dumb makes
+
 ############################################################
 #>>> Decide where the binaries and manuals will go. 
 # directory where to install executables on 'make install'
-DEST=/usr/local/bin
+DEST=/usr/gnu/bin
 # directory for installing man page on 'make man_install'.
-MANDEST=/usr/man/manl
+MANDEST=/usr/gnu/man/manl
 # where to install help file gnuplot.gih
-HELPDEST=/usr/local/lib/gnuplot.gih
+HELPDEST=/usr/gnu/lib/gnuplot.gih
 #HELPDEST=docs/gnuplot.gih
 # Where to send email about bugs and comments (locally)
-EMAIL=bug-gnuplot%pixar.uucp@sun.com
+EMAIL=lab
 
 ############################################################
 #>>> Choose your C compiler and basic compiler flags.
@@ -45,7 +48,7 @@
 #   If NOCWDRC is defined, then any .gnuplot in the current directory
 #   is not read on startup. This is a security consideration
 #   especially for root users ( we recommend you define -DNOCWDRC ).
-OPTIONS = -DREADLINE -DNOCWDRC
+OPTIONS = -DNOCWDRC
 
 #>>> Optionally install the lasergnu script.
 # Lasergnu is a handy shell script for creating a plot from the
@@ -131,7 +134,7 @@
 
 # Defaults in case the user types 'make All' directly
 # Should match X11R4_FLAGS's CFLAGS definition
-CFLAGS = $(COPTS) $(OPTIONS)
+CFLAGS = $(COPTS) $(OPTIONS) -DGAMMA=lgamma
 
 ############################################################
 # Terminal (device) support
@@ -150,7 +153,7 @@
 # -DUNIXPC      unixpc (ATT 3b1 or ATT 7300)
 # -DUNIXPLOT    unixplot
 # -DX11         X11 Window System (This is $(PLOTXFLAG))
-TERMFLAGS = -Iterm -DUNIXPLOT $(PLOTXFLAG)
+TERMFLAGS = -Iterm $(PLOTXFLAG)
 
 ############################################################
 # Library explanations. 
@@ -161,13 +164,13 @@
 #  -lsuntool -lsunwindow -lpixrect  if you have -DSUN in TERMFLAGS
 #  -lgl_s if -DIRIS4D in TERMFLAGS
 #  -lccgi if -DCGI in TERMFLAGS
-LIBS = -lm -lplot
+LIBS = -lm
 
 ############################################################
 # Machine-dependent settings.
 #
 X11R4_FLAGS = \
-    	   CFLAGS="$(COPTS) $(OPTIONS)" \
+    	   CFLAGS="$(COPTS) $(OPTIONS) -DGAMMA=lgamma" \
     	   LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
     	   X11LIBS="$(X11LIBS)" \
     	   PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \

I compiled gnuplot with the following commands:

ln -s makefile.unx makefile
make CC=gcc x11r4

I ran the demonstration with the following commands (. needs to be in $PATH):
cd demo
ln -s ../gnuplot_x11 gnuplot_x11
ln -s ../gnuplot gnuplot
gnuplot all.demo

The problem should be apparent.

I don't have time right now to narrow this down.  I just wanted to let
you know of a potential problem.

Good Luck!  ...Tim

          Tim Theisen           Systems Programmer
Internet: tim@cs.wisc.edu       Department of Computer Sciences
    UUCP: uwvax!tim             University of Wisconsin-Madison
   Phone: (608)262-0438         1210 West Dayton Street
     FAX: (608)262-9777         Madison, WI   53706
Technical Details
Message-ID: <9204062226.AA10625@appenzell.cs.wisc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.wisc.edu!tim

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.wisc.edu!tim
From: tim@cs.wisc.edu (Tim Theisen)
Subject: "gcc-2.1 -O" breaks gnuplot on romp-ibm-aos
Message-ID: <9204062226.AA10625@appenzell.cs.wisc.edu>
Sender: gnulists@ai.mit.edu
Organization: University of Wisconsin-Madison, Department of Computer Sciences
Distribution: gnu
Date: Mon, 6 Apr 1992 22:26:01 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 151