Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: keith@earth.ox.ac.uk (Keith Refson)
Subject: Re: Known problems with varargs on Alpha OSF/1 1.3?
Date: Tue, 22 Mar 94 15:39:12 GMT	[thread overview]
Message-ID: <1994Mar22.153912.2939@inca.comlab.ox.ac.uk> (raw)
In-Reply-To: 2mk31b$ah4@news.iastate.edu

Sean Murphy <sean@applix.com> wrote:
}Is anyone aware of any known problems with the varargs set of goodies
}as implemented on the DEC Alpha system running OSF/1 1.3? Any problems
}in the area of indexing thru the arg list with va_arg()?      

I have found a bug (well I'm sure I'm not the first).  Variable-length
argument lists containing "double" args don't work when the program
is compiled with a) optimization and b) -std or -std1 ANSI modes.

Here's a test case:

The following program produces incorrect output
 
        Test vec                         = 2 3 3 ordinal

when compiled with the options "-O" and "-std" and correct output

        Test vec                         = 1 2 3 ordinal

otherwise.  

Keith Refson
----------------------
#include <stdio.h>

/******************************************************************************
 *   Format_vec     Print the name and value of some parameter in same format *
 ******************************************************************************/
static void     format_vec(text,value1,value2,value3,units)
char    *text;
double  value1,value2,value3;
char    *units;
{
   (void)printf("\t%-32s = %g %g %g %s\n",
                 text,value1,value2,value3,units);
}

main()
{
   double one=1.0,two=2.0,three=3.0,four=4.0;
   format_vec("Test vec",one,two,three,"ordinal");
}


--
------------------------------------------------------------------------------
| Email   : keith@earth.ox.ac.uk    | Dr Keith Refson, Dept of Earth Sciences|
| TEL(FAX): +44 865 272026 (272072) | Parks Road, Oxford OX1 3PR, UK         |
------------------------------------------------------------------------------


  reply	other threads:[~1994-03-22 15:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-03-08  0:11 Known problems with varargs on Alpha OSF/1 1.3? Sean Murphy [ext 332]
1994-03-21  0:51 ` Sean Levy
1994-03-21 12:13 ` John Hascall
1994-03-22 15:39   ` Keith Refson [this message]
1994-03-22 18:00     ` Randy Buckland
1994-03-22 18:09       ` Randy Buckland
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox