Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2002 23:44:17 +0900 (JST)
From:      Hidenori Ishikawa <hideishi@magisystem.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        hideishi@magisystem.net
Subject:   ports/46329: gnuplot compiled with -march=pentiumpro outputs broken PostScript
Message-ID:  <200212171444.gBHEiHjw069486@casper.geofront.magisystem.net>

next in thread | raw e-mail | index | archive | help

>Number:         46329
>Category:       ports
>Synopsis:       gnuplot compiled with -march=pentiumpro outputs broken PostScript
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 17 06:50:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Hidenori Ishikawa
>Release:        FreeBSD 4.7-RELEASE i386
>Organization:
Chiba *BSD User Group
>Environment:
System: FreeBSD casper.geofront.magisystem.net 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Sat Oct 12 23:31:59 JST 2002 root@casper.geofront.magisystem.net:/raid0/obj/raid0/src/4.7-RELEASE/src/sys/SMP-4.7-RELEASE i386


>Description:
gnuplot port (ports/math/gnuplot) compiled with "-march=pentiumpro" on
FreeBSD 4.7-RELEASE environment (the system gcc-2.95.4 compiler)
outputs broken PostScript file.
Actually, the PostScript file itself is readable, but the scale factor
of hight becomes 0.050 where it should be 0.100 as width.
This is really due to COMPILER BUG when "-march=pentiumpro" is
enabled.
>How-To-Repeat:
Compile gnuplot port (ports/math/gnuplot) on FreeBSD 4.7-RELEASE
envrionment with "-march=pentiumpro" option, i.e. with something like
CPUTYPE=i686.

Execute following commands on gnuplot console.
-- from here --
set output "test.ps"
set term postscript
plot sin(x)
-- end --
Take a look at the output PostScript "test.ps" with some means.
The output should be squashed in a half height.
>Fix:
The responsible source code in gnuplot program is
gnuplot-3.7.2/term/post.trm
line 948-949 where
-- gnuplot-3.7.2/term/post.trm (line 944-952) --
	if (!ps_common_encap)
		fprintf(gpoutfile,"%%%%Page: %d %d\n",ps_page,ps_page);
	fprintf(gpoutfile,"gnudict begin\ngsave\n");
	fprintf(gpoutfile,"%d %d translate\n",ps_common_xoff, ps_common_yoff);
(here)	fprintf(gpoutfile,"%.3f %.3f scale\n", (ps_common_encap ? 0.5 : 1.0)/PS_SC,
	                                       (ps_common_encap ? 0.5 : 1.0)/PS_SC);
	if (!ps_common_portrait) {
		fprintf(gpoutfile,"90 rotate\n0 %d translate\n", (int)(-PS_YMAX));
	}
-- end --
The line pointed out with (here) should output "0.100, 0.100 scale\n" to
gpoutfile, when ps_common_encap == 1.
But due to compiler bug, the output becomes "0.050, 0.100 scale\n".
Since second and third argument of fprintf() is EXACTLLY THE SAME,
the output should be the same as well.
But somehow, evaluation of the parenthesis in second argument
(ps_common_encap ? 0.5 : 1.0) 
failes, hence produces broken output.
The squashed image is due to the scaling factor mismatch of height and 
width produced above.

The easiest workaround is to disable "-march=pentiumpro" option,
i.e. set NO_CPU_CFLAGS when compiling gnuplot port.

But, this is a compiler bug, so I think it is more important to
check the lexical analyzer of gcc on 4.7-RELEASE platform.

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212171444.gBHEiHjw069486>