1 /* Check that the div0s instruction is used for integer sign comparisons. */ 2 /* { dg-do compile } */ 3 /* { dg-options "-O2" } */ 4 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */ 5 /* { dg-final { scan-assembler-times "div0s" 2 } } */ 6 7 typedef struct { unsigned int arg[100]; } *FunctionCallInfo; 8 typedef struct { int day; int month; } Interval; 9 void* palloc (unsigned int); 10 int bar (void); 11 void baz (void); 12 13 void interval_pl(FunctionCallInfo fcinfo)14interval_pl (FunctionCallInfo fcinfo) 15 { 16 Interval *span1 = ((Interval *) ((char *) ((fcinfo->arg[0])))); 17 Interval *span2 = ((Interval *) ((char *) ((fcinfo->arg[1])))); 18 Interval *result = (Interval *) palloc (sizeof (Interval)); 19 20 /* Should emit 2x div0s. */ 21 if ((((span1->month) < 0) == ((span2->month) < 0)) 22 && !(((result->month) < 0) == ((span1->month) < 0))) 23 do { 24 if (bar ()) 25 baz (); 26 } while(0); 27 result->day = span1->day + span2->day; 28 } 29