Created
October 18, 2019 00:53
-
-
Save vddvss/12cf4d9389c85a1b59da519a2de3d4e9 to your computer and use it in GitHub Desktop.
c reproducer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
struct rect { | |
double x, y, w, h; | |
}; | |
__attribute__((noinline)) | |
void test(struct rect *res, const struct rect *a, const struct rect *b) | |
{ | |
double x1 = pow(a->x, b->x); | |
double y1 = pow(a->y, b->y); | |
double x2 = pow(a->x + a->w, b->x + b->w); | |
double y2 = pow(a->y + a->h, b->y + b->h); | |
if (x2 > x1 && y2 > y1) { | |
res->x = x1; | |
res->y = y1; | |
res->w = x2 - x1; | |
res->h = y2 - y1; | |
} | |
} | |
int main(void) | |
{ | |
struct rect a = { 0.0, 2.0, 2.0, 3.0 }; | |
struct rect b = { 0.0, 2.0, 2.0, 3.0 }; | |
struct rect res = { 0.0, 0.0, 0.0, 0.0 }; | |
test(&res, &a, &b); | |
printf("x = %f, y = %f, w = %f, h = %f\n", res.x, res.y, res.w, res.h); | |
return res.x != 1.0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment