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]

var args issues on DEC alpha


System Info:
$ gcc -v
Reading specs from /usr/lib/gcc-lib/alpha-dec-osf4.0e/2.95.1/specs
gcc version 2.95.1 19990816 (release)

$ uname -a
OSF1 toaster.toaster.unisa.edu.au V4.0 1091 alpha

While trying to use gcc to compile any program that uses stdarg.h or
varargs.h comes up with a compiler error similar to:
compat.c: In function `snprintf':
compat.c:1712: warning: implicit declaration of function
`__builtin_va_start'
compat.c: In function `vsnprintf':
compat.c:1774: parse error before `long'
compat.c:1774: parse error before `long'
compat.c:1774: parse error before `)'
compat.c:1797: parse error before `unsigned'
compat.c:1797: parse error before `unsigned'
compat.c:1797: parse error before `)'

Through trying various things to the code a friend and I managed to come
up with where the problem is.  Directly from stdarg.h on the system:

#define va_arg(list, mode) \
        (*((__builtin_isfloat(mode) && sizeof(mode) > sizeof(double)) ? \
           *(((list)._offset += ((int)sizeof(mode *) + 7) & -8), \
             (mode **)( ((char *)(list)._a0) + (list)._offset - \
                (((int)sizeof(mode *) + 7) & -8))) : \
           (((list)._offset += ((int)sizeof(mode) + 7) & -8), \
            (mode *)( ((char *)(list)._a0) + (list)._offset - \
                     ((__builtin_isfloat(mode) && (list)._offset <= (6 * 8)) ? \
                      (6 * 8) + 8 : ((int)sizeof(mode) + 7) & -8)))))

As you can see this uses an operator (I think you'd call it):
__builtin_isfloat

I'm guessing that is similar to the sizeof() operator but returns 1 if
whatever is in the brackets is the text float or something like that.

Any time va_start is used it comes up with this warning:
warning: implicit declaration of function `__builtin_va_start'

And I am guessing that is handled by the compiler on the box also.


The reason I believe this is a compiler bug is because the code compiles
fine using thei OS default compiler, but I would prefer to use gcc if
possible. If you want access to the system to test it out, let me know.

regards,
Trevor Nichols.


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