1 /* In this snippet, there was a missed subc case: 2 tst #1,r0 3 movt r0 4 neg r0,r0 5 6 which should be: 7 tst #1,r0 8 subc r0,r0 9 */ 10 11 /* { dg-do compile } */ 12 /* { dg-options "-O2 -fno-tree-forwprop" } */ 13 14 /* { dg-final { scan-assembler-times {tst #1,r0} 1 } } */ 15 /* { dg-final { scan-assembler-times {subc r} 1 } } */ 16 17 /* { dg-final { scan-assembler-not "movt|not\t|neg\t|movrt" } } */ 18 19 20 struct inode 21 { 22 unsigned int i_gid; 23 }; 24 25 struct iattr 26 { 27 unsigned int ia_valid; 28 unsigned int ia_gid; 29 }; 30 31 struct task_struct 32 { 33 unsigned long flags; 34 unsigned int cap_effective; 35 }; 36 37 extern int in_group_p (unsigned int); 38 39 static inline struct task_struct* get_current(void)40get_current (void) 41 { 42 struct task_struct *current; 43 return current; 44 } 45 46 static inline int capable(int cap)47capable (int cap) 48 { 49 if (((get_current()->cap_effective) & (1 << (cap)))) 50 { 51 get_current()->flags |= 0x00000100; 52 return 1; 53 } 54 return 0; 55 } 56 57 int inode_change_ok(struct inode * inode,struct iattr * attr)58inode_change_ok (struct inode *inode, struct iattr *attr) 59 { 60 int retval = -1; 61 unsigned int ia_valid = attr->ia_valid; 62 63 if (ia_valid & 512) 64 goto fine; 65 66 if ((ia_valid & 4) 67 && (!in_group_p(attr->ia_gid) && attr->ia_gid != inode->i_gid) 68 && !capable(0)) 69 goto error; 70 71 fine: 72 retval = 0; 73 error: 74 return retval; 75 } 76