[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: [C PATCH] Simple compile-time array bounds checking
From:       Paolo Bonzini <paolo.bonzini () lu ! unisi ! ch>
Date:       2007-01-13 14:03:52
Message-ID: 45A8E6C8.3020907 () lu ! unisi ! ch
[Download RAW message or body]

Roger Sayle wrote:
> My apologies if this is a frequently contributed patch, but I recently
> came across a bug in a colleague's code that had been diagnosed by IBM's
> xlc compiler, but I was surprised/shocked to discover that it is
> uncommented upon by GCC.  Given some blatently incorrect code such as:

In case somebody wants to make it clever, I suggest adding a testcase that

struct s {
   int x;
   int a[1];
}

int f(struct s *z)
{
   return z->a[2];
}

does not give a warning, while

int f(struct s z)
{
   return z.a[2];
}

should give a warning (XFAILed if your patch is not clever enough?).

Paolo
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic