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