public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Test suite bug...?
       [not found] <85256937.004D88D0.00@smtpgt2.oscsystems.com>
@ 2000-08-10  8:03 ` Tim Prince
  0 siblings, 0 replies; only message in thread
From: Tim Prince @ 2000-08-10  8:03 UTC (permalink / raw)
  To: gcc-bugs, David Termohlen; +Cc: gcc

I suppose this test may have been placed in c-torture/compile to see
whether gcc is able to produce suitable diagnostics without crashing on
this totally non-sensical fragment:

921206-1.c:5: warning: return-type defaults to `int'
921206-1.c: In function `f':
921206-1.c:22: warning: unused variable `cz'
921206-1.c:18: warning: unused variable `ax'
921206-1.c:27: warning: implicit declaration of function `pow'
921206-1.c:8: warning: `smap' might be used uninitialized in this
function
921206-1.c:11: warning: `g' might be used uninitialized in this function
921206-1.c:12: warning: `cx' might be used uninitialized in this
function
921206-1.c:12: warning: `cy' might be used uninitialized in this
function
921206-1.c:28: warning: control reaches end of non-void function
/lib/libcygwin.a(libcmain.o)(.text+0x6a):libcmain.c: undefined reference
to `WinMain@16'
collect2: ld returned 1 exit status

True, this function was never intended to run, much less verify the
correctness of the functions invoked.  You will note that the pow()
function would produce additional complaints under #include <math.h>.

There are some crude trig function tests in the libstdc++ testsuite, and
in the (somewhat off topic) glibc suite.  Further off topic, if you want
a sample of serious testing, look at the Elefunt suite.  I have
completed a C port, begun by P J Plauger, and the long double versions
are included in the file ftp://members.aol.com/n8tm/llibm.tgz

Tim Prince
----- Original Message -----
From: "David Termohlen" <Termohlen.David@oscsystems.com>
To: <gcc-bugs@gcc.gnu.org>
Sent: Thursday, August 10, 2000 7:07 AM
Subject: Test suite bug...?


>
>
> I'm not sure if this is a bug... but it sure looks ugly...
>
> Looking for a validation for sin/cos, I came accros your test suite.
In file
> 921206-1.c "smap" is never initialized and the index "l" is allowed to
go
> negative.
>
> Also, the test does not check the full range of (un normalized) values
sent to
> "sin".  In short, it looks like this routine has never been used...
Do y'all
> have another set of routine to validate trig functions?
>
>      Dave Termohlen
>
> double sqrt(double),fabs(double),sin(double);
> int sxs;
> int sys;
> f()
> {
>   int l;
>   int sm = -52, sx = 52;
>   char *smap;
>   for (l = 0; l < 9; l++)
>     {
>       double g;
>       int cx, cy, gx, gy, x, y;
>       gx = 2 > g / 3 ? 2 : g / 3;
>       gy = 2 > g / 3 ? 2 : g / 3;
>       for (y = 0 > cy - gy ? 0 : cy - gy; y <= (sys - 1 < cy + gy ?
sys : cy +
> gy); y++)
>      {
>        int sx = 0 > cx - gx ? 0 : cx - gx;
>        short *ax = (short *) (y * sxs + sx);
>
>        for (x = sx; x <= (sxs - 1 < cx + gx ? sxs - 1 : cx + gx); x++)
>          {
>            double c=2.25, z=sqrt(fabs(1-c)),
cz=(c>1?0.0:-10)>z?c>1?0:1:z;
>          }
>      }
>     }
>   for (l = sm; l <= sx; l++)
>     smap[l] = l > 0 ? 1 + pow(sin(.1 * l / sx)) : 1 - pow(sin(.1 * l /
sm));
> }
>
>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-08-10  8:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <85256937.004D88D0.00@smtpgt2.oscsystems.com>
2000-08-10  8:03 ` Test suite bug...? Tim Prince

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).