> Yes, I know. But that really isn't a solution. I don't want to compile
> without optimisation. What I want is the bug in ecgs to be fixed.

It is not a bug in egcs, it is a bug in glibc. With -O2, the
preprocessor expands your code to

int func (char *array)
{
  return ({ 
    int __res;  
    if (sizeof (array[0]) > 1){ 
      if (__builtin_constant_p (array[0])){
        int __c = (array[0]);
        __res = __c < -128 || __c > 255 ? __c : __ctype_tolower [__c];  
      }else
        __res = tolower(array[0]);
    }else
      __res = __ctype_tolower [(int) (array[0])];
    __res; 
  });
}

This is clearly not valid ISO C, so with -pedantic, the compiler must
complain. The fix is to tell it not to complain here, with

int func (char *array)
{
  return __extension__({ 
  ...

In glibc 2.1, this translates to

--- ctype.h.old Sun Aug 15 07:54:39 1999
+++ ctype.h     Sun Aug 15 07:55:06 1999
@@ -165,7 +165,7 @@
 
 #if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
 # define __tobody(c, f, a) \
-  ({ int __res;                                                                      \
+  __extension__({ int __res;                                                 \
      if (sizeof (c) > 1)                                                     \
        {                                                                     \
         if (__builtin_constant_p (c))                                        \

Regards,
Martin

Reply via email to