This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: PR 18785: alternative patch


Roger Sayle <roger@eyesopen.com> writes:

> On Mon, 14 Feb 2005, Zack Weinberg wrote:
> To repeat Joseph's point, don't forget to add the testcase and
> mention PR middle-end/18785 in the ChangeLog entry when you commit.

I've added the appended test case in my tree, as gcc.dg/charset/builtin1.c.  
I will wait a bit longer for Geoff to respond before committing.

zw

/* isdigit(c) can be optimized to ((unsigned)c) - '0' <= 9, but only if
   we know the correct value of '0'.  PR 18785.  */

/* { dg-do run } */
/* { dg-options "-O2 -fno-inline -fexec-charset=IBM-1047" } */

extern int isdigit(int);
extern void abort(void);

static int str1(void) { return '1'; }
static int strA(void) { return 'A'; }

int
main(void)
{
  if (!isdigit('1'))
    abort();
  if (isdigit('A'))
    abort();
  if (!isdigit(str1()))
    abort();
  if (isdigit(strA()))
    abort();
  return 0;
}


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