Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testcase generate with csmith --float undefined-behavior: -7.30288e+18 is outside the range of representable values of type 'int' #130

Open
yansendao opened this issue Mar 23, 2021 · 4 comments

Comments

@yansendao
Copy link

test command:

csmith --float -o test.c -s 1618989589685968
clang -O2  -I /home/yansendao/software/csmith/include -w -Wno-invalid-constexpr -Wno-c++11-narrowing -O2 -ftrapv -fsanitize=undefined,address test.c -w && ./a.out

result:

test.c:306:293: runtime error: -7.30288e+18 is outside the range of representable values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test.c:306:293 in 
checksum = 3D267DD5

csmith version:

csmith 2.4.0
Git version: deddca6

test.zip

@yansendao
Copy link
Author

yansendao commented Mar 24, 2021

test.c:41:11: runtime error: -3.5625 is outside the range of representable values of type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test.c:41:11 in

/*
 * This is a RANDOMLY GENERATED PROGRAM.
 *
 * Generator: csmith 2.4.0
 * Git version: deddca6
 * Options:   --float -o test.c
 * Seed:      1618991815848033
 */

test.zip

@jxyang
Copy link
Member

jxyang commented Mar 28, 2021

Same comment as #132

@yansendao
Copy link
Author

/*
 * This is a RANDOMLY GENERATED PROGRAM.
 *
 * Generator: csmith 2.4.0
 * Git version: deddca6
 * Options:   --float -o test.c
 * Seed:      1619916445114238
 */

image

creduce result:

int printf(const char *, ...);
char b;
int d[0];
float a;
int c;
int main() {
  a = -4294967289;
  c = -a;
  *d = c;
  printf(&b);
}

@chenyang78
Copy link
Member

Thanks for reporting this. Please see my reply to a similar issue:

#132 (comment)

In summary, the --float option is not meant for generating UB-free programs. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants