diff --git a/ORCACDefs/stdarg.h b/ORCACDefs/stdarg.h index 5b579f5..8459cd9 100644 --- a/ORCACDefs/stdarg.h +++ b/ORCACDefs/stdarg.h @@ -27,7 +27,9 @@ typedef char *__va_list[2]; typedef __va_list va_list; #define va_end(a) __va_end(a) #define va_start(ap,LastFixedParm) ((void) ((ap)[0] = (ap)[1] = (char *) (&LastFixedParm + 1))) -#define va_arg(ap,type) ((type *)((ap)[0] += sizeof(type)))[-1] +#define va_arg(ap,type) _Generic(*(type *)0, \ + double: (type)((long double *)((ap)[0] += sizeof(long double)))[-1], \ + default: ((type *)((ap)[0] += sizeof(type)))[-1]) void __va_end(va_list); diff --git a/cc.notes b/cc.notes index df71550..86173eb 100644 --- a/cc.notes +++ b/cc.notes @@ -1215,6 +1215,10 @@ int foo(int[42]); 162. In certain cases, an assignment from a location with an 8-bit type to a location with a 16-bit type might store the wrong value. +163. When an argument of type double was passed to a function taking variable arguments, va_arg(ap,double) would not retrieve it correctly. + +(Devin Reade) + -- Bugs from C 2.1.0 that have been fixed ----------------------------------- 1. In some situations, fread() reread the first 1K or so of the file.