This is the mail archive of the gcc@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]

Re: GCC 2.95.3 missing __builtin_va_alist ?


David Edelsohn wrote:
> 
>         Which "include" directory.  There usually only are two files in
> the public include directory under <prefix>/include.  There should be many
> "fixed" files under <prefix>/lib/gcc-lib/<target>/2.95.3/include .  It
> seems more likely that some header file is not getting "fixed" correctly
> or is inconsistent.
> 
>         __builtin_va_list should be defined internally and used by
> stdarg.h and varargs.h hidden in the private GCC headers directory.
> 
> David

Ok, I finally had the time to look into this further.
It is a bug that appears under Solaris 7, but not Linux/Intel
or IRIX 6.5 built from the same gcc sources.
I've submitted a bug report, with this as a test:

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

void
foo(char *fmt, ...);

int
main()
{
  char *test_fmt="%s\n %d\n %c\n";
  foo(test_fmt, "Hello World", 21, '\246');
  return 0;
}

void
foo(char *fmt, ...)
{
  va_list ap;
  int d;
  char c, *p, *s;
  
  va_start(ap, fmt);
  while (*fmt)
    switch(*fmt++) {
    case 's':           /* string */
      s = va_arg(ap, char *);
      printf("string %s\n", s);
      break;
    case 'd':           /* int */
      d = va_arg(ap, int);
      printf("int %d\n", d);
      break;
    case 'c':           /* char */
      /* need a cast here since va_arg only
	 takes fully promoted types */
      c = (char) va_arg(ap, int);
      printf("char %c\n", c);
      break;
    }
  va_end(ap);
}

Here is the compiler's output:
----IRIX 6.5----
freyja::/icarus/build-sun57/src/TKjcas (57)% gcc -v
Reading specs from
/icarus/tools-gnu/sgi65/lib/gcc-lib/mips-sgi-irix6.5/2.95.3/specs
gcc version 2.95.3 20010315 (release)
freyja::/icarus/build-sun57/src/TKjcas (58)% rm test ; gcc -Wall -o test
test.c ; ./test
test.c: In function `foo':
test.c:21: warning: unused variable `p'
string Hello World
int 21
char ¦

----Linux/Intel----
icarus::/icarus/build-sun57/src/TKjcas (125)% gcc -v
Reading specs from
/icarus/tools-gnu/lnx22/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 20010315 (release)
icarus::/icarus/build-sun57/src/TKjcas (126)% rm test ; gcc -Wall -o
test test.c ; ./test
test.c: In function `foo':
test.c:21: warning: unused variable `p'
string Hello World
int 21
char ¦

----Solaris 7----
horus::/icarus/build-sun57/src/TKjcas (444)% gcc -v
Reading specs from
/icarus/tools-gnu/sun57/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/specs
gcc version 2.95.3 20010315 (release)
horus::/icarus/build-sun57/src/TKjcas (445)% rm test ; gcc -Wall -o test
test.c ; ./test
In file included from test.c:1:
/icarus/tools-gnu/sun57/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/include/stdio.h:301:
parse error before `__gnuc_va_list'
/icarus/tools-gnu/sun57/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/include/stdio.h:302:
parse error before `__gnuc_va_list'
/icarus/tools-gnu/sun57/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/include/stdio.h:306:
parse error before `__gnuc_va_list'
/icarus/tools-gnu/sun57/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/include/stdio.h:308:
parse error before `__gnuc_va_list'
test.c: In function `foo':
test.c:23: `__builtin_va_alist' undeclared (first use in this function)
test.c:23: (Each undeclared identifier is reported only once
test.c:23: for each function it appears in.)
test.c:27: warning: implicit declaration of function
`__builtin_va_arg_incr'
test.c:21: warning: unused variable `p'
./test: Command not found.

For my own education would somone reply to this list
when the problem is found?

Thanks,

Robert

-- 
Robert Boehne             Software Engineer
Ricardo Software   Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email:  rboehne@ricardo-us.com


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