https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91932
Bug ID: 91932
Summary: #pragma does not silence floating constant overflow
warnings
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: lh_mouse at 126 dot com
Target Milestone: ---
### Testcase 1:
```c
#pragma GCC diagnostic ignored "-Woverflow"
double x = 1.0e10000;
```
results in
```
prog.cc:2:1: warning: floating constant exceeds range of 'double' [-Woverflow]
2 | double x = 1.0e10000;
| ^~~~~~
```
### Testcase 2: <https://wandbox.org/permlink/Qcck5DvbLwOu9Ls3>
```c
#pragma GCC diagnostic ignored "-Woverflow"
#define CONS(a,b) 1.0##e##a##b
int main()
{
double x = CONS(-,10000);
double y = CONS(+,10000);
(void)(x+y);
}
```
results in:
```
prog.cc:7:3: warning: floating constant truncated to zero [-Woverflow]
7 | double x = CONS(-,10000);
| ^~~~~~
prog.cc:8:3: warning: floating constant exceeds range of 'double' [-Woverflow]
8 | double y = CONS(+,10000);
| ^~~~~~
```
This overflow/underflow is intended sometimes.