Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* Known problems with varargs on Alpha OSF/1 1.3?
@ 1994-03-08  0:11 Sean Murphy [ext 332]
  1994-03-21  0:51 ` Sean Levy
  1994-03-21 12:13 ` John Hascall
  0 siblings, 2 replies; 6+ messages in thread
From: Sean Murphy [ext 332] @ 1994-03-08  0:11 UTC (permalink / raw)


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 will avoid the gross details at this point, but it's got to do with
getting garbage pointers after the 1st arg in an arg list. Anything 
Alpha/OSF specific I should know?

Thanks for any info... 
Please respond to :		sean@applix.com


Sean
sean@applix.com
---------------



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Known problems with varargs on Alpha OSF/1 1.3?
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Sean Levy @ 1994-03-21  0:51 UTC (permalink / raw)


I've had varargs problems with DEC's cc.  I've had no problems with
gcc 2.5.5 and greater PROVIDED that you insert the following magic
in your compilation lines/Makefiles:

-I<root_of_gcc_install_tree>/lib/gcc-lib/alpha-dec-osf1.3/<gcc_vers>/include

Just to make this concrete, for me this is:

-I/usr/ndim/local/lib/gcc-lib/alpha-dec-osf1.3/2.5.7/include

For some odd reason which I have not yet had time to figure out, gcc
either does not do this by default or puts this directory after all
the standard ones on its paths.  In any case, this is a Bad Thing,
since it causes the /usr/include version of varargs.h (or stdargs.h,
depending on how you're doing your stuff) to be found before gcc's.
If you put the above -I in your calls to gcc, your varargs code will
magically work.

I *strongly* suggest folks doing serious development on alphas go out
and get gcc 2.5.7 (NOT 2.5.8 -- it gets fatal internal errors trying
to compile simple things) and gdb 4.12, minimally.  Even if you like
the DEC cc's optimizer better, the GNU stuff is still a much better
environment for debugging (as in, it works).  One word of caution,
however: do NOT use -ggdb if you intend to use pixie, as it puts
things in the symbol table that confuses prof.

Hope this helps.

Cheers,
				-- Sean
-- 
                                                       prototype (n) -
Sean Levy, n-dim Group, EDRC, CMU | +1 412 268-      |  something you intend to
snl+@CMU.EDU (MIME,ATK)           |        5222(vox) |  throw away, but somehow
snl@DAMRAK.SLIP.CS.CMU.EDU (NeXT) |        5229(fax) |  never do.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Known problems with varargs on Alpha OSF/1 1.3?
  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
  1 sibling, 1 reply; 6+ messages in thread
From: John Hascall @ 1994-03-21 12:13 UTC (permalink / raw)


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 will avoid the gross details at this point, but it's got to do with
}getting garbage pointers after the 1st arg in an arg list. Anything 
}Alpha/OSF specific I should know?

   We've ported several programs using varargs.  Those which 
   were correct worked fine.  Those which were brain-damaged,
   for example:

        dumbfunc(brain, damage, va_alist)
             int brain, damage;
             va_dcl
        { ...

   don't work under OSF/1 (although you could get away with this
   *improper* behavior under, for example, Ultrix).

John
PS, speaking of brain-damage, which numbskull decided not to
    have a semi-colon after "va_dcl"?!?!
-- 
John Hascall                   ``An ill-chosen word is the fool's messenger.''
Systems Software Engineer
Project Vincent
Iowa State University Computation Center  +  Ames, IA  50011  +  515/294-9551


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Known problems with varargs on Alpha OSF/1 1.3?
  1994-03-21 12:13 ` John Hascall
@ 1994-03-22 15:39   ` Keith Refson
  1994-03-22 18:00     ` Randy Buckland
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Refson @ 1994-03-22 15:39 UTC (permalink / raw)


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         |
------------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Known problems with varargs on Alpha OSF/1 1.3?
  1994-03-22 15:39   ` Keith Refson
@ 1994-03-22 18:00     ` Randy Buckland
  1994-03-22 18:09       ` Randy Buckland
  0 siblings, 1 reply; 6+ messages in thread
From: Randy Buckland @ 1994-03-22 18:00 UTC (permalink / raw)


shaman[temp]% cc -o t t.c
shaman[temp]% ./t
        Test vec                         = 1 2 3 ordinal
shaman[temp]% cc -o t -O t.c
shaman[temp]% ./t
        Test vec                         = 1 2 3 ordinal
shaman[temp]% cc -o t -O -std t.c
shaman[temp]% ./t
        Test vec                         = 1 2 3 ordinal
shaman[temp]% cc -o t -O2 -std t.c
shaman[temp]% ./t
        Test vec                         = 1 2 3 ordinal
shaman[temp]% cc -o t -O3 -std t.c
shaman[temp]% ./t
        Test vec                         = 1 2 3 ordinal
----------------------------------------

I don't see any problem. Alpha 3000/400 OSF/1 V1.3A  (Rev. 112)


--
Randy Buckland                               "It's hard to work
North Carolina State University               in a group when you're
randy_buckland@ncsu.edu (919) 515-5491        omnipotent"       -- Q


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Known problems with varargs on Alpha OSF/1 1.3?
  1994-03-22 18:00     ` Randy Buckland
@ 1994-03-22 18:09       ` Randy Buckland
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Buckland @ 1994-03-22 18:09 UTC (permalink / raw)


Followup to previous post:

After posting that I couldn't get the bug, I realized that I had left out
the "#include <stdio.h>" line when cutting the program from the original 
posting. That is what causes the bug to show up.

--
Randy Buckland                               "It's hard to work
North Carolina State University               in a group when you're
randy_buckland@ncsu.edu (919) 515-5491        omnipotent"       -- Q


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1994-03-22 18:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
1994-03-22 18:00     ` Randy Buckland
1994-03-22 18:09       ` Randy Buckland

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