Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/torture/builtin-sprintf.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* PR tree-optimization/86274 - SEGFAULT when logging std::to_string(NAN) | |
2 { dg-do run } | |
3 { dg-options "-O2 -Wall" } */ | |
4 | |
5 #define X "0xdeadbeef" | |
6 #define nan(x) __builtin_nan (x) | |
7 | |
8 volatile double nan_0 = nan ("0"); | |
9 volatile double nan_x = nan (X); | |
10 | |
11 int main (void) | |
12 { | |
13 char buf[80]; | |
14 | |
15 /* Verify that folded results match those of the library calls. */ | |
16 int cst_n_0 = __builtin_sprintf (buf, "%g", nan ("0")); | |
17 int cst_n_x = __builtin_sprintf (buf, "%g", nan (X)); | |
18 | |
19 int var_n_0 = __builtin_sprintf (buf, "%g", nan_0); | |
20 int var_n_x = __builtin_sprintf (buf, "%g", nan_x); | |
21 | |
22 if (cst_n_0 != var_n_0) | |
23 __builtin_abort (); | |
24 | |
25 if (cst_n_x != var_n_x) | |
26 __builtin_abort (); | |
27 | |
28 return 0; | |
29 } |