re PR target/53272 (wrong condition-codes for strict-low-part destination and small-integer source)

PR target/53272
	* gcc.dg/torture/pr53272-1.c, gcc.dg/torture/pr53272-2.c: New test.

From-SVN: r187284
This commit is contained in:
Hans-Peter Nilsson 2012-05-08 15:21:50 +00:00 committed by Hans-Peter Nilsson
parent b3374f1493
commit 88231ff681
3 changed files with 83 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2012-05-08 Hans-Peter Nilsson <hp@axis.com>
PR target/53272
* gcc.dg/torture/pr53272-1.c, gcc.dg/torture/pr53272-2.c: New test.
2012-05-08 Richard Guenther <rguenther@suse.de>
* gcc.dg/fold-bitand-4.c: New testcase.

View File

@ -0,0 +1,39 @@
/* { dg-do run } */
/* { dg-additional-sources "pr53272-2.c" } */
struct rtc_class_ops {
int (*f)(void *, unsigned int enabled);
};
struct rtc_device
{
void *owner;
const struct rtc_class_ops *ops;
int ops_lock;
};
__attribute__ ((__noinline__, __noclone__))
extern int foo(void *);
__attribute__ ((__noinline__, __noclone__))
extern void foobar(void *);
__attribute__ ((__noinline__, __noclone__))
int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
{
int err;
asm volatile ("");
err = foo(&rtc->ops_lock);
if (err)
return err;
if (!rtc->ops)
err = -19;
else if (!rtc->ops->f)
err = -22;
else
err = rtc->ops->f(rtc->owner, enabled);
foobar(&rtc->ops_lock);
return err;
}

View File

@ -0,0 +1,39 @@
__attribute__ ((__noinline__, __noclone__))
int foo(void *x)
{
asm ("");
return *(int *) x != 42;
}
__attribute__ ((__noinline__, __noclone__))
void foobar(void *x)
{
asm ("");
if (foo(x))
__builtin_abort();
}
struct rtc_class_ops {
int (*f)(void *, unsigned int enabled);
};
struct rtc_device
{
void *owner;
struct rtc_class_ops *ops;
int ops_lock;
};
extern __attribute__ ((__noinline__, __noclone__))
int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int);
int main(void)
{
struct rtc_class_ops ops = {(void *) 0};
struct rtc_device dev1 = {0, &ops, 42};
if (rtc_update_irq_enable (&dev1, 1) != -22)
__builtin_abort ();
__builtin_exit (0);
}