This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/1670: HPUX: call through pointer to static function mangles argument values



>Number:         1670
>Category:       c
>Synopsis:       HPUX: call through pointer to static function mangles argument values
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 16 11:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Hans-Bernhard Broeker
>Release:        gcc-2.95.2 (release)
>Organization:
>Environment:
HP-UX 10.20 and higher machines
>Description:
GCC miscompiles 'gnuplot' on HP-UX since version 10.20 of
the OS (and associated hardware).

The bug manifests as incorrect passing of (at least) one
argument of type 'double' of a function that is called
through a function pointer. The 
actual parameter is non-zero, in the calling function, but
the called function receives zero.

Mysteriously, the misbehaviour vanishes as soon as the
function being accessed through through that function
pointer is defined without the 'static' attribute.

The same source works flawlessly both
with the vendor CC on the same platform, and GCC an all other
platforms we (the gnuplot team) have tested it on.
The bug seems to have been in all GCC releases this
was ever tried with.

This has been a long-time nuisance with gnuplot...

>How-To-Repeat:
gnuplot source code is obtainable via ftp from lots of
places, including ftp.gnuplot.org. All versions ever since
3.5 (released back in 1993) seem to show the bug. Just
make it, run the program and plot something, as in:

	gnuplot> plot x

The relevant call is in function gen_tics(), which
calls one of the callback functions like xtick2d_callback().
Set a breakpoint in xtick2d_callback, run, give the
'plot x' command, and in the stopped program, observe the
argument value being zero. Then go up and see what the
actual argument passed in is (it's the variable 'internal',
usually).
>Fix:

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]